diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysContractController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysContractController.java index e55c3c705..f6c56235f 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysContractController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysContractController.java @@ -6,8 +6,10 @@ import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.enums.BusinessType; +import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.custom.domain.SysContract; +import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.page.PdfProcessInfo; import com.stdiet.custom.service.ISysContractService; import org.springframework.beans.factory.annotation.Autowired; @@ -67,7 +69,13 @@ public class SysContractController extends BaseController { @PreAuthorize("@ss.hasPermi('custom:contract:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { - return AjaxResult.success(sysContractService.selectSysContractById(id)); + SysContract contract = sysContractService.selectSysContractById(id); + if(contract != null){ + if (contract.getSignName() != null && !contract.getSignName().equals("") && !contract.getName().trim().equals(contract.getSignName())) { + contract.setName(contract.getName() + "(" + contract.getSignName() + ")"); + } + } + return AjaxResult.success(contract); } /** diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java index 291a537ea..e2c52cfd0 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java @@ -8,14 +8,19 @@ import com.stdiet.common.enums.BusinessType; import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.custom.domain.SysCustomer; +import com.stdiet.custom.domain.SysCustomerHealthy; import com.stdiet.custom.domain.SysCustomerPhysicalSigns; +import com.stdiet.custom.service.ISysCustomerHealthyService; import com.stdiet.custom.service.ISysCustomerPhysicalSignsService; import com.stdiet.custom.service.ISysCustomerService; +import com.stdiet.framework.web.domain.server.Sys; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 客户体征信息Controller @@ -32,6 +37,9 @@ public class SysCustomerController extends BaseController { @Autowired private ISysCustomerPhysicalSignsService sysCustomerPhysicalSignsService; + @Autowired + private ISysCustomerHealthyService sysCustomerHealthyService; + /** * 查询客户信息列表 */ @@ -115,8 +123,33 @@ public class SysCustomerController extends BaseController { return AjaxResult.success(sysCustomer); } + /** + * 根据客户ID获取体征或健康评估信息,优先健康评估信息 + * @param id 客户ID + * @return + */ @GetMapping("/physicalSigns/{id}") public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) { - return AjaxResult.success(sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id)); + Map result = new HashMap<>(); + 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("customerHealthy", 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("customerHealthy", sysCustomerPhysicalSigns); + } + return AjaxResult.success(result); } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysContract.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysContract.java index 7325c8f86..10bd131b3 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysContract.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysContract.java @@ -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(); - } - } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysContractMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysContractMapper.java index 80a45aaf6..0f92c374e 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysContractMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysContractMapper.java @@ -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接口 diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java index 9850eb379..35b2c21cd 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java @@ -67,4 +67,9 @@ public interface SysCustomerHealthyMapper * @param phone */ SysCustomerHealthy selectSysCustomerHealthyByPhone(@Param("phone") String phone); + + /** + * 根据客户ID查询健康评估表信息 + */ + SysCustomerHealthy selectSysCustomerHealthyByCustomerId(@Param("customerId")Long customerId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java index 4713cd90b..9896c98a6 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java @@ -59,4 +59,9 @@ public interface ISysCustomerHealthyService * @param phone */ SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone); + + /** + * 根据客户ID查询健康评估表信息 + */ + SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java index e88f2e56b..ba14b6e17 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java @@ -22,6 +22,11 @@ public interface ISysCustomerPhysicalSignsService { */ public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id); + /** + * 根据客户ID查询体征数据 + * @param id + * @return + */ public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsByCusId(Long id); /** diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java index 55a32214c..0a76e826a 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java @@ -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); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysContractMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysContractMapper.xml index f8fdd4f3d..7f269518f 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysContractMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysContractMapper.xml @@ -6,6 +6,7 @@ + @@ -22,38 +23,39 @@ + - 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 insert into sys_contract id, + customer_id, project_id, status, name, @@ -73,6 +75,7 @@ #{id}, + #{customerId}, #{projectId}, #{status}, #{name}, @@ -95,6 +98,7 @@ update sys_contract + customer_id = #{customerId}, project_id = #{projectId}, status = #{status}, name = #{name}, @@ -116,11 +120,11 @@ - delete from sys_contract where id = #{id} + update sys_contract set del_flag = 1 where id = #{id} - delete from sys_contract where id in + update sys_contract set del_flag = 1 where id in #{id} diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml index bceb64ec1..cb0376e7d 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml @@ -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} + + + insert into sys_customer_healthy diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml index 69a496f31..821ae9697 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml @@ -67,6 +67,7 @@ where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id} + diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index f8ba33eb1..d1fda373a 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -317,13 +317,13 @@ where del_flag = 0 and order_id = #{order_id} - +