客户档案的体征、合同展示

This commit is contained in:
xiezhijun
2021-01-30 19:26:56 +08:00
parent 1c58b13bcf
commit 9470aa6b5e
18 changed files with 754 additions and 384 deletions

View File

@ -2,6 +2,7 @@ package com.stdiet.custom.domain;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -15,6 +16,7 @@ import java.util.Map;
* @author wonder
* @date 2020-10-23
*/
@Data
public class SysContract extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -24,6 +26,11 @@ public class SysContract extends BaseEntity {
@Excel(name = "合同编号")
private Long id;
/**
* 客户ID
*/
private Long customerId;
/**
* 调理项目ID
*/
@ -96,290 +103,9 @@ public class SysContract extends BaseEntity {
private String servePromise;
public String getSignName() {
return signName;
}
public void setSignName(String signName) {
this.signName = signName;
}
public String getTutor() {
return tutor;
}
public void setTutor(String tutor) {
this.tutor = tutor;
}
public String getServePromise() {
return servePromise;
}
public void setServePromise(String servePromise) {
this.servePromise = servePromise;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getServeTime() {
return serveTime;
}
public void setServeTime(int serveTime) {
this.serveTime = serveTime;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getAmountUpper() {
return amountUpper;
}
public void setAmountUpper(String amountUpper) {
this.amountUpper = amountUpper;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getStatus() {
return Status;
}
public void setStatus(String status) {
Status = status;
}
public String getCusId() {
return cusId;
}
public void setCusId(String cusId) {
this.cusId = cusId;
}
public String getSignDate() {
return signDate;
}
public void setSignDate(String signDate) {
this.signDate = signDate;
}
public String getServeTimeStr() {
return serveTimeStr;
}
public void setServeTimeStr(String serveTimeStr) {
this.serveTimeStr = serveTimeStr;
}
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("cusId", getCusId())
.append("status", getStatus())
.append("phone", getPhone())
.append("serveTime", getServeTime())
.append("amount", getAmount())
.append("amountUpper", getAmountUpper())
.append("signDate", getSignDate())
.append("path", getPath())
.append("createBy", getCreateBy())
.append("tutor", getTutor())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("signName", getSignName())
.toString();
}
/**
* 微信用户对象 sys_wx_user_info
*
* @author wonder
* @date 2020-11-28
* 删除标识
*/
public static class SysWxUserInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Integer delFlag;
/** 微信openid */
private String openid;
/** 昵称 */
@Excel(name = "昵称")
private String nickName;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 用户头像 */
@Excel(name = "用户头像")
private String avatarUrl;
/** 用户性别0男 1女 2未知 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 城市 */
@Excel(name = "城市")
private String city;
/** 省份 */
@Excel(name = "省份")
private String province;
/** 国家 */
@Excel(name = "国家")
private String country;
public void setOpenid(String openid)
{
this.openid = openid;
}
public String getOpenid()
{
return openid;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setAvatarUrl(String avatarUrl)
{
this.avatarUrl = avatarUrl;
}
public String getAvatarUrl()
{
return avatarUrl;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
{
return sex;
}
public void setCity(String city)
{
this.city = city;
}
public String getCity()
{
return city;
}
public void setProvince(String province)
{
this.province = province;
}
public String getProvince()
{
return province;
}
public void setCountry(String country)
{
this.country = country;
}
public String getCountry()
{
return country;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("openid", getOpenid())
.append("nickName", getNickName())
.append("phone", getPhone())
.append("avatarUrl", getAvatarUrl())
.append("sex", getSex())
.append("city", getCity())
.append("province", getProvince())
.append("country", getCountry())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
}

View File

@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysContract;
import org.apache.ibatis.annotations.Param;
/**
* 合同Mapper接口

View File

@ -67,4 +67,9 @@ public interface SysCustomerHealthyMapper
* @param phone
*/
SysCustomerHealthy selectSysCustomerHealthyByPhone(@Param("phone") String phone);
/**
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(@Param("customerId")Long customerId);
}

View File

@ -59,4 +59,9 @@ public interface ISysCustomerHealthyService
* @param phone
*/
SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone);
/**
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId);
}

View File

@ -22,6 +22,11 @@ public interface ISysCustomerPhysicalSignsService {
*/
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
/**
* 根据客户ID查询体征数据
* @param id
* @return
*/
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsByCusId(Long id);
/**

View File

@ -151,4 +151,11 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
public SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone){
return sysCustomerHealthyMapper.selectSysCustomerHealthyByPhone(phone);
}
/**
* 根据客户ID查询健康评估表信息
*/
public SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId){
return sysCustomerHealthyMapper.selectSysCustomerHealthyByCustomerId(customerId);
}
}

View File

@ -6,6 +6,7 @@
<resultMap type="SysContract" id="SysContractResult">
<result property="id" column="id"/>
<result property="customerId" column="customer_id"></result>
<result property="projectId" column="project_id"></result>
<result property="status" column="status"/>
<result property="name" column="name"/>
@ -22,38 +23,39 @@
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"></result>
<!-- 非持久化字段 -->
<result property="projectName" column="project_name"></result>
</resultMap>
<sql id="selectSysContractVo">
select sc.id, sc.project_id, sc.status, sc.name, sc.sign_name, sc.phone, sc.cus_id, sc.serve_time, sc.tutor, sc.serve_promise, sc.amount,
sc.path, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.remark,cp.dict_label as project_name
select sc.id, sc.customer_id, sc.project_id, sc.status, sc.name, sc.sign_name, sc.phone, sc.cus_id, sc.serve_time, sc.tutor, sc.serve_promise, sc.amount,
sc.path, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.remark, sc.del_flag, cp.dict_label as project_name
from sys_contract as sc
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') as cp ON cp.dict_value = sc.project_id
</sql>
<select id="selectSysContractList" parameterType="SysContract" resultMap="SysContractResult">
<include refid="selectSysContractVo"/>
<where>
<if test="id != null ">and sc.id = #{id}</if>
<if test="status != null ">and sc.status = #{status}</if>
<if test="tutor != null and tutor != '' ">and sc.tutor = #{tutor}</if>
<if test="name != null and name != ''">and sc.name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''">and sc.phone = #{phone}</if>
</where>
<include refid="selectSysContractVo"/> where del_flag = 0
<if test="id != null ">and sc.id = #{id}</if>
<if test="customerId != null">and sc.customer_id = #{customerId}</if>
<if test="status != null ">and sc.status = #{status}</if>
<if test="tutor != null and tutor != '' ">and sc.tutor = #{tutor}</if>
<if test="name != null and name != ''">and sc.name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''">and sc.phone = #{phone}</if>
order by create_time desc
</select>
<select id="selectSysContractById" parameterType="Long" resultMap="SysContractResult">
<include refid="selectSysContractVo"/>
where sc.id = #{id}
where sc.id = #{id} and del_flag = 0
</select>
<insert id="insertSysContract" parameterType="SysContract" useGeneratedKeys="true" keyProperty="id">
insert into sys_contract
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="customerId != null">customer_id,</if>
<if test="projectId != null">project_id,</if>
<if test="status != null">status,</if>
<if test="name != null and name != ''">name,</if>
@ -73,6 +75,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="customerId != null">#{customerId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="status != null">#{status},</if>
<if test="name != null and name != ''">#{name},</if>
@ -95,6 +98,7 @@
<update id="updateSysContract" parameterType="SysContract">
update sys_contract
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="status != null">status = #{status},</if>
<if test="name != null and name != ''">name = #{name},</if>
@ -116,11 +120,11 @@
</update>
<delete id="deleteSysContractById" parameterType="Long">
delete from sys_contract where id = #{id}
update sys_contract set del_flag = 1 where id = #{id}
</delete>
<delete id="deleteSysContractByIds" parameterType="String">
delete from sys_contract where id in
update sys_contract set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@ -144,10 +144,18 @@
from sys_customer_healthy as sch
left join sys_customer sc on sc.id = sch.customer_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id
where sch.del_flag = 0 and sc.del_flag = 0 and sch.id = #{id}
</select>
<!-- 根据客户ID查询客户健康评估 -->
<select id="selectSysCustomerHealthyByCustomerId" parameterType="Long" resultMap="SysCustomerHealthyResult">
<include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone,cp.dict_label as conditioning_project
from sys_customer_healthy as sch
left join sys_customer sc on sc.id = sch.customer_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id
where sch.del_flag = 0 and sc.del_flag = 0 and sch.customer_id = #{customerId}
</select>
<insert id="insertSysCustomerHealthy" parameterType="SysCustomerHealthy">
insert into sys_customer_healthy
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -67,6 +67,7 @@
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id}
</select>
<!-- 根据客户ID查询用户体征 -->
<select id="selectSysCustomerPhysicalSignsByCusId" parameterType="Long" resultMap="SysCustomerSignResult">
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.customer_id = #{id}
</select>

View File

@ -317,13 +317,13 @@
where del_flag = 0 and order_id = #{order_id}
</select>
<!-- 查询订单信息(用于计算提成) -->
<!-- 查询2021年开始的已审核的订单信息(用于计算提成) -->
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended">
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
left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
where o.order_time >= '2021-01-01'
where review_status = 'yes' and o.order_time >= '2021-01-01'
<if test="userId != null">
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>