外食计算优化,异步更新热量加上延迟
This commit is contained in:
parent
13727e8d39
commit
66957edce0
stdiet-custom/src/main
java/com/stdiet/custom/service/impl
resources/mapper/custom
@ -27,6 +27,7 @@ public class AsyncCommonServiceImpl implements AsyncCommonService {
|
||||
@Autowired
|
||||
private SysFoodHeatStatisticsMapper sysFoodHeatStatisticsMapper;
|
||||
|
||||
public static final long sleepTime = 5000; //异步线程睡眠时间,毫秒
|
||||
|
||||
/**
|
||||
* 异步更新每个食材对应的蛋白质、脂肪、碳水的质量
|
||||
@ -34,6 +35,11 @@ public class AsyncCommonServiceImpl implements AsyncCommonService {
|
||||
@Override
|
||||
@Async
|
||||
public void updateFoodNutritionalQualityAndHeat(Long customerHeatId){
|
||||
try {
|
||||
Thread.sleep(sleepTime);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
SysCustomerHeatStatistics sysCustomerHeatStatistics = sysCustomerHeatStatisticsMapper.selectSysCustomerHeatStatisticsById(customerHeatId);
|
||||
if(sysCustomerHeatStatistics != null && sysCustomerHeatStatistics.getFoodHeatStatisticsList() != null
|
||||
&& sysCustomerHeatStatistics.getFoodHeatStatisticsList().size() > 0){
|
||||
|
@ -134,7 +134,7 @@
|
||||
|
||||
<select id="selectSysOrderById" parameterType="Long" resultMap="SysOrderResult">
|
||||
<include refid="selectSysOrderVo"/>
|
||||
where order_id = #{orderId}
|
||||
where order_id = #{orderId} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertSysOrder" parameterType="SysOrder" useGeneratedKeys="true" keyProperty="orderId">
|
||||
@ -325,7 +325,7 @@
|
||||
from sys_order o
|
||||
left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0
|
||||
left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
|
||||
where review_status = 'yes' and o.order_time >= '2021-01-01' and del_flag = 0
|
||||
where review_status = 'yes' and o.order_time >= '2021-01-01' and o.del_flag = 0
|
||||
<if test="userId != null">
|
||||
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
|
||||
</if>
|
||||
|
@ -137,7 +137,7 @@
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
|
||||
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND su_nutritionist_assis.del_flag = 0
|
||||
WHERE srp.del_flag = 0
|
||||
WHERE srp.del_flag = 0 and sr.del_flag = 0
|
||||
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
<if test="customer != null and customer != ''">AND (sr.customer like concat('%',#{customer},'%') OR sr.phone like concat('%',#{customer},'%'))</if>
|
||||
@ -169,7 +169,7 @@
|
||||
SELECT srp.id,srp.order_id,sr.customer,sr.phone, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
WHERE srp.del_flag = 0 AND srp.order_id = #{orderId}
|
||||
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.order_id = #{orderId}
|
||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||
ORDER BY srp.id ASC
|
||||
</select>
|
||||
|
Loading…
x
Reference in New Issue
Block a user