修改样式,修改逻辑
This commit is contained in:
@ -29,7 +29,11 @@ public class SysRecipesPlan extends BaseEntity
|
||||
private Long cusId;
|
||||
|
||||
//客户ID
|
||||
private Long customerId;
|
||||
// private Long customerId;
|
||||
|
||||
private Integer startNumDay;
|
||||
|
||||
private Integer endNumDay;
|
||||
|
||||
//非持久化字段,客户姓名
|
||||
@Excel(name = "客户姓名")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.SecurityUtils;
|
||||
import com.stdiet.custom.domain.SysOrder;
|
||||
import com.stdiet.custom.mapper.SysOrderMapper;
|
||||
import com.stdiet.custom.service.ISysCommissionDayService;
|
||||
@ -70,6 +71,7 @@ public class SysOrderServiceImpl implements ISysOrderService {
|
||||
public int insertSysOrder(SysOrder sysOrder) {
|
||||
Date orderTime = DateUtils.getNowDate();
|
||||
sysOrder.setCreateTime(orderTime);
|
||||
sysOrder.setCreateBy(SecurityUtils.getUsername());
|
||||
//sysOrder.setOrderTime(orderTime);
|
||||
//计算服务到期时间
|
||||
setOrderServerEndDate(sysOrder);
|
||||
@ -94,6 +96,7 @@ public class SysOrderServiceImpl implements ISysOrderService {
|
||||
SysOrder oldSysOrder = sysOrderMapper.selectSysOrderById(sysOrder.getOrderId());
|
||||
//计算服务到期时间
|
||||
setOrderServerEndDate(sysOrder);
|
||||
sysOrder.setUpdateBy(SecurityUtils.getUsername());
|
||||
sysOrder.setUpdateTime(DateUtils.getNowDate());
|
||||
//更新订单
|
||||
int row = sysOrderMapper.updateSysOrder(sysOrder);
|
||||
|
@ -30,7 +30,6 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
|
||||
public int addRecipes(SysRecipes sysRecipes) {
|
||||
int rows = sysRecipesMapper.addRecipes(sysRecipes);
|
||||
if (rows > 0) {
|
||||
int count = sysRecipesMapper.getNumDayByCusId(sysRecipes.getCusId());
|
||||
List<SysRecipesDaily> menus = sysRecipes.getMenus();
|
||||
List<SysRecipesDailyDishes> dishes = new ArrayList<>();
|
||||
int size = menus.size();
|
||||
@ -41,8 +40,6 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
|
||||
tarMenu.setId(dailyId);
|
||||
// 插入recipiesId
|
||||
tarMenu.setRecipesId(sysRecipes.getId());
|
||||
// 插入numDay
|
||||
tarMenu.setNumDay(count + i + 1);
|
||||
for (SysRecipesDailyDishes tmpDishes : tarMenu.getDishes()) {
|
||||
// 让菜品插入menuId
|
||||
tmpDishes.setMenuId(dailyId);
|
||||
|
@ -47,10 +47,12 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysOrderVo">
|
||||
select o.order_id, o.review_status, o.cus_id, o.customer, o.phone, o.amount, o.start_time, o.pause_time, o.status, o.weight, ser.dict_label as serve_time,
|
||||
select o.order_id, o.review_status, o.cus_id, sc.name as customer, sc.phone, o.amount, o.start_time, o.pause_time, o.status, o.weight, ser.dict_label as serve_time,
|
||||
o.serve_time_id, o.pay_type_id, pay.dict_label as pay_type, o.pre_sale_id, o.create_by, o.create_time, o.after_sale_id, o.update_by, o.update_time,
|
||||
o.nutritionist_id, o.remark, o.nutri_assis_id, o.account_id, acc.dict_label as account, o.planner_id, o.planner_assis_id, o.operator_id, o.operator_assis_id,
|
||||
o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time,o.become_fan_time from sys_order o
|
||||
o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time,o.become_fan_time
|
||||
from sys_order o
|
||||
LEFT JOIN sys_customer sc ON sc.id = o.cus_id
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_pay_type') AS pay ON pay.dict_value = o.pay_type_id
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS acc ON acc.dict_value = o.account_id
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_serve_time') AS ser ON ser.dict_value = o.serve_time_id
|
||||
@ -99,7 +101,7 @@
|
||||
<where>
|
||||
<if test="orderId != null and orderId != ''">and order_id = #{orderId}</if>
|
||||
<if test="customer != null and customer != ''">
|
||||
and (customer like concat('%',#{customer},'%') or phone like concat('%',#{customer},'%'))
|
||||
and (sc.name like concat('%',#{customer},'%') or sc.phone like concat('%',#{customer},'%'))
|
||||
</if>
|
||||
<if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if>
|
||||
<!--<if test="phone != null and phone != ''">and phone = #{phone}</if>-->
|
||||
@ -127,7 +129,7 @@
|
||||
and 0 > amount
|
||||
</if>
|
||||
</if>
|
||||
<if test="true">and del_flag = 0</if>
|
||||
<if test="true">and o.del_flag = 0</if>
|
||||
</where>
|
||||
order by order_time desc
|
||||
</select>
|
||||
@ -325,7 +327,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>
|
||||
|
@ -127,9 +127,9 @@
|
||||
|
||||
<!-- 新增每菜单 -->
|
||||
<insert id="bashAddMenus">
|
||||
insert into sys_customer_daily_menu (id, num_day, date, recipes_id, cus_id) values
|
||||
insert into sys_customer_daily_menu (id, num_day, recipes_id, cus_id) values
|
||||
<foreach collection="list" separator="," item="item" index="index">
|
||||
(#{item.id}, #{item.numDay}, #{item.date}, #{item.recipesId}, #{item.cusId})
|
||||
(#{item.id}, #{item.numDay}, #{item.recipesId}, #{item.cusId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="startDate" column="start_date" />
|
||||
<result property="endDate" column="end_date" />
|
||||
<result property="startNumDay" column="start_num_day" />
|
||||
<result property="endNumDay" column="end_num_day" />
|
||||
<result property="recipesId" column="recipes_id" />
|
||||
<result property="sendFlag" column="send_flag" />
|
||||
<result property="sendTime" column="send_time" />
|
||||
@ -19,7 +21,7 @@
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="cusId" column="cus_id" />
|
||||
<!-- 非持久化字段 -->
|
||||
<result property="customerId" column="cus_id"></result><!-- 客户ID -->
|
||||
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
||||
<result property="customer" column="customer" /><!-- 客户姓名 -->
|
||||
<result property="phone" column="phone" />
|
||||
<result property="orderStartDate" column="order_start_date" />
|
||||
@ -31,7 +33,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysRecipesPlanVo">
|
||||
select id, order_id, cus_id, start_date, end_date, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag from sys_recipes_plan
|
||||
select id, order_id, cus_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag from sys_recipes_plan
|
||||
</sql>
|
||||
|
||||
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
@ -40,6 +42,8 @@
|
||||
<if test="cusId != null "> and cus_id = #{cusId}</if>
|
||||
<if test="startDate != null "> and start_date = #{startDate}</if>
|
||||
<if test="endDate != null "> and end_date = #{endDate}</if>
|
||||
<if test="startNumDay != null "> and start_num_day = #{startNumDay}</if>
|
||||
<if test="endNumDay != null "> and end_num_day = #{endNumDay}</if>
|
||||
<if test="recipesId != null "> and recipes_id = #{recipesId}</if>
|
||||
<if test="sendFlag != null "> and send_flag = #{sendFlag}</if>
|
||||
<if test="sendTime != null "> and send_time = #{sendTime}</if>
|
||||
@ -57,6 +61,8 @@
|
||||
<if test="cusId != null">cus_id,</if>
|
||||
<if test="startDate != null">start_date,</if>
|
||||
<if test="endDate != null">end_date,</if>
|
||||
<if test="startNumDay != null">start_num_day,</if>
|
||||
<if test="endNumDay != null">end_num_day,</if>
|
||||
<if test="recipesId != null">recipes_id,</if>
|
||||
<if test="sendFlag != null">send_flag,</if>
|
||||
<if test="sendTime != null">send_time,</if>
|
||||
@ -71,6 +77,8 @@
|
||||
<if test="cusId != null">#{cusId},</if>
|
||||
<if test="startDate != null">#{startDate},</if>
|
||||
<if test="endDate != null">#{endDate},</if>
|
||||
<if test="startNumDay != null">#{startNumDay},</if>
|
||||
<if test="endNumDay != null">#{endNumDay},</if>
|
||||
<if test="recipesId != null">#{recipesId},</if>
|
||||
<if test="sendFlag != null">#{sendFlag},</if>
|
||||
<if test="sendTime != null">#{sendTime},</if>
|
||||
@ -89,6 +97,8 @@
|
||||
<if test="cusId != null">cus_id = #{cusId},</if>
|
||||
<if test="startDate != null">start_date = #{startDate},</if>
|
||||
<if test="endDate != null">end_date = #{endDate},</if>
|
||||
<if test="startNumDay != null">start_num_day = #{startNumDay},</if>
|
||||
<if test="endNumDay != null">end_num_day = #{endNumDay},</if>
|
||||
<if test="recipesId != null">recipes_id = #{recipesId},</if>
|
||||
<if test="sendFlag != null">send_flag = #{sendFlag},</if>
|
||||
<if test="sendTime != null">send_time = #{sendTime},</if>
|
||||
@ -115,10 +125,10 @@
|
||||
<!-- 批量插入食谱计划 -->
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO sys_recipes_plan
|
||||
(order_id, cus_id, start_date, end_date, send_flag, send_time, recipes_id)
|
||||
(order_id, cus_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, recipes_id)
|
||||
VALUES
|
||||
<foreach collection ="list" item="plan" separator =",">
|
||||
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
|
||||
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay}, #{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
@ -132,15 +142,18 @@
|
||||
|
||||
<!-- 食谱计划、订单表联查 -->
|
||||
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
SELECT srp.id,srp.order_id,srp.recipes_id,sr.customer,sr.cus_id,sr.phone,su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,sr.start_time,sr.server_end_time, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
|
||||
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
||||
su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,
|
||||
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
LEFT JOIN sys_customer sc ON sc.id = srp.cus_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
|
||||
<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>
|
||||
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like concat('%',#{customer},'%'))</if>
|
||||
<if test="nutritionistId != null">AND su_nutritionist.user_id = #{nutritionistId}</if>
|
||||
<if test="nutritionistAssisId != null">AND su_nutritionist_assis.user_id = #{nutritionistAssisId}</if>
|
||||
<if test="startDate != null and endDate != null ">AND srp.start_date BETWEEN date_format(#{startDate},'%y%m%d') AND date_format(#{endDate},'%y%m%d') </if>
|
||||
|
Reference in New Issue
Block a user