Authored by mingdan.ge

cps3期拒绝申请重置

... ... @@ -23,6 +23,7 @@ public interface UnionShareUserApplyMapper {
int updateByPrimaryKeySelective(UnionShareUserApply record);
int updateStatus(@Param("ids")Set<Integer> ids,@Param("oldState")Integer oldState,@Param("newState")Integer newState,@Param("time")Integer time);
int updateStatusByUid(@Param("id")Integer id,@Param("oldState")Integer oldState,@Param("newState")Integer newState,@Param("time")Integer time);
int updateByPrimaryKey(UnionShareUserApply record);
... ...
... ... @@ -37,6 +37,7 @@
<if test="status != null">
and status = #{status,jdbcType=TINYINT}
</if>
order by create_time desc
limit 1
</select>
<select id="selectByIds" resultMap="BaseResultMap" >
... ... @@ -219,6 +220,15 @@
</foreach>
and status = #{oldState,jdbcType=TINYINT}
</update>
<update id="updateStatusByUid" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" >
update union_share_user_apply
<set >
status = #{newState,jdbcType=TINYINT},
check_time = #{time,jdbcType=INTEGER},
</set>
where uid =#{uid,jdbcType=INTEGER}
and status = #{oldState,jdbcType=TINYINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" >
update union_share_user_apply
set uid = #{uid,jdbcType=INTEGER},
... ...
... ... @@ -103,6 +103,18 @@ public class UnionShareRest {
JSONObject result = unionShareService.checkApply(uid);
return new UnionResponse(200, "checkApply success",result);
}
/**
* 重置拒绝申请状态
* @param uid
* @return
*/
@RequestMapping("/resetApply")
@ResponseBody
public UnionResponse resetApply(@RequestBody int uid){
log.info("UnionShareRest.resetApply uid is {}", uid);
String result = unionShareService.resetApply(uid);
return new UnionResponse(200, "resetApply success",result);
}
/**
* 获取银行列表
... ...
... ... @@ -64,6 +64,13 @@ public interface IUnionShareService {
JSONObject checkApply(int uid);
/**
* 重置申请状态
* @param uid
* @return
*/
String resetApply(int uid);
/**
* 查询绑定银行卡
* @param uid
* @return
... ...
... ... @@ -475,8 +475,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
BeanUtils.copyProperties(unionShareUser, bo);
}
//是否存在申请中的请求
bo.setHasApply(hasApply(uid));
//是否存在申请中的请求:0-无申请,1-申请中,2-申请通过,3-拒绝
bo.setApplyStatus(hasApply(uid));
}
//设置返回文案
... ... @@ -492,15 +492,16 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
/**
* 是否存在申请中的请求
* */
public boolean hasApply(int uid) {
public int hasApply(int uid) {
UnionShareUserApply record = new UnionShareUserApply();
record.setUid(uid);
record.setStatus((byte)1);
int count = unionShareUserApplyMapper.selectCountByUid(record);
if (count > 0) {
return true;
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectOneByUid(record);
// 状态:1-申请中,2-通过,3-拒绝,4-拒绝已读
if (unionShareUserApply == null||unionShareUserApply.getStatus()==2||unionShareUserApply.getStatus()==4) {
return 0;
}
return false;
return unionShareUserApply.getStatus();
}
/**
... ... @@ -509,12 +510,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
@Override
public JSONObject checkApply(int uid) {
JSONObject result = new JSONObject();
if (hasApply(uid)) {
result.put("status", 1);//0-无申请,1-申请中,2-申请通过
return result;
} else {
result.put("status", 0);
}
result.put("status", hasApply(uid));//0-无申请,1-申请中,2-申请通过,3-拒绝
UnionShareUser unionShareUser=unionShareUserMapper.selectByUid(uid);
if (unionShareUser != null) {
result.put("status", 2);
... ... @@ -522,6 +518,23 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
}
return result;
}
/**
* 重置拒绝申请状态
* */
@Override
public String resetApply(int uid) {
UnionShareUserApply record = new UnionShareUserApply();
record.setUid(uid);
record.setStatus((byte)1);
UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectOneByUid(record);
if (unionShareUserApply != null&&unionShareUserApply.getStatus()==3) {//状态:1-申请中,2-通过,3-拒绝,4-拒绝已读
int result=unionShareUserApplyMapper.updateStatusByUid(uid, 3, 4, DateUtil.getCurrentTimeSecond());
if (result > 0) {
return "Y";
}
}
return "N";
}
/**
* 申请
... ... @@ -538,7 +551,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
//已是联盟用户
throw new ServiceException(ServiceError.UNION_HAS_UNIONTYPE_ERROR);
}
if (hasApply(req.getUid())) {
if (hasApply(req.getUid())>0) {//0-无申请,1-申请中,2-申请通过,3-拒绝
//已有申请中的
throw new ServiceException(ServiceError.UNION_HAS_APPLY_ERROR);
}
... ...