客户档案的合同添加、复制健康调查链接

This commit is contained in:
xiezhijun
2021-02-01 19:13:41 +08:00
parent f3a4fa40a8
commit e3d8a9fa12
32 changed files with 621 additions and 1102 deletions

View File

@ -72,4 +72,11 @@ public interface SysCustomerHealthyMapper
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(@Param("customerId")Long customerId);
/**
* 根据客户ID删除客户健康评估信息
* @param customerId
* @return
*/
int deleteCustomerHealthyByCustomerId(@Param("customerId")Long customerId);
}

View File

@ -66,4 +66,11 @@ public interface SysCustomerPhysicalSignsMapper
* @return
*/
SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone);
/**
* 根据客户ID删除对应体征信息
* @param customerId
* @return
*/
int delCustomerSignByCustomerId(@Param("customerId")Long customerId);
}

View File

@ -2,6 +2,9 @@ package com.stdiet.custom.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.stdiet.custom.domain.SysCommision;
import com.stdiet.custom.domain.SysCommissionDayDetail;
import com.stdiet.custom.domain.SysOrder;
import org.apache.ibatis.annotations.Param;
@ -72,5 +75,5 @@ public interface SysOrderMapper
* 获取订单信息
* @return
*/
List<SysOrder> selectSimpleOrderMessage(@Param("userId") Long userId);
List<SysOrder> selectSimpleOrderMessage(SysCommision sysCommision);
}

View File

@ -31,13 +31,21 @@ public interface ISysCustomerHealthyService
public List<SysCustomerHealthy> selectSysCustomerHealthyList(SysCustomerHealthy sysCustomerHealthy);
/**
* 新增或修改客户健康
* 新增或修改客户健康(已弃用)
*
* @param sysCustomerHealthy 客户健康
* @return 结果
*/
public AjaxResult insertOrUpdateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy);
/**
* 新增客户健康
*
* @param sysCustomerHealthy 客户健康
* @return 结果
*/
public AjaxResult insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy);
/**
* 批量删除客户健康
*
@ -64,4 +72,11 @@ public interface ISysCustomerHealthyService
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId);
/**
* 根据客户ID删除客户健康评估信息
* @param customerId
* @return
*/
int deleteCustomerHealthyByCustomerId(Long customerId);
}

View File

@ -6,6 +6,7 @@ import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
import org.apache.ibatis.annotations.Param;
/**
* 客户体征信息Service接口
@ -84,4 +85,11 @@ public interface ISysCustomerPhysicalSignsService {
*/
SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone);
/**
* 根据客户ID删除对应体征信息
* @param customerId
* @return
*/
int delCustomerSignByCustomerId(Long customerId);
}

View File

@ -67,4 +67,11 @@ public interface ISysCustomerService
* @return 结果
*/
SysCustomer getCustomerByPhone(String phone);
/**
* 判断客户手机号是否已存在
* @param sysCustomer
* @return
*/
boolean isCustomerExistByPhone(SysCustomer sysCustomer);
}

View File

@ -40,7 +40,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
total.setTotalNotSentCommissionAmount(new BigDecimal(0));
total.setNextMonthCommission(new BigDecimal(0));
if(list != null && list.size() > 0){
Map<Long, List<SysOrderCommisionDayDetail>> orderDetailMap = getOrderByList(sysCommision.getUserId());
Map<Long, List<SysOrderCommisionDayDetail>> orderDetailMap = getOrderByList(sysCommision);
SysCommissionDayDetail sysCommissionDayDetail = null;
for(SysCommision commision : list){
sysCommissionDayDetail = new SysCommissionDayDetail();
@ -232,9 +232,9 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
/**
* 查询2021年1月份之后所有订单对订单进行处理得出每笔订单的相关信息
* */
public Map<Long, List<SysOrderCommisionDayDetail>> getOrderByList(Long userId){
public Map<Long, List<SysOrderCommisionDayDetail>> getOrderByList(SysCommision sysCommision){
//查询2021年1月份之后所有订单
List<SysOrder> orderList = sysOrderMapper.selectSimpleOrderMessage(userId);
List<SysOrder> orderList = sysOrderMapper.selectSimpleOrderMessage(sysCommision);
//整理出每个用户对应的订单List
Map<Long, List<SysOrderCommisionDayDetail>> userOrderResultMap = new HashMap<>();
for (SysOrder sysOrder : orderList) {

View File

@ -3,7 +3,9 @@ package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.core.domain.AjaxResult;
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.SysCustomerPhysicalSigns;
import com.stdiet.custom.service.ISysCustomerService;
@ -53,7 +55,7 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
}
/**
* 新增客户健康
* 新增客户健康(已弃用)
*
* @param sysCustomerHealthy 客户健康
* @return 结果
@ -119,6 +121,34 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
* 新增客户健康
*
* @param sysCustomerHealthy 客户健康
* @return 结果
*/
public AjaxResult insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy){
//客户ID解密
String customerId = StringUtils.isNotEmpty(sysCustomerHealthy.getCustomerEncId()) ? AesUtils.decrypt(sysCustomerHealthy.getCustomerEncId(), null) : "";
if(StringUtils.isEmpty(customerId)){
return AjaxResult.error("客户不存在");
}
//判断客户是否存在
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(Long.parseLong(customerId));
if(sysCustomer == null){
return AjaxResult.error("客户不存在");
}
//判断是否已存在客户健康评估
SysCustomerHealthy customerHealthy = selectSysCustomerHealthyByCustomerId(Long.parseLong(customerId));
if(customerHealthy != null){
return AjaxResult.error("已存在健康评估信息,无法重复添加");
}
//设置客户ID
sysCustomerHealthy.setCustomerId(Long.parseLong(customerId));
int rows = sysCustomerHealthyMapper.insertSysCustomerHealthy(sysCustomerHealthy);
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
* 批量删除客户健康
*
@ -158,4 +188,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
public SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId){
return sysCustomerHealthyMapper.selectSysCustomerHealthyByCustomerId(customerId);
}
/**
* 根据客户ID删除客户健康评估信息
* @param customerId
* @return
*/
public int deleteCustomerHealthyByCustomerId(Long customerId){
return sysCustomerHealthyMapper.deleteCustomerHealthyByCustomerId(customerId);
}
}

View File

@ -182,4 +182,14 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
public SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone){
return sysCustomerPhysicalSignsMapper.selectSysCustomerAndSignByPhone(phone);
}
/**
* 根据客户ID删除对应体征信息
* @param customerId
* @return
*/
@Override
public int delCustomerSignByCustomerId(Long customerId){
return sysCustomerPhysicalSignsMapper.delCustomerSignByCustomerId(customerId);
}
}

View File

@ -5,6 +5,7 @@ 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.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
@ -115,4 +116,23 @@ public class SysCustomerServiceImpl implements ISysCustomerService
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())){
SysCustomer phoneCustomer = getCustomerByPhone(sysCustomer.getPhone());
return phoneCustomer != null && phoneCustomer.getId().intValue() != sysCustomer.getId().intValue();
}
}else{
if(StringUtils.isNotEmpty(sysCustomer.getPhone())){
return getCustomerByPhone(sysCustomer.getPhone()) != null;
}
}
return false;
}
}

View File

@ -508,5 +508,9 @@
where sch.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1
</select>
<!-- 根据客户ID删除健康评估信息 -->
<update id="deleteCustomerHealthyByCustomerId" parameterType="Long">
update sys_customer_healthy set del_flag = 1 where customer_id = #{customerId}
</update>
</mapper>

View File

@ -207,4 +207,9 @@
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1
</select>
<!-- 根据客户ID删除对应体征信息 -->
<update id="delCustomerSignByCustomerId" parameterType="Long">
update sys_customer_physical_signs set del_flag = 1 where customer_id = #{customerId}
</update>
</mapper>

View File

@ -318,7 +318,7 @@
</select>
<!-- 查询2021年开始的已审核的订单信息用于计算提成 -->
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended">
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended" parameterType="SysCommision">
select o.order_id,o.order_time,o.start_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name
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
@ -327,6 +327,12 @@
<if test="userId != null">
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>
<if test="beginTime != null and beginTime != ''">
AND o.order_time &gt;= #{beginTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if>
order by o.order_time desc
</select>