fix: 茅台预约,功能继续优化。
This commit is contained in:
@@ -59,6 +59,17 @@ public class ILog extends BaseEntity
|
||||
@Excel(name = "日志类型")
|
||||
private String type;
|
||||
|
||||
/** 详细记录 */
|
||||
@ApiModelProperty(value="详细记录")
|
||||
@Excel(name = "详细记录")
|
||||
private String logDetail;
|
||||
|
||||
|
||||
/** 预约商品 */
|
||||
@ApiModelProperty(value="预约商品")
|
||||
@Excel(name = "预约商品")
|
||||
private String itemCodeName;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -70,6 +81,8 @@ public class ILog extends BaseEntity
|
||||
.append("createUser", getCreateUser())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("type", getType())
|
||||
.append("logDetail", getLogDetail())
|
||||
.append("itemCodeName", getItemCodeName())
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.TimerTask;
|
||||
public class IMTLogFactory {
|
||||
|
||||
|
||||
public static void reservation(IUser iUser, String logContent,String type) {
|
||||
public static void reservation(IUser iUser, String logContent,String type,String itemCodeName,String logDetail) {
|
||||
//{"code":2000,"data":{"successDesc":"申购完成,请于7月6日18:00查看预约申购结果","reservationList":[{"reservationId":17053404357,"sessionId":678,"shopId":"233331084001","reservationTime":1688608601720,"itemId":"10214","count":1}],"reservationDetail":{"desc":"申购成功后将以短信形式通知您,请您在申购成功次日18:00前确认支付方式,并在7天内完成提货。","lotteryTime":1688637600000,"cacheValidTime":1688637600000}}}
|
||||
ILog operLog = new ILog();
|
||||
|
||||
@@ -32,7 +32,8 @@ public class IMTLogFactory {
|
||||
operLog.setCreateUser(iUser.getUserId());
|
||||
operLog.setCreateBy(iUser.getCreateBy());
|
||||
operLog.setLogContent(logContent);
|
||||
operLog.setCreateTime(new Date());
|
||||
operLog.setItemCodeName(itemCodeName);
|
||||
operLog.setLogDetail(logDetail);
|
||||
operLog.setType(type);
|
||||
|
||||
AsyncManager.me().execute(recordOper(operLog));
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.ruoyi.invest.service.impl;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.utils.IdWorker;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.invest.domain.ILog;
|
||||
import com.ruoyi.invest.domain.dto.ILogDto;
|
||||
import com.ruoyi.invest.domain.vo.ILogVo;
|
||||
@@ -55,7 +54,6 @@ public class IMTLogServiceImpl implements IMTLogService {
|
||||
@Override
|
||||
public int insertILog(ILog iLog)
|
||||
{
|
||||
iLog.setCreateBy(SecurityUtils.getUsername());
|
||||
iLog.setCreateTime(new Date());
|
||||
iLog.setLogId(IdWorker.getId());
|
||||
return iLogMapper.insertILog(iLog);
|
||||
|
||||
@@ -195,6 +195,8 @@ public class IMTServiceImpl implements IMTService {
|
||||
for (String itemId : items) {
|
||||
IItemVo item=iItemMapper.selectIItemByItemCode(itemId);
|
||||
String logContent = "";
|
||||
String logDetail = "";
|
||||
String itemCodeName = item.getTitle()+"("+itemId+")";
|
||||
try {
|
||||
String shopId = iShopService.getShopId(iUser.getShopType(), itemId,
|
||||
iUser.getProvinceName(), iUser.getCityName(), iUser.getLat(), iUser.getLng());
|
||||
@@ -202,17 +204,18 @@ public class IMTServiceImpl implements IMTService {
|
||||
JSONObject json = reservation(iUser, itemId, shopId);
|
||||
IShopVo shop=ishopMapper.selectIShopByIShopId(shopId);
|
||||
|
||||
logContent = String.format("[预约项目]:%s,[预约门店]:%s,预约成功!", item.getTitle()+"("+itemId+")", shop.getName()+",地址:"+shop.getAddress(), json.toString());
|
||||
|
||||
logContent = String.format("[预约项目]:%s,[预约门店]:%s,预约成功!", item.getTitle()+"("+itemId+")", shop.getName()+",地址:"+shop.getAddress());
|
||||
logDetail=json.toString();
|
||||
//随机延迟3~5秒
|
||||
Random random = new Random();
|
||||
int sleepTime = random.nextInt(3) + 3;
|
||||
Thread.sleep(sleepTime * 1000);
|
||||
} catch (Exception e) {
|
||||
logContent = String.format("执行报错--[预约项目]:%s,错误原因:%s", item.getTitle()+"("+itemId+")", e.getMessage());
|
||||
logDetail=e.getMessage();
|
||||
}
|
||||
//日志记录
|
||||
IMTLogFactory.reservation(iUser, logContent,"1");
|
||||
IMTLogFactory.reservation(iUser, logContent,"1",itemCodeName,logDetail);
|
||||
}
|
||||
//预约后延迟领取耐力值
|
||||
getEnergyAwardDelay(iUser);
|
||||
@@ -224,22 +227,20 @@ public class IMTServiceImpl implements IMTService {
|
||||
* @param iUser
|
||||
*/
|
||||
public void getEnergyAwardDelay(IUser iUser) {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String logContent = "";
|
||||
//sleep 10秒
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
//预约后领取耐力值
|
||||
String energyAward = getEnergyAward(iUser);
|
||||
logContent += "[申购耐力值]:" + energyAward;
|
||||
} catch (Exception e) {
|
||||
logContent += "执行报错--[申购耐力值],错误原因:" + e.getMessage();
|
||||
}
|
||||
//日志记录
|
||||
IMTLogFactory.reservation(iUser, logContent,"2");
|
||||
Runnable runnable = () -> {
|
||||
String logContent = "";
|
||||
String logDetail= "";
|
||||
//sleep 10秒
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
//预约后领取耐力值
|
||||
logDetail = getEnergyAward(iUser);
|
||||
logContent += "[申购耐力值]:成功!" ;
|
||||
} catch (Exception e) {
|
||||
logContent += "执行报错--[申购耐力值],错误原因:" + e.getMessage();
|
||||
}
|
||||
//日志记录
|
||||
IMTLogFactory.reservation(iUser, logContent,"2","",logDetail);
|
||||
};
|
||||
new Thread(runnable).start();
|
||||
|
||||
@@ -314,15 +315,16 @@ public class IMTServiceImpl implements IMTService {
|
||||
@Override
|
||||
public void getTravelReward(IUser iUser) {
|
||||
String logContent = "";
|
||||
String logDetail = "";
|
||||
try {
|
||||
String s = travelReward(iUser);
|
||||
logDetail = travelReward(iUser);
|
||||
logContent += "[获得旅行奖励]:成功!";
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
logContent += "执行报错--[获得旅行奖励],错误原因:" + e.getMessage();
|
||||
}
|
||||
//日志记录
|
||||
IMTLogFactory.reservation(iUser, logContent,"3");
|
||||
IMTLogFactory.reservation(iUser, logContent,"3","",logDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -574,7 +576,7 @@ public class IMTServiceImpl implements IMTService {
|
||||
// 预约时间在24小时内的
|
||||
if (item.getInteger("status") == 2 && DateUtil.between(item.getDate("reservationTime"), new Date(), DateUnit.HOUR) < 24) {
|
||||
String logContent = DateUtil.formatDate(item.getDate("reservationTime")) + " 申购" + item.getString("itemName") + "成功";
|
||||
IMTLogFactory.reservation(iUser, logContent,"4");
|
||||
IMTLogFactory.reservation(iUser, logContent,"4","",logContent);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -14,10 +14,12 @@
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="type" column="type" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="itemCodeName" column="item_code_name" />
|
||||
<result property="logDetail" column="log_detail" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectILogVo">
|
||||
select a.log_id, a.mobile, a.log_content, a.status, a.oper_time, a.create_user, a.create_by, a.type, a.create_time from i_log a
|
||||
select a.log_id, a.mobile,a.item_code_name,a.log_detail, a.log_content, a.status, a.oper_time, a.create_user, a.create_by, a.type, a.create_time from i_log a
|
||||
</sql>
|
||||
|
||||
<select id="selectILogList" parameterType="ILogDto" resultMap="ILogResult">
|
||||
@@ -52,6 +54,8 @@
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="logDetail != null">log_detail,</if>
|
||||
<if test="itemCodeName != null">item_code_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="logId != null">#{logId},</if>
|
||||
@@ -63,6 +67,8 @@
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="logDetail != null">#{logDetail},</if>
|
||||
<if test="itemCodeName != null">#{itemCodeName},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -77,6 +83,8 @@
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="logDetail != null">log_detail = #{logDetail},</if>
|
||||
<if test="itemCodeName != null">item_code_name = #{itemCodeName},</if>
|
||||
</trim>
|
||||
where log_id = #{logId}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user