Commit 02cd467c authored by jiaorz's avatar jiaorz

新增押金记录,修改租车核销

parent 0a1cb12d
...@@ -21,4 +21,10 @@ public class IntegralUserStatus { ...@@ -21,4 +21,10 @@ public class IntegralUserStatus {
private Long crtTime; private Long crtTime;
private Long updTime; private Long updTime;
@Transient
private Long startTime;
@Transient
private Long endTime;
} }
\ No newline at end of file
...@@ -8,11 +8,10 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -8,11 +8,10 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.vo.PageDataVO; import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.activity.entity.IntegralRule; import com.xxfc.platform.activity.entity.IntegralRule;
import com.xxfc.platform.activity.entity.IntegralUserRecord; import com.xxfc.platform.activity.entity.IntegralUserStatus;
import com.xxfc.platform.activity.mapper.IntegralRuleMapper; import com.xxfc.platform.activity.mapper.IntegralRuleMapper;
import com.xxfc.platform.activity.user.UserInfoBiz; import com.xxfc.platform.activity.user.UserInfoBiz;
import com.xxfc.platform.activity.vo.IntegralRuleDto; import com.xxfc.platform.activity.vo.IntegralRuleDto;
import com.xxfc.platform.activity.vo.IntegralUserRecordDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -27,7 +26,8 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> { ...@@ -27,7 +26,8 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> {
UserInfoBiz userInfoBiz; UserInfoBiz userInfoBiz;
@Autowired @Autowired
IntegralUserRecordBiz integralUserRecordBiz; IntegralUserRecordBiz integralUserRecordBiz;
@Autowired
IntegralUserStatusBiz integralUserStatusBiz;
/** /**
* 添加、更新积分规则 * 添加、更新积分规则
* @param integralRule * @param integralRule
...@@ -97,22 +97,17 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> { ...@@ -97,22 +97,17 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> {
Query query = new Query(integralRule); Query query = new Query(integralRule);
PageDataVO<IntegralRule> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectAllByParam(integralRule)); PageDataVO<IntegralRule> pageDataVO = PageDataVO.pageInfo(query, () -> mapper.selectAllByParam(integralRule));
//添加个人积分状态 //添加个人积分状态
pageDataVO.getData().forEach((a) -> getIntegralStatus(appUserDTO, a));
return ObjectRestResponse.succ(pageDataVO); return ObjectRestResponse.succ(pageDataVO);
} }
public boolean getIntegralStatus(AppUserDTO appUserDTO, IntegralRule integralRule) { public void getIntegralStatus(AppUserDTO appUserDTO, IntegralRule integralRule) {
IntegralUserRecordDto integralUserRecordDto = new IntegralUserRecordDto(); IntegralUserStatus integralUserStatus1 = integralUserStatusBiz.selectByUserAndCode(integralRule.getCode(), appUserDTO.getUserid());
integralUserRecordDto.setUserId(appUserDTO.getUserid()); if(integralUserStatus1 != null) {
integralUserRecordDto.setIntegralRuleCode(integralRule.getCode()); integralRule.setIntegralStatus(integralUserStatus1.getIntegralStatus());
List<IntegralUserRecord> integralUserRecords = integralUserRecordBiz.getByUserAndTime(integralUserRecordDto).getData();
if(integralUserRecords == null || integralUserRecords.size() <=0 ) {
return false;
} else if(integralUserRecords.size() == integralRule.getNumber()){//记录 == 规则数 代表已经完成
return true;
} else {
return false;
} }
} }
} }
...@@ -10,6 +10,8 @@ import org.apache.commons.lang3.StringUtils; ...@@ -10,6 +10,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.TimeZone;
@Service @Service
@Transactional @Transactional
public class IntegralUserStatusBiz extends BaseBiz<IntegralUserStatusMapper, IntegralUserStatus> { public class IntegralUserStatusBiz extends BaseBiz<IntegralUserStatusMapper, IntegralUserStatus> {
...@@ -28,9 +30,13 @@ public class IntegralUserStatusBiz extends BaseBiz<IntegralUserStatusMapper, Int ...@@ -28,9 +30,13 @@ public class IntegralUserStatusBiz extends BaseBiz<IntegralUserStatusMapper, Int
public IntegralUserStatus selectByUserAndCode(String code, Integer userId) { public IntegralUserStatus selectByUserAndCode(String code, Integer userId) {
if(!StringUtils.isAllBlank(code, userId + "")) { if(!StringUtils.isAllBlank(code, userId + "")) {
long current = System.currentTimeMillis();
long startTime = current / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset();
IntegralUserStatus integralUserStatus = new IntegralUserStatus(); IntegralUserStatus integralUserStatus = new IntegralUserStatus();
integralUserStatus.setIntegralRuleCode(code); integralUserStatus.setIntegralRuleCode(code);
integralUserStatus.setUserId(userId); integralUserStatus.setUserId(userId);
integralUserStatus.setStartTime(startTime);
integralUserStatus.setEndTime(startTime + 24 * 60 * 60 * 1000 - 1);
return mapper.selectByUserAndCode(integralUserStatus); return mapper.selectByUserAndCode(integralUserStatus);
} }
return null; return null;
......
...@@ -31,15 +31,11 @@ ...@@ -31,15 +31,11 @@
<select id="selectAllByParam" resultType="com.xxfc.platform.activity.entity.IntegralRule" parameterType="com.xxfc.platform.activity.vo.IntegralRuleDto"> <select id="selectAllByParam" resultType="com.xxfc.platform.activity.entity.IntegralRule" parameterType="com.xxfc.platform.activity.vo.IntegralRuleDto">
select i1.*, i2.integral_status from integral_rule i1 select i1.* from integral_rule i1
left join integral_user_status i2 on i1.code = i2.integral_rule_code
<where> <where>
<if test="id != null"> <if test="id != null">
and i1.id = #{id} and i1.id = #{id}
</if> </if>
<if test="userId != null">
and i2.user_id = #{userId}
</if>
<if test="code != null"> <if test="code != null">
and i1.code = #{code} and i1.code = #{code}
</if> </if>
......
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
<select id="selectByUserAndCode" resultType="com.xxfc.platform.activity.entity.IntegralUserStatus" parameterType="com.xxfc.platform.activity.entity.IntegralUserStatus"> <select id="selectByUserAndCode" resultType="com.xxfc.platform.activity.entity.IntegralUserStatus" parameterType="com.xxfc.platform.activity.entity.IntegralUserStatus">
select * from integral_user_status select * from integral_user_status
where integral_rule_code = #{integralRuleCode} and user_id = #{userId} where integral_rule_code = #{integralRuleCode} and user_id = #{userId}
and crt_time between #{startTime} and #{endTime} and integral_status =1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
parameterType="java.lang.Integer"> parameterType="java.lang.Integer">
select * from deposit_refund_record select * from deposit_refund_record
where crosstown_id = #{crossId} and isshow = 1 where crosstown_id = #{crossId} and isshow = 1
order by status
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment