Authored by mingdan.ge

cps3期拒绝申请重置

@@ -23,6 +23,7 @@ public interface UnionShareUserApplyMapper { @@ -23,6 +23,7 @@ public interface UnionShareUserApplyMapper {
23 int updateByPrimaryKeySelective(UnionShareUserApply record); 23 int updateByPrimaryKeySelective(UnionShareUserApply record);
24 24
25 int updateStatus(@Param("ids")Set<Integer> ids,@Param("oldState")Integer oldState,@Param("newState")Integer newState,@Param("time")Integer time); 25 int updateStatus(@Param("ids")Set<Integer> ids,@Param("oldState")Integer oldState,@Param("newState")Integer newState,@Param("time")Integer time);
  26 + int updateStatusByUid(@Param("id")Integer id,@Param("oldState")Integer oldState,@Param("newState")Integer newState,@Param("time")Integer time);
26 27
27 int updateByPrimaryKey(UnionShareUserApply record); 28 int updateByPrimaryKey(UnionShareUserApply record);
28 29
@@ -37,6 +37,7 @@ @@ -37,6 +37,7 @@
37 <if test="status != null"> 37 <if test="status != null">
38 and status = #{status,jdbcType=TINYINT} 38 and status = #{status,jdbcType=TINYINT}
39 </if> 39 </if>
  40 + order by create_time desc
40 limit 1 41 limit 1
41 </select> 42 </select>
42 <select id="selectByIds" resultMap="BaseResultMap" > 43 <select id="selectByIds" resultMap="BaseResultMap" >
@@ -219,6 +220,15 @@ @@ -219,6 +220,15 @@
219 </foreach> 220 </foreach>
220 and status = #{oldState,jdbcType=TINYINT} 221 and status = #{oldState,jdbcType=TINYINT}
221 </update> 222 </update>
  223 + <update id="updateStatusByUid" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" >
  224 + update union_share_user_apply
  225 + <set >
  226 + status = #{newState,jdbcType=TINYINT},
  227 + check_time = #{time,jdbcType=INTEGER},
  228 + </set>
  229 + where uid =#{uid,jdbcType=INTEGER}
  230 + and status = #{oldState,jdbcType=TINYINT}
  231 + </update>
222 <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" > 232 <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareUserApply" >
223 update union_share_user_apply 233 update union_share_user_apply
224 set uid = #{uid,jdbcType=INTEGER}, 234 set uid = #{uid,jdbcType=INTEGER},
@@ -103,6 +103,18 @@ public class UnionShareRest { @@ -103,6 +103,18 @@ public class UnionShareRest {
103 JSONObject result = unionShareService.checkApply(uid); 103 JSONObject result = unionShareService.checkApply(uid);
104 return new UnionResponse(200, "checkApply success",result); 104 return new UnionResponse(200, "checkApply success",result);
105 } 105 }
  106 + /**
  107 + * 重置拒绝申请状态
  108 + * @param uid
  109 + * @return
  110 + */
  111 + @RequestMapping("/resetApply")
  112 + @ResponseBody
  113 + public UnionResponse resetApply(@RequestBody int uid){
  114 + log.info("UnionShareRest.resetApply uid is {}", uid);
  115 + String result = unionShareService.resetApply(uid);
  116 + return new UnionResponse(200, "resetApply success",result);
  117 + }
106 118
107 /** 119 /**
108 * 获取银行列表 120 * 获取银行列表
@@ -64,6 +64,13 @@ public interface IUnionShareService { @@ -64,6 +64,13 @@ public interface IUnionShareService {
64 JSONObject checkApply(int uid); 64 JSONObject checkApply(int uid);
65 65
66 /** 66 /**
  67 + * 重置申请状态
  68 + * @param uid
  69 + * @return
  70 + */
  71 + String resetApply(int uid);
  72 +
  73 + /**
67 * 查询绑定银行卡 74 * 查询绑定银行卡
68 * @param uid 75 * @param uid
69 * @return 76 * @return
@@ -475,8 +475,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -475,8 +475,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
475 BeanUtils.copyProperties(unionShareUser, bo); 475 BeanUtils.copyProperties(unionShareUser, bo);
476 } 476 }
477 477
478 - //是否存在申请中的请求  
479 - bo.setHasApply(hasApply(uid)); 478 + //是否存在申请中的请求:0-无申请,1-申请中,2-申请通过,3-拒绝
  479 + bo.setApplyStatus(hasApply(uid));
480 } 480 }
481 481
482 //设置返回文案 482 //设置返回文案
@@ -492,15 +492,16 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -492,15 +492,16 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
492 /** 492 /**
493 * 是否存在申请中的请求 493 * 是否存在申请中的请求
494 * */ 494 * */
495 - public boolean hasApply(int uid) { 495 + public int hasApply(int uid) {
496 UnionShareUserApply record = new UnionShareUserApply(); 496 UnionShareUserApply record = new UnionShareUserApply();
497 record.setUid(uid); 497 record.setUid(uid);
498 record.setStatus((byte)1); 498 record.setStatus((byte)1);
499 - int count = unionShareUserApplyMapper.selectCountByUid(record);  
500 - if (count > 0) {  
501 - return true; 499 + UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectOneByUid(record);
  500 + // 状态:1-申请中,2-通过,3-拒绝,4-拒绝已读
  501 + if (unionShareUserApply == null||unionShareUserApply.getStatus()==2||unionShareUserApply.getStatus()==4) {
  502 + return 0;
502 } 503 }
503 - return false; 504 + return unionShareUserApply.getStatus();
504 } 505 }
505 506
506 /** 507 /**
@@ -509,12 +510,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -509,12 +510,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
509 @Override 510 @Override
510 public JSONObject checkApply(int uid) { 511 public JSONObject checkApply(int uid) {
511 JSONObject result = new JSONObject(); 512 JSONObject result = new JSONObject();
512 - if (hasApply(uid)) {  
513 - result.put("status", 1);//0-无申请,1-申请中,2-申请通过  
514 - return result;  
515 - } else {  
516 - result.put("status", 0);  
517 - } 513 + result.put("status", hasApply(uid));//0-无申请,1-申请中,2-申请通过,3-拒绝
518 UnionShareUser unionShareUser=unionShareUserMapper.selectByUid(uid); 514 UnionShareUser unionShareUser=unionShareUserMapper.selectByUid(uid);
519 if (unionShareUser != null) { 515 if (unionShareUser != null) {
520 result.put("status", 2); 516 result.put("status", 2);
@@ -522,6 +518,23 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -522,6 +518,23 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
522 } 518 }
523 return result; 519 return result;
524 } 520 }
  521 + /**
  522 + * 重置拒绝申请状态
  523 + * */
  524 + @Override
  525 + public String resetApply(int uid) {
  526 + UnionShareUserApply record = new UnionShareUserApply();
  527 + record.setUid(uid);
  528 + record.setStatus((byte)1);
  529 + UnionShareUserApply unionShareUserApply = unionShareUserApplyMapper.selectOneByUid(record);
  530 + if (unionShareUserApply != null&&unionShareUserApply.getStatus()==3) {//状态:1-申请中,2-通过,3-拒绝,4-拒绝已读
  531 + int result=unionShareUserApplyMapper.updateStatusByUid(uid, 3, 4, DateUtil.getCurrentTimeSecond());
  532 + if (result > 0) {
  533 + return "Y";
  534 + }
  535 + }
  536 + return "N";
  537 + }
525 538
526 /** 539 /**
527 * 申请 540 * 申请
@@ -538,7 +551,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -538,7 +551,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
538 //已是联盟用户 551 //已是联盟用户
539 throw new ServiceException(ServiceError.UNION_HAS_UNIONTYPE_ERROR); 552 throw new ServiceException(ServiceError.UNION_HAS_UNIONTYPE_ERROR);
540 } 553 }
541 - if (hasApply(req.getUid())) { 554 + if (hasApply(req.getUid())>0) {//0-无申请,1-申请中,2-申请通过,3-拒绝
542 //已有申请中的 555 //已有申请中的
543 throw new ServiceException(ServiceError.UNION_HAS_APPLY_ERROR); 556 throw new ServiceException(ServiceError.UNION_HAS_APPLY_ERROR);
544 } 557 }