This commit is contained in:
xiezhijun
2021-02-27 16:55:46 +08:00
41 changed files with 1583 additions and 407 deletions

View File

@ -0,0 +1,12 @@
package com.stdiet.custom.domain;
import lombok.Data;
import java.util.List;
@Data
public class SysRecipesDetail {
private List<SysRecipesPlan> plans;
}

View File

@ -1,12 +1,10 @@
package com.stdiet.custom.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
/**
* 食谱计划对象 sys_recipes_plan
@ -15,14 +13,16 @@ import com.stdiet.common.core.domain.BaseEntity;
* @date 2021-01-15
*/
@Data
public class SysRecipesPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
public class SysRecipesPlan {
/** $column.columnComment */
/**
* $column.columnComment
*/
private Long id;
/** 订单ID */
/**
* 订单ID
*/
//@Excel(name = "订单ID")
private Long orderId;
@ -46,12 +46,16 @@ public class SysRecipesPlan extends BaseEntity
//处理过的客户手机号
private String hidePhone;
/** 食谱开始日期 */
/**
* 食谱开始日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "食谱开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date startDate;
/** 食谱结束日期 */
/**
* 食谱结束日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "食谱结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date endDate;
@ -78,19 +82,54 @@ public class SysRecipesPlan extends BaseEntity
@Excel(name = "营养师助理")
private String nutritionistAssis;
/** 食谱ID */
/**
* 食谱ID
*/
//@Excel(name = "食谱ID")
private Long recipesId;
/** 食谱是否发送0未发送 1已发送 */
@Excel(name = "食谱是否发送", readConverterExp="0=未发送,1=已发送")
/**
* 食谱是否发送0未发送 1已发送
*/
@Excel(name = "食谱是否发送", readConverterExp = "0=未发送,1=已发送")
private Integer sendFlag;
/** 食谱发送时间 */
/**
* 食谱发送时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "食谱发送时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date sendTime;
/** 删除标识 0未删除 1已删除 默认0 */
/**
* 删除标识 0未删除 1已删除 默认0
*/
private Integer delFlag;
/**
* 审核标识 0未审核 1已审核 默认0
*/
private Integer reviewStatus;
/**
* 创建者
*/
private String createBy;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新者
*/
private String updateBy;
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -0,0 +1,26 @@
package com.stdiet.custom.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class SysRecipesPlanListInfo {
private Long id;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate;
private Integer startNumDay;
private Integer endNumDay;
private List<SysRecipesPlan> menus;
}

View File

@ -25,4 +25,6 @@ public interface SysRecipesMapper {
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
public int deleteDishes(Long id);
public List<SysRecipesDailyDishes> selectDishesByMenuId(Long id);
}

View File

@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysRecipesPlan;
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
/**
* 食谱计划Mapper接口
@ -86,4 +87,10 @@ public interface SysRecipesPlanMapper
* @return
*/
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
List<SysRecipesPlan> selectPlanListByOutId(String outId);
Long getCusIdByOutId(String outId);
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
}

View File

@ -1,6 +1,8 @@
package com.stdiet.custom.service;
import java.util.List;
import java.util.Map;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
@ -74,4 +76,9 @@ public interface ISysCustomerService
* @return
*/
boolean isCustomerExistByPhone(SysCustomer sysCustomer);
Map<String,Object> getPhysicalSignsById(Long id);
Map<String,Object> getPhysicalSignsByOutId(String id);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.domain.SysRecipesPlan;
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
import org.springframework.core.annotation.Order;
/**
@ -90,5 +91,10 @@ public interface ISysRecipesPlanService
*/
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
public void myGenerateRecipesPlan(SysOrder sysOrder);
List<SysRecipesPlan> selectPlanListByOutId(String outId);
Long getCusIdByOutId(String outId);
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
}

View File

@ -12,9 +12,12 @@ public interface ISysRecipesService {
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
public List<SysRecipesDailyDishes> selectDishesByMenuId(Long id);
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily);
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
public int deleteDishes(Long id);
}

View File

@ -0,0 +1,13 @@
package com.stdiet.custom.service;
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
import java.util.List;
import java.util.Map;
public interface ISysWapServices {
List<SysRecipesPlanListInfo> getRecipesPlanListInfo(String outId);
Map<String, Object> getHealthyDataByOutId(String outId);
}

View File

@ -1,22 +1,22 @@
package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.core.domain.model.LoginUser;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.bean.ObjectUtils;
import com.stdiet.common.utils.sign.AesUtils;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerHealthy;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
import com.stdiet.custom.mapper.SysCustomerMapper;
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
import com.stdiet.custom.service.ISysCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.stdiet.custom.mapper.SysCustomerMapper;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.service.ISysCustomerService;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 客户信息Service业务层处理
*
@ -25,14 +25,19 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Service
@Transactional
public class SysCustomerServiceImpl implements ISysCustomerService
{
public class SysCustomerServiceImpl implements ISysCustomerService {
@Autowired
private SysCustomerMapper sysCustomerMapper;
@Autowired
private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper;
@Autowired
private SysCustomerHealthyServiceImpl sysCustomerHealthyService;
@Autowired
private SysCustomerPhysicalSignsServiceImpl sysCustomerPhysicalSignsService;
/**
* 查询客户信息
*
@ -40,8 +45,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
* @return 客户信息
*/
@Override
public SysCustomer selectSysCustomerById(Long id)
{
public SysCustomer selectSysCustomerById(Long id) {
return sysCustomerMapper.selectSysCustomerById(id);
}
@ -52,8 +56,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
* @return 客户信息
*/
@Override
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer)
{
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer) {
return sysCustomerMapper.selectSysCustomerList(sysCustomer);
}
@ -64,8 +67,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
* @return 结果
*/
@Override
public int insertSysCustomer(SysCustomer sysCustomer)
{
public int insertSysCustomer(SysCustomer sysCustomer) {
sysCustomer.setCreateTime(DateUtils.getNowDate());
return sysCustomerMapper.insertSysCustomer(sysCustomer);
}
@ -77,8 +79,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
* @return 结果
*/
@Override
public int updateSysCustomer(SysCustomer sysCustomer)
{
public int updateSysCustomer(SysCustomer sysCustomer) {
sysCustomer.setUpdateTime(DateUtils.getNowDate());
return sysCustomerMapper.updateSysCustomer(sysCustomer);
}
@ -90,8 +91,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
* @return 结果
*/
@Override
public int deleteSysCustomerByIds(Long[] ids)
{
public int deleteSysCustomerByIds(Long[] ids) {
return sysCustomerMapper.deleteSysCustomerByIds(ids);
}
@ -102,8 +102,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
* @return 结果
*/
@Override
public int deleteSysCustomerById(Long id)
{
public int deleteSysCustomerById(Long id) {
return sysCustomerMapper.deleteSysCustomerById(id);
}
@ -113,26 +112,60 @@ public class SysCustomerServiceImpl implements ISysCustomerService
* @param phone 手机号
* @return 结果
*/
public SysCustomer getCustomerByPhone(String phone){
public SysCustomer getCustomerByPhone(String phone) {
return sysCustomerMapper.getCustomerByPhone(phone);
}
/**
* 判断客户手机号是否已存在
*
* @param sysCustomer
* @return
*/
public boolean isCustomerExistByPhone(SysCustomer sysCustomer){
if(sysCustomer.getId() != null){
if(StringUtils.isNotEmpty(sysCustomer.getPhone())){
public boolean isCustomerExistByPhone(SysCustomer sysCustomer) {
if (sysCustomer.getId() != null) {
if (StringUtils.isNotEmpty(sysCustomer.getPhone())) {
SysCustomer phoneCustomer = getCustomerByPhone(sysCustomer.getPhone());
return phoneCustomer != null && phoneCustomer.getId().intValue() != sysCustomer.getId().intValue();
}
}else{
if(StringUtils.isNotEmpty(sysCustomer.getPhone())){
} else {
if (StringUtils.isNotEmpty(sysCustomer.getPhone())) {
return getCustomerByPhone(sysCustomer.getPhone()) != null;
}
}
return false;
}
@Override
public Map<String, Object> getPhysicalSignsById(Long id) {
Map<String, Object> result = new HashMap<>();
String key = "customerHealthy";
result.put("type", 0);
//查询健康评估信息
SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id);
if (sysCustomerHealthy != null) {
/* if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) {
sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone()));
}*/
result.put(key, sysCustomerHealthy);
} else {
//查询体征信息
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id);
if (sysCustomerPhysicalSigns != null) {
/* if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) {
sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone()));
}*/
result.put("type", 1);
}
result.put(key, sysCustomerPhysicalSigns);
}
//对ID进行加密
result.put("enc_id", id != null ? AesUtils.encrypt(id + "", null) : "");
return result;
}
@Override
public Map<String, Object> getPhysicalSignsByOutId(String id) {
return null;
}
}

View File

@ -5,6 +5,7 @@ import com.stdiet.common.utils.SynchrolockUtil;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.domain.SysOrderPause;
import com.stdiet.custom.domain.SysRecipesPlan;
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
import com.stdiet.custom.service.ISysOrderPauseService;
import com.stdiet.custom.service.ISysOrderService;
@ -286,7 +287,18 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
}
@Override
public void myGenerateRecipesPlan(SysOrder sysOrder) {
public List<SysRecipesPlan> selectPlanListByOutId(String outId) {
return sysRecipesPlanMapper.selectPlanListByOutId(outId);
}
@Override
public Long getCusIdByOutId(String outId) {
return sysRecipesPlanMapper.getCusIdByOutId(outId);
}
@Override
public List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId) {
return sysRecipesPlanMapper.selectRecipesPlanListInfo(outId);
}
}

View File

@ -65,6 +65,11 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
return sysRecipesMapper.selectSysRecipesByRecipesId(id);
}
@Override
public List<SysRecipesDailyDishes> selectDishesByMenuId(Long id) {
return sysRecipesMapper.selectDishesByMenuId(id);
}
@Override
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDailyDishes) {
return sysRecipesMapper.updateDishesDetail(sysRecipesDailyDishes);

View File

@ -0,0 +1,39 @@
package com.stdiet.custom.service.impl;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.custom.domain.SysRecipesPlan;
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
import com.stdiet.custom.service.ISysCustomerService;
import com.stdiet.custom.service.ISysRecipesPlanService;
import com.stdiet.custom.service.ISysWapServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class SysWapServicesImp implements ISysWapServices {
@Autowired
ISysCustomerService iSysCustomerService;
@Autowired
ISysRecipesPlanService iSysRecipesPlanService;
@Override
public List<SysRecipesPlanListInfo> getRecipesPlanListInfo(String outId) {
return iSysRecipesPlanService.selectRecipesPlanListInfo(outId);
}
@Override
public Map<String, Object> getHealthyDataByOutId(String outId) {
Long cusId = iSysRecipesPlanService.getCusIdByOutId(outId);
if(cusId > 0) {
return iSysCustomerService.getPhysicalSignsById(cusId);
}
return null;
}
}

View File

@ -24,6 +24,7 @@
<!-- <result property="customerId" column="cus_id"></result>&lt;!&ndash; 客户ID &ndash;&gt;-->
<result property="customer" column="customer" /><!-- 客户姓名 -->
<result property="phone" column="phone" />
<result property="reviewStatus" column="review_status" />
<result property="orderStartDate" column="order_start_date" />
<result property="orderEndDate" column="order_end_date" />
<result property="nutritionistId" column="nutritionist_id" />
@ -32,8 +33,10 @@
<result property="nutritionistAssis" column="nutritionist_assis" />
</resultMap>
<sql id="selectSysRecipesPlanVo">
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
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, review_status from sys_recipes_plan
</sql>
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
@ -47,6 +50,7 @@
<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>
<if test="reviewStatus != null "> and review_status = #{reviewStatus}</if>
</select>
<select id="selectSysRecipesPlanById" parameterType="Long" resultMap="SysRecipesPlanResult">
@ -71,6 +75,7 @@
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null">del_flag,</if>
<if test="reviewStatus != null">review_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
@ -87,6 +92,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="reviewStatus != null">#{reviewStatus},</if>
</trim>
</insert>
@ -107,6 +113,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
</trim>
where id = #{id} and del_flag = 0
</update>
@ -186,4 +193,35 @@
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
ORDER BY srp.id ASC
</select>
<!-- 根据outId查询食谱计划-->
<select id="selectPlanListByOutId" parameterType="String" resultMap="SysRecipesPlanResult">
select cus_id, recipes_id, start_num_day, end_num_day from sys_recipes_plan where out_id=#{outId} order by create_time desc
</select>
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
select cus_id from sys_recipes_plan where out_id=#{outId} limit 1
</select>
<resultMap id="SysRecipesPlanListInfoResult" type="SysRecipesPlanListInfo">
<result property="id" column="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" />
<association property="menus" column="recipes_id" select="selectMenuIds"/>
</resultMap>
<select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult">
select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId}
</select>
<resultMap type="SysRecipesDaily" id="SysRecipesResult">
<result property="id" column="id"/>
<result property="numDay" column="num_day"/>
</resultMap>
<select id="selectMenuIds" parameterType="Long" resultMap="SysRecipesResult">
select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc
</select>
</mapper>