anderx пре 7 година
родитељ
комит
72f9eecdb3

+ 2 - 0
src/main/java/com/goafanti/business/controller/UserJtBusinessController.java

@@ -240,4 +240,6 @@ public class UserJtBusinessController extends CertifyApiController{
 	}
 	
 	
+	
+	
 }

+ 2 - 0
src/main/java/com/goafanti/business/service/impl/JtBusinessServiceImpl.java

@@ -504,6 +504,8 @@ public class JtBusinessServiceImpl  extends BaseMybatisDao<JtBusinessProjectMapp
 	public int updateByPrimaryKeySelective(JtBusinessProject jtBusinessProject) {
 		return jtBusinessProjectMapper.updateByPrimaryKeySelective(jtBusinessProject);
 	}
+
+	
 	
 
 }

+ 16 - 9
src/main/java/com/goafanti/common/mapper/JtVoucherDetailMapper.xml

@@ -301,10 +301,14 @@
     where id = #{id,jdbcType=VARCHAR}
   </update>
   <select id="selectVoucherDetailList" resultType="com.goafanti.voucher.bo.JtVoucherDetailListBo">
-  	select b.id,a.name,a.money,b.receive_time as receiveTime, a.duration_day as durationDay,
-		a.source,b.status,b.use_time as useTime,c.mobile as userMobile
-		from jt_voucher a 
-		left join jt_voucher_detail b on a.id=b.voucher_id
+  	select
+		b.id, a.name, a.money, b.receive_time as receiveTime, a.duration_day as durationDay,
+		IF(date_add(b.receive_time, interval a.duration_day day) &lt; now(),2,b.status) as status,
+		a.source, b.use_time as useTime, c.mobile as userMobile,
+		date_format(b.receive_time,'%Y-%m-%d %H:%I:%S')as starTime,
+		date_format(date_add(b.receive_time, interval a.duration_day day),'%Y-%m-%d %H:%I:%S')as endTime
+		from  jt_voucher_detail b
+		left join jt_voucher a on a.id=b.voucher_id
 		left join user c on b.use_uid=c.id
 		where 1=1
 	<if test="uid != null">
@@ -314,7 +318,7 @@
 		and  a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>  
 	<if test="status != null">
-		and  b.status  = #{status,jdbcType=INTEGER}
+	  and IF(date_add(b.receive_time, interval a.duration_day day) &lt; now(),2,b.status)  = #{status,jdbcType=INTEGER}
 	</if>
 	<if test="userMobile != null">
 		and  c.mobile = #{userMobile,jdbcType=VARCHAR}
@@ -329,6 +333,9 @@
 	<if test="sort == 1">
 		order by b.receive_time
 	</if>
+	<if test="sort == 2">
+		order by endTime
+	</if>
 	<if test="sortType != null">
 	 desc
 	 </if>
@@ -338,9 +345,9 @@
   </select>
   
   <select id="selectVoucherDetailCount" resultType="java.lang.Integer">
-  	 select	count(*) from jt_voucher a 
-	left join jt_voucher_detail b on a.id=b.voucher_id
-	left join user c on b.use_uid=c.id
+  	 select	count(*)  from jt_voucher_detail b
+		left join jt_voucher a on a.id=b.voucher_id
+		left join user c on b.use_uid=c.id
 	where 1=1
 	<if test="uid != null">
 		and  b.use_uid  = #{uid,jdbcType=VARCHAR}
@@ -349,7 +356,7 @@
 		and  a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>  
 	<if test="status != null">
-		and  b.status  = #{status,jdbcType=INTEGER}
+	    and IF(date_add(b.receive_time, interval a.duration_day day) &lt; now(),2,b.status)  = #{status,jdbcType=INTEGER}
 	</if>
 	<if test="userMobile != null">
 		and  c.mobile = #{userMobile,jdbcType=VARCHAR}

+ 1 - 1
src/main/java/com/goafanti/common/mapper/JtVoucherMapper.xml

@@ -399,7 +399,7 @@
   </select>
   
   <select id="getSourceVoucher" resultType="java.lang.String">
-  	select id from jt_voucher where source= #{source,jdbcType=INTEGER}
+  	select id from jt_voucher where active_state=1 and source= #{source,jdbcType=INTEGER}
   </select>
   
 </mapper>

+ 2 - 3
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -1281,15 +1281,14 @@
 	select mobile from `user`
  		where status=0
  		and source=0
- 		and audit_status=2
 	</select>
 	<select id="getInvitationCode" resultType="java.lang.String">
 	select to_invite_code from `user` where id= #{uid,jdbcType=VARCHAR}
 	</select>
-	<select id="getToBackgroundUrl" resultMap="BaseResultMap">
+	<select id="getToInviteCode" resultMap="BaseResultMap">
 	select 
 	<include refid="Base_Column_List" />
-	from `user` from to_invite_code= #{toInviteCode,jdbcType=VARCHAR}
+	from `user` where to_invite_code= #{toInviteCode,jdbcType=VARCHAR}
 	</select>
 
 </mapper>

+ 3 - 2
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -83,6 +83,7 @@ public class UserRegisterController extends BaseController {
 		User u = userService.selectByMobieAndType(user.getMobile().trim(),user.getType());
 		if (null != u) {
 			res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "用户已存在"));
+			return res;
 		}
 		if (TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE_TIME) ==null||!TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE).equals(mobileCode.toLowerCase())) {
 			res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "手机验证码错误"));
@@ -115,7 +116,7 @@ public class UserRegisterController extends BaseController {
 			us.setTransferTime(now.getTime());
 			userService.insertRegister(us,user.getUnitName(),user.getUsername());
 			//获得抵用券
-			userService.getVoucher(us);
+			userService.saveVoucher(us);
 		}
 		return res;
 	}
@@ -179,7 +180,7 @@ public class UserRegisterController extends BaseController {
 			us.setTransferTime(now.getTime());
 			userService.insertRegister(us,user.getUnitName(),user.getUsername());
 			//获得抵用券
-			userService.getVoucher(us);
+			userService.saveVoucher(us);
 		}
 		return res;
 	}

+ 1 - 1
src/main/java/com/goafanti/user/service/UserService.java

@@ -72,6 +72,6 @@ public interface UserService {
 
 	String updateGetInvitationCode(String uid);
 
-	void getVoucher(User us);
+	void saveVoucher(User us);
 	
 }

+ 3 - 3
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -277,9 +277,9 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	}
 
 	@Override
-	public void getVoucher(User us) {
+	public void saveVoucher(User us) {
 		if (StringUtils.isNotBlank(us.getBeInviteCode())) {
-			List<String> ids=voucherService.getSourceVoucher(VoucherSourceType.BYQFWS.getCode());
+			List<String> ids=voucherService.getSourceVoucher(VoucherSourceType.BYQGR.getCode());
 			for (String s : ids) {
 				JtVoucherDetail j=new JtVoucherDetail();
 				j.setId(jDBCIdGenerator.generateId().toString());
@@ -290,7 +290,7 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 				voucherDetailService.saveVoucherDetail(j);
 			}
 			User toUser=userMapper.getToInviteCode(us.getBeInviteCode());
-			List<String> ids2=voucherService.getSourceVoucher(VoucherSourceType.YQFWS.getCode());
+			List<String> ids2=voucherService.getSourceVoucher(VoucherSourceType.YQGR.getCode());
 			for (String string : ids2) {
 				JtVoucherDetail j=new JtVoucherDetail();
 				j.setId(jDBCIdGenerator.generateId().toString());

+ 1 - 8
src/main/java/com/goafanti/voucher/service/impl/VoucherDetailServiceImpl.java

@@ -72,14 +72,7 @@ public class VoucherDetailServiceImpl extends BaseMybatisDao<JtVoucherDetailMapp
 		//params.put("uid", "a8cd3226-2e6e-43c7-b4b0-1b72bd9cfa41");
 		Pagination<JtVoucherDetailListBo> pagination=	(Pagination<JtVoucherDetailListBo>) findPage("selectVoucherDetailList", "selectVoucherDetailCount",params,
 						pageNo, pageSize);
-		List<JtVoucherDetailListBo> list=(List<JtVoucherDetailListBo>) pagination.getList();
-		for (JtVoucherDetailListBo b : list) {
-			if (b!=null&&b.getDurationDay()!=null&&b.getReceiveTime()!=null&&b.getDurationDay()!=null) {
-				b.setStarTime(DateFormatUtils.format(b.getReceiveTime(), AFTConstants.YYYYMMDDHHMMSS));
-				b.setEndTime(DateFormatUtils.format(DateUtils.getDateAdd(b.getReceiveTime(),b.getDurationDay()), AFTConstants.YYYYMMDDHHMMSS));
-			}
-		}
-				return pagination;
+		return pagination;
 	}
 
 	@Override