fix: 茅台预约,批量修改预约时间,bug修复。
This commit is contained in:
@@ -87,7 +87,21 @@ public interface IUserMapper
|
|||||||
*/
|
*/
|
||||||
List<IUser> selectReservationUserByMinute(IUserDto iUserDto);
|
List<IUser> selectReservationUserByMinute(IUserDto iUserDto);
|
||||||
|
|
||||||
void updateUserMinuteBatch();
|
/**
|
||||||
|
* 批量修改信息
|
||||||
|
*
|
||||||
|
* @param userVoList 信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int batchUpdateMinute(List<IUserVo> userVoList);
|
||||||
|
|
||||||
void updateUserMinuteEven();
|
|
||||||
|
/**
|
||||||
|
* 查询用户管理列表
|
||||||
|
*
|
||||||
|
* @param iUserDto 用户管理
|
||||||
|
* @return 用户管理集合
|
||||||
|
*/
|
||||||
|
|
||||||
|
public List<IUserVo> selectAllIUserList(IUserDto iUserDto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class IUserServiceImpl implements IUserService {
|
public class IUserServiceImpl implements IUserService {
|
||||||
@@ -167,12 +164,16 @@ public class IUserServiceImpl implements IUserService {
|
|||||||
@Override
|
@Override
|
||||||
@Async
|
@Async
|
||||||
public void updateUserMinuteBatch() {
|
public void updateUserMinuteBatch() {
|
||||||
int userCount = iUserMapper.selectIUserList(new IUserDto()).size();
|
//取出随机分钟数的用户,批量更新数据
|
||||||
if (userCount > 60) {
|
IUserDto userDto = new IUserDto();
|
||||||
iUserMapper.updateUserMinuteEven();
|
userDto.setRandomMinute("0");
|
||||||
}else {
|
List<IUserVo> list=iUserMapper.selectAllIUserList(userDto);
|
||||||
iUserMapper.updateUserMinuteBatch();
|
for (IUserVo user : list) {
|
||||||
|
//随机数1-56
|
||||||
|
Random random = new Random();
|
||||||
|
user.setMinute(random.nextInt(56) + 1);
|
||||||
}
|
}
|
||||||
|
iUserMapper.batchUpdateMinute(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -226,12 +226,16 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="updateUserMinuteBatch">
|
<update id="batchUpdateMinute">
|
||||||
UPDATE i_user SET `minute` = (SELECT FLOOR(random() * 50 + 1))) WHERE random_minute = '0'
|
<foreach collection="list" item="item" separator=";">
|
||||||
</update>
|
update i_user
|
||||||
|
<set >
|
||||||
<update id="updateUserMinuteEven">
|
<if test="item.minute != null">minute = #{item.minute},</if>
|
||||||
UPDATE i_user SET `minute` = (SELECT FLOOR(random() * 50 + 1))) WHERE random_minute = '0'
|
</set>
|
||||||
|
<where>
|
||||||
|
mobile = #{item.mobile}
|
||||||
|
</where>
|
||||||
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="selectReservationUserByMinute" parameterType="IUserDto" resultMap="IUserResult">
|
<select id="selectReservationUserByMinute" parameterType="IUserDto" resultMap="IUserResult">
|
||||||
@@ -257,4 +261,31 @@
|
|||||||
</where>
|
</where>
|
||||||
order by a.create_time desc
|
order by a.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAllIUserList" parameterType="IUserDto" resultMap="IUserResult">
|
||||||
|
<include refid="selectIUserVo"/>
|
||||||
|
<where>
|
||||||
|
a.del_flag='0'
|
||||||
|
<if test="mobile != null and mobile != ''"> and a.mobile like '%'|| #{mobile}||'%'</if>
|
||||||
|
<if test="token != null and token != ''"> and a.token = #{token}</if>
|
||||||
|
<if test="cookie != null and cookie != ''"> and a.cookie = #{cookie}</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''"> and a.device_id = #{deviceId}</if>
|
||||||
|
<if test="itemCode != null and itemCode != ''"> and a.item_code = #{itemCode}</if>
|
||||||
|
<if test="ishopId != null and ishopId != ''"> and a.ishop_id = #{ishopId}</if>
|
||||||
|
<if test="provinceName != null and provinceName != ''"> and a.province_name like '%'|| #{provinceName}||'%'</if>
|
||||||
|
<if test="cityName != null and cityName != ''"> and a.city_name like '%'|| #{cityName}||'%'</if>
|
||||||
|
<if test="address != null and address != ''"> and a.address = #{address}</if>
|
||||||
|
<if test="lat != null and lat != ''"> and a.lat = #{lat}</if>
|
||||||
|
<if test="lng != null and lng != ''"> and a.lng = #{lng}</if>
|
||||||
|
<if test="minute != null "> and a.minute = #{minute}</if>
|
||||||
|
<if test="shopType != null "> and a.shop_type = #{shopType}</if>
|
||||||
|
<if test="randomMinute != null and randomMinute != ''"> and a.random_minute = #{randomMinute}</if>
|
||||||
|
<if test="pushPlusToken != null and pushPlusToken != ''"> and a.push_plus_token = #{pushPlusToken}</if>
|
||||||
|
<if test="jsonResult != null and jsonResult != ''"> and a.json_result = #{jsonResult}</if>
|
||||||
|
<if test="expireTime != null "> and a.expire_time = #{expireTime}</if>
|
||||||
|
<if test="createUser != null and createUser != ''"> and a.create_user = #{createUser}</if>
|
||||||
|
<if test="updateUser != null and updateUser != ''"> and a.update_user = #{updateUser}</if>
|
||||||
|
</where>
|
||||||
|
order by a.create_time desc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user