Authored by mingdan.ge

cps三期申请

... ... @@ -87,7 +87,6 @@
<value>/UnionShareRest/queryUnionShareOrders</value>
<value>/UnionShareRest/mqUnionShareOrder</value>
<value>/UnionShareRest/mqUnionSettleUpdate</value>
<value>/UnionShareRest/agreeContract</value>
<value>/UnionShareRest/bindBankCard</value>
<value>/UnionShareRest/getBankList</value>
<value>/UnionShareRest/getBankCard</value>
... ... @@ -98,6 +97,8 @@
<value>/UnionShareRest/cancelUserBanks</value>
<value>/UnionShareRest/refuseApply</value>
<value>/UnionShareRest/agreeApply</value>
<value>/UnionShareRest/userApply</value>
<value>/UnionShareRest/checkApply</value>
</list>
</property>
... ...
... ... @@ -16,6 +16,8 @@ public interface UnionShareUserApplyMapper {
int insertSelective(UnionShareUserApply record);
UnionShareUserApply selectByPrimaryKey(Integer id);
UnionShareUserApply selectOneByUid(UnionShareUserApply record);
int selectCountByUid(UnionShareUserApply record);
List<UnionShareUserApply> selectByIds(@Param("ids")Set<Integer> ids);
int updateByPrimaryKeySelective(UnionShareUserApply record);
... ...
... ... @@ -9,7 +9,7 @@ public class UnionShareUser {
private Integer updateTime;
private Integer createTime;
private Integer contractStatus;
private Integer applyId;
private Integer status;
private String imageUrl;
... ... @@ -72,12 +72,12 @@ public class UnionShareUser {
this.createTime = createTime;
}
public Integer getContractStatus() {
return contractStatus;
public Integer getApplyId() {
return applyId;
}
public void setContractStatus(Integer contractStatus) {
this.contractStatus = contractStatus;
public void setApplyId(Integer applyId) {
this.applyId = applyId;
}
public Integer getStatus() {
... ... @@ -97,7 +97,7 @@ public class UnionShareUser {
", createTime=" + createTime +
", updateTime=" + updateTime +
", status=" + status +
", contractStatus=" + contractStatus +
", applyId=" + applyId +
", imageUrl='" + imageUrl + '\'' +
", shareId='" + shareId + '\'' +
'}';
... ...
... ... @@ -8,11 +8,7 @@ public class UnionShareUserApply {
private String name;
private String mobile;
private Byte socialMediaType;
private String socialMediaAccount;
private Integer socialMediaFans;
private String socialMedia;
private Byte status;
... ... @@ -54,28 +50,12 @@ public class UnionShareUserApply {
this.mobile = mobile;
}
public Byte getSocialMediaType() {
return socialMediaType;
}
public void setSocialMediaType(Byte socialMediaType) {
this.socialMediaType = socialMediaType;
}
public String getSocialMediaAccount() {
return socialMediaAccount;
}
public void setSocialMediaAccount(String socialMediaAccount) {
this.socialMediaAccount = socialMediaAccount == null ? null : socialMediaAccount.trim();
}
public Integer getSocialMediaFans() {
return socialMediaFans;
public String getSocialMedia() {
return socialMedia;
}
public void setSocialMediaFans(Integer socialMediaFans) {
this.socialMediaFans = socialMediaFans;
public void setSocialMedia(String socialMedia) {
this.socialMedia = socialMedia;
}
public Byte getStatus() {
... ...
... ... @@ -6,16 +6,14 @@
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="mobile" property="mobile" jdbcType="VARCHAR" />
<result column="social_media_type" property="socialMediaType" jdbcType="TINYINT" />
<result column="social_media_account" property="socialMediaAccount" jdbcType="VARCHAR" />
<result column="social_media_fans" property="socialMediaFans" jdbcType="INTEGER" />
<result column="social_media" property="socialMedia" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="del_flag" property="delFlag" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="check_time" property="checkTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, uid, name, mobile, social_media_type, social_media_account, social_media_fans, status,
id, uid, name, mobile, social_media, status,
del_flag, create_time, check_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
... ... @@ -24,6 +22,23 @@
from union_share_user_apply
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectCountByUid" resultType="java.lang.Integer" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" >
select count(1) from union_share_user_apply
where uid = #{uid,jdbcType=INTEGER}
<if test="status != null">
and status = #{status,jdbcType=TINYINT}
</if>
</select>
<select id="selectOneByUid" resultMap="BaseResultMap" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" >
select
<include refid="Base_Column_List" />
from union_share_user_apply
where uid = #{uid,jdbcType=INTEGER}
<if test="status != null">
and status = #{status,jdbcType=TINYINT}
</if>
limit 1
</select>
<select id="selectByIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
... ... @@ -36,7 +51,7 @@
<select id="selectByCondition"
resultType="com.yoho.service.model.union.response.UnionShareUserApplyListBo"
parameterType="com.yoho.service.model.union.request.UnionShareUserApplyListReqBo">
select id, uid, name,mobile, social_media_type socialMediaType, social_media_account socialMediaAccount, social_media_fans socialMediaFans, status,
select id, uid, name,mobile, social_media socialMedia, status,
del_flag delFlag, create_time createTime, check_time checkTime
from union_share_user_apply
where del_flag=1
... ... @@ -49,15 +64,6 @@
<if test="mobile != null">
and mobile = #{mobile}
</if>
<if test="socialMediaType != null">
and social_media_type = #{socialMediaType}
</if>
<if test="socialMediaAccount != null">
and social_media_account = #{socialMediaAccount}
</if>
<if test="socialMediaFans != null">
and social_media_fans = #{socialMediaFans}
</if>
<if test="status != null">
and status = #{status}
</if>
... ... @@ -86,15 +92,6 @@
<if test="mobile != null">
and mobile = #{mobile}
</if>
<if test="socialMediaType != null">
and social_media_type = #{socialMediaType}
</if>
<if test="socialMediaAccount != null">
and social_media_account = #{socialMediaAccount}
</if>
<if test="socialMediaFans != null">
and social_media_fans = #{socialMediaFans}
</if>
<if test="status != null">
and status = #{status}
</if>
... ... @@ -111,11 +108,11 @@
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" >
insert into union_share_user_apply (id, uid, name, mobile,
social_media_type, social_media_account, social_media_fans,
social_media,
status, del_flag, create_time,
check_time)
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR},
#{socialMediaType,jdbcType=TINYINT}, #{socialMediaAccount,jdbcType=VARCHAR}, #{socialMediaFans,jdbcType=INTEGER},
#{socialMedia,jdbcType=VARCHAR},
#{status,jdbcType=TINYINT}, #{delFlag,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER},
#{checkTime,jdbcType=INTEGER})
</insert>
... ... @@ -134,14 +131,8 @@
<if test="mobile != null" >
mobile,
</if>
<if test="socialMediaType != null" >
social_media_type,
</if>
<if test="socialMediaAccount != null" >
social_media_account,
</if>
<if test="socialMediaFans != null" >
social_media_fans,
<if test="socialMedia != null" >
social_media,
</if>
<if test="status != null" >
status,
... ... @@ -169,14 +160,8 @@
<if test="mobile != null" >
#{mobile,jdbcType=VARCHAR},
</if>
<if test="socialMediaType != null" >
#{socialMediaType,jdbcType=TINYINT},
</if>
<if test="socialMediaAccount != null" >
#{socialMediaAccount,jdbcType=VARCHAR},
</if>
<if test="socialMediaFans != null" >
#{socialMediaFans,jdbcType=INTEGER},
<if test="socialMedia != null" >
#{socialMedia,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
... ... @@ -204,14 +189,8 @@
<if test="mobile != null" >
mobile = #{mobile,jdbcType=VARCHAR},
</if>
<if test="socialMediaType != null" >
social_media_type = #{socialMediaType,jdbcType=TINYINT},
</if>
<if test="socialMediaAccount != null" >
social_media_account = #{socialMediaAccount,jdbcType=VARCHAR},
</if>
<if test="socialMediaFans != null" >
social_media_fans = #{socialMediaFans,jdbcType=INTEGER},
<if test="socialMedia != null" >
social_media = #{socialMedia,jdbcType=VARCHAR},
</if>
<if test="status != null" >
status = #{status,jdbcType=TINYINT},
... ... @@ -245,9 +224,7 @@
set uid = #{uid,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
mobile = #{mobile,jdbcType=VARCHAR},
social_media_type = #{socialMediaType,jdbcType=TINYINT},
social_media_account = #{socialMediaAccount,jdbcType=VARCHAR},
social_media_fans = #{socialMediaFans,jdbcType=INTEGER},
social_media = #{socialMedia,jdbcType=VARCHAR},
status = #{status,jdbcType=TINYINT},
del_flag = #{delFlag,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=INTEGER},
... ...
... ... @@ -6,12 +6,12 @@
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="union_type" property="unionType" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="contract_status" property="contractStatus" jdbcType="INTEGER" />
<result column="apply_id" property="applyId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, uid, union_type, update_time,create_time,status,contract_status
id, uid, union_type, update_time,create_time,status,apply_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
... ... @@ -35,9 +35,9 @@
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareUser" >
insert into union_share_user (id, uid, union_type,
update_time,create_time,status,contract_status)
update_time,create_time,status,apply_id)
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{unionType,jdbcType=VARCHAR},
#{updateTime,jdbcType=INTEGER}),#{createTime,jdbcType=INTEGER}),#{status,jdbcType=INTEGER}),#{contractStatus,jdbcType=INTEGER})
#{updateTime,jdbcType=INTEGER}),#{createTime,jdbcType=INTEGER}),#{status,jdbcType=INTEGER}),#{applyId,jdbcType=INTEGER})
</insert>
<select id="selectByUids" resultMap="BaseResultMap">
select
... ... @@ -69,8 +69,8 @@
<if test="status != null" >
status,
</if>
<if test="contractStatus != null" >
contract_status,
<if test="applyId != null" >
apply_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
... ... @@ -92,8 +92,8 @@
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="contractStatus != null" >
#{contractStatus,jdbcType=INTEGER},
<if test="applyId != null" >
#{applyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
... ... @@ -115,8 +115,8 @@
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="contractStatus != null" >
contract_status = #{contractStatus,jdbcType=INTEGER},
<if test="applyId != null" >
apply_id = #{applyId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
... ... @@ -136,8 +136,8 @@
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="contractStatus != null" >
contract_status = #{contractStatus,jdbcType=INTEGER},
<if test="applyId != null" >
apply_id = #{applyId,jdbcType=INTEGER},
</if>
</set>
where uid = #{uid,jdbcType=INTEGER}
... ... @@ -152,7 +152,7 @@
update_time = #{updateTime,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
contract_status = #{contractStatus,jdbcType=INTEGER}
apply_id = #{applyId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -3,10 +3,7 @@ package com.yoho.unions.server.restapi;
import com.alibaba.fastjson.JSONArray;
import com.yoho.core.common.utils.JsonUtil;
import com.yoho.service.model.union.bo.*;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.request.UnionShareUserApplyListReqBo;
import com.yoho.service.model.union.request.UnionShareUserBankListReqBo;
import com.yoho.service.model.union.request.*;
import com.yoho.service.model.union.response.*;
import com.yoho.unions.common.ApiResponse;
import com.yoho.unions.dal.model.UnionShareOrders;
... ... @@ -81,16 +78,27 @@ public class UnionShareRest {
return new UnionResponse(200, "queryUnionTypeByUid success",unionShareUser);
}
/**
* 同意协议
* 申请
* @return
*/
@RequestMapping("/userApply")
@ResponseBody
public UnionResponse userApply(@RequestBody UnionShareUserApplyReqBo req){
log.info("UnionShareRest.userApply,req is {}",req);
int result = unionShareService.userApply(req);
return new UnionResponse(200, "userApply success",result);
}
/**
* 是否存在申请中的请求
* @param uid
* @return
*/
@RequestMapping("/agreeContract")
@RequestMapping("/checkApply")
@ResponseBody
public UnionResponse agreeContract(@RequestBody int uid){
log.info("UnionShareRest.agreeContract uid is {}", uid);
int result = unionShareService.agreeContract(uid);
return new UnionResponse(200, "agreeContract success",result>0?"Y":"N");
public UnionResponse checkApply(@RequestBody int uid){
log.info("UnionShareRest.checkApply uid is {}", uid);
boolean result = unionShareService.hasApply(uid);
return new UnionResponse(200, "checkApply success",result);
}
/**
... ...
... ... @@ -2,10 +2,7 @@ package com.yoho.unions.server.service;
import com.alibaba.fastjson.JSONArray;
import com.yoho.service.model.union.bo.*;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.request.UnionShareUserApplyListReqBo;
import com.yoho.service.model.union.request.UnionShareUserBankListReqBo;
import com.yoho.service.model.union.request.*;
import com.yoho.service.model.union.response.PageResponseBO;
import com.yoho.service.model.union.response.PageUnionShareOrderRspBO;
import com.yoho.service.model.union.response.UnionShareUserApplyListBo;
... ... @@ -52,11 +49,18 @@ public interface IUnionShareService {
UnionShareUserBo queryUnionTypeByUid(int uid);
/**
* 同意协议
* 申请
* @param req
* @return
*/
int userApply(UnionShareUserApplyReqBo req);
/**
* 是否存在申请中的请求
* @param uid
* @return
*/
int agreeContract(int uid);
boolean hasApply(int uid);
/**
* 查询绑定银行卡
... ...
package com.yoho.unions.server.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.JsonUtil;
import com.yoho.service.model.union.bo.SocialMediaBo;
import com.yoho.service.model.union.request.UnionShareUserApplyListReqBo;
import com.yoho.service.model.union.response.UnionShareUserApplyListBo;
import com.yoho.unions.common.enums.SocialMediaTypeEnum;
... ... @@ -33,9 +35,24 @@ public class UnionShareApplyExportImpl implements IBusinessExportService {
req.setQueryAll(true);
List<UnionShareUserApplyListBo> applys=this.unionShareUserApplyMapper.selectByCondition(req);
for(UnionShareUserApplyListBo bo:applys){
bo.setSocialMediaType(null==bo.getSocialMediaType()?null: SocialMediaTypeEnum.getNameByType(Integer.parseInt(bo.getSocialMediaType())));
covertSocialMedia(bo);
}
return applys;
}
private void covertSocialMedia(UnionShareUserApplyListBo bo) {
if (null == bo.getSocialMedia()) {
return;
}
List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class);
StringBuilder socialMediaBuilder = new StringBuilder();
socialMediaBos.forEach(s->{
socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getSocialMediaType()));
socialMediaBuilder.append("("+s.getSocialMediaAccount()+"):");
socialMediaBuilder.append(s.getSocialMediaFans());
socialMediaBuilder.append("\n\r");
});
bo.setSocialMedia(socialMediaBuilder.toString());
}
}
... ...
... ... @@ -3,15 +3,13 @@ package com.yoho.unions.server.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.JsonUtil;
import com.yoho.core.config.ConfigReader;
import com.yoho.core.rabbitmq.YhProducer;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.union.bo.*;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.request.UnionShareUserApplyListReqBo;
import com.yoho.service.model.union.request.UnionShareUserBankListReqBo;
import com.yoho.service.model.union.request.*;
import com.yoho.service.model.union.response.*;
import com.yoho.unions.common.enums.*;
import com.yoho.unions.common.redis.RedisHashCache;
... ... @@ -26,7 +24,6 @@ import com.yoho.unions.server.service.IUnionShareService;
import com.yoho.unions.utils.DateUtils;
import com.yoho.unions.utils.ImagesHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -290,7 +287,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
List<UnionShareUserApplyListBo> applys=this.unionShareUserApplyMapper.selectByCondition(parm);
for(UnionShareUserApplyListBo bo:applys){
bo.setSocialMediaType(null==bo.getSocialMediaType()?null:SocialMediaTypeEnum.getNameByType(Integer.parseInt(bo.getSocialMediaType())));
covertSocialMedia(bo);
}
PageResponseBO<UnionShareUserApplyListBo> result=new PageResponseBO<>();
result.setList(applys);
... ... @@ -299,6 +296,21 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
result.setTotal(total);
return result;
}
private void covertSocialMedia(UnionShareUserApplyListBo bo) {
if (null != bo.getSocialMedia()) {
List<SocialMediaBo> socialMediaBos = JsonUtil.jsonToList(bo.getSocialMedia(), SocialMediaBo.class);
StringBuilder socialMediaBuilder = new StringBuilder();
socialMediaBos.forEach(s->{
socialMediaBuilder.append(SocialMediaTypeEnum.getNameByType(s.getSocialMediaType()));
socialMediaBuilder.append("("+s.getSocialMediaAccount()+"):");
socialMediaBuilder.append(s.getSocialMediaFans());
socialMediaBuilder.append("<br>");
});
bo.setSocialMedia(socialMediaBuilder.toString());
}
}
/**
* 拒绝用户申请
* @param req
... ... @@ -306,8 +318,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
*/
@Override
public int refuseApply(IdOrIdsBo req){
logger.info("refuseApply,req is {}", req);
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectByPrimaryKey(req.getId());
if (unionShareUserApply == null || unionShareUserApply.getStatus() > 1) {
logger.info("refuseApply end,selectByPrimaryKey null,req is {}", req);
return 0;
}
UnionShareUserApply updateReq = new UnionShareUserApply();
... ... @@ -326,11 +340,13 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
*/
@Override
public int agreeApply(IdOrIdsBo req){
logger.info("agreeApply,req is {}", req);
if (req.getId() != null) {
logger.info("agreeApply,id opt,req is {}", req);
//单个操作
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectByPrimaryKey(req.getId());
if (unionShareUserApply == null || unionShareUserApply.getStatus() > 1) {
logger.info("agreeApply,selectByPrimaryKey null,req is {}", req);
return 0;
}
UnionShareUserApply updateReq = new UnionShareUserApply();
... ... @@ -340,11 +356,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
int result=unionShareUserApplyMapper.updateByPrimaryKeySelective(updateReq);
if (result > 0) {
// 绑定unionType
relateUnionType(unionShareUserApply.getUid());
relateUnionType(unionShareUserApply.getUid(),updateReq.getId());
}
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),unionShareUserApply.getUid());
return result;
} else {
logger.info("agreeApply,ids opt,req is {}", req);
//批量操作
Set<Integer> idSet = Arrays.stream(req.getIds().split(",")).map(s->{
Integer skn = null;
... ... @@ -358,24 +375,45 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
int currentTimeSecond = DateUtil.getCurrentTimeSecond();
int result=unionShareUserApplyMapper.updateStatus(idSet,1,2, currentTimeSecond);
if (result == 0) {
logger.info("agreeApply,updateStatus null,req is {}", req);
return 0;
}
List<UnionShareUserApply> unionShareUserApplies = unionShareUserApplyMapper.selectByIds(idSet);
if (CollectionUtils.isEmpty(unionShareUserApplies)) {
logger.info("agreeApply,selectByIds null,req is {}", req);
return 0;
}
unionShareUserApplies.forEach(u->{
if (u.getCheckTime() != currentTimeSecond) {
return;
}
relateUnionType(u.getUid());
try {
relateUnionType(u.getUid(),u.getId());
} catch (Exception e) {
logger.error("relateUnionType error ,uid is {}",u.getUid());
}
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),u.getUid());
});
return result;
}
}
public void relateUnionType(int uid) {
public void relateUnionType(int uid,int applyId) {
logger.info("relateUnionType,uid is {}", uid);
UnionShareUser unionShareUser1 = unionShareUserMapper.selectByUid(uid);
if (null != unionShareUser1) {
logger.info("relateUnionType,uid is {},has unionType,record is {}", uid,unionShareUser1);
//用户已绑定生成unionType
//todo 直接返回成功
//是否删除:1-正常,0-删除
if (unionShareUser1.getStatus() == 0) {
//todo 目前没有删除操作,不会存在这个情况
}
if (unionShareUser1.getApplyId() == null || unionShareUser1.getApplyId() == 0) {
}
return;
}
//生成unionType
MktMarketingUrl unionDepartmentUrl = buildMktMarketingUrl(uid);
mktMarketingUrlDAO.insertSelective(unionDepartmentUrl);
... ... @@ -385,10 +423,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
unionShareUser.setUnionType(unionDepartmentUrl.getUnionType().toString());
unionShareUser.setCreateTime(DateUtil.getCurrentTimeSecond());
unionShareUser.setUpdateTime(unionShareUser.getCreateTime());
unionShareUser.setApplyId(applyId);
unionShareUserMapper.insertSelective(unionShareUser);
}
public MktMarketingUrl buildMktMarketingUrl(int uid) {
logger.info("buildMktMarketingUrl,uid is {}", uid);
MktMarketingUrl mktMarketingUrl = new MktMarketingUrl();
mktMarketingUrl.setChannelType(1);//渠道类型:0-机构 1-个人
mktMarketingUrl.setPayChannel(1);
... ... @@ -424,19 +464,22 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
logger.info("UnionShareServiceImpl :: queryUnionTypeByUid get redis cache ,uid is {},cacheResult is {}",uid,cacheResult);
return cacheResult;
}
//获取数据库
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
if (null == unionShareUser){
return null;
}
UnionShareUserBo bo = new UnionShareUserBo();
BeanUtils.copyProperties(unionShareUser,bo);
//是否已同意协议:1-同意,0-未同意
bo.setContractAgree(1==unionShareUser.getContractStatus());
if (uid == 0) {
//获取数据库
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
if (null != unionShareUser && unionShareUser.getStatus() == 1) {
BeanUtils.copyProperties(unionShareUser, bo);
}
//是否存在申请中的请求
bo.setHasApply(hasApply(uid));
}
//设置返回文案
bo.setShareId(configReader.getString(UNION_SHAREID, ""));
bo.setImageUrl(configReader.getString(UNION_CPS_IMAGEURL, ""));
bo.setApplyImageUrl(configReader.getString(UNION_CPS_APPLY_IMAGEURL, ""));
bo.setShareId(configReader.getString(UNION_SHAREID, ""));//列表分享的活动id
bo.setImageUrl(configReader.getString(UNION_CPS_IMAGEURL, ""));//分享banner
bo.setApplyImageUrl(configReader.getString(UNION_CPS_APPLY_IMAGEURL, ""));//申请banner
//设置缓存
addToRedis(ShareOrdersKeyEnum.UNION_TYPE, uid, bo, key);
... ... @@ -444,22 +487,47 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
/**
* 同意协议
* @param uid
* 是否存在申请中的请求
* */
@Override
public boolean hasApply(int uid) {
UnionShareUserApply record = new UnionShareUserApply();
record.setUid(uid);
record.setStatus((byte)1);
int count = unionShareUserApplyMapper.selectCountByUid(record);
if (count > 0) {
return true;
}
return false;
}
/**
* 申请
* @param req
* @return
*/
@Override
public int agreeContract(int uid){
logger.info("agreeContract,uid is {}",uid);
if (uid < 1) {
return 0;
public int userApply(UnionShareUserApplyReqBo req){
if (req.getUid() == null) {
throw new ServiceException(ServiceError.USER_ID_ERROR);
}
UnionShareUser updateReq = new UnionShareUser();
updateReq.setUid(uid);
updateReq.setUpdateTime(DateUtil.getCurrentTimeSecond());
updateReq.setContractStatus(1);//是否已同意协议:1-同意,0-未同意
int result = unionShareUserMapper.updateByUid(updateReq);
redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),uid);
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(req.getUid());
if (unionShareUser != null) {
//已是联盟用户
throw new ServiceException(ServiceError.UNION_HAS_UNIONTYPE_ERROR);
}
if (hasApply(req.getUid())) {
//已有申请中的
throw new ServiceException(ServiceError.UNION_HAS_APPLY_ERROR);
}
//申请
UnionShareUserApply unionShareUserApply = new UnionShareUserApply();
BeanUtils.copyProperties(req,unionShareUserApply);
unionShareUserApply.setStatus((byte) 1);
unionShareUserApply.setCreateTime(DateUtil.getCurrentTimeSecond());
unionShareUserApply.setSocialMedia(JsonUtil.objectToJSON(req.getSocialMediaList()));
int result = unionShareUserApplyMapper.insertSelective(unionShareUserApply);
return result;
}
/**
... ...
... ... @@ -19,12 +19,6 @@
<input class="easyui-textbox" id="name" name="name"/>
<label>手机:</label>
<input class="easyui-textbox" id="mobile" name="mobile"/>
<label>社交媒体:</label>
<input class="easyui-combobox" id="socialMediaType" name="socialMediaType">
</input>
<label>社交媒体账号:</label>
<input class="easyui-textbox" id="socialMediaAccount" name="socialMediaAccount">
</input>
<label>状态:</label>
<input class="easyui-combobox" id="status" name="status"
data-options="valueField: 'value',
... ... @@ -64,7 +58,7 @@
var checkedItems = [];
$(function () {
var _socialMediaTypeSelector = $("#socialMediaType");
/* var _socialMediaTypeSelector = $("#socialMediaType");
$.ajax({
type: 'POST',
url: contextPath + "/UnionShareRest/getSocialMediaBasicParams",
... ... @@ -88,7 +82,7 @@
$.messager.alert("失败", "加载所属业务,请刷新页面重试", "error");
return false;
}
});
});*/
$("#userApplyTable").myDatagrid({
fit: true,
... ... @@ -132,17 +126,7 @@
align: "center"
}, {
title: "社交媒体",
field: "socialMediaType",
width: 200,
align: "center"
}, {
title: "社交媒体账号",
field: "socialMediaAccount",
width: 200,
align: "center"
}, {
title: "社交媒体粉丝数",
field: "socialMediaFans",
field: "socialMedia",
width: 200,
align: "center"
}, {
... ... @@ -307,8 +291,6 @@
var param = {
uid:$("#uid").val(),
name:$("#name").val(),
socialMediaType:$("#socialMediaType").combobox('getValue'),
socialMediaAccount:$("#socialMediaAccount").val(),
status:$("#status").combobox('getValue'),
mobile:$("#mobile").val()
};
... ...