!360 商务单加上售中

Merge pull request !360 from 德仔/xzj
This commit is contained in:
德仔
2021-08-26 02:19:35 +00:00
committed by Gitee
21 changed files with 215 additions and 42 deletions

View File

@ -14,10 +14,7 @@ import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysWxUserInfo;
import com.stdiet.custom.domain.SysWxUserLog;
import com.stdiet.custom.page.WxLogInfo;
import com.stdiet.custom.service.ISysMessageNoticeService;
import com.stdiet.custom.service.ISysOrderService;
import com.stdiet.custom.service.ISysWxUserInfoService;
import com.stdiet.custom.service.ISysWxUserLogService;
import com.stdiet.custom.service.*;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@ -48,6 +45,9 @@ public class SysWxUserLogController extends BaseController {
@Autowired
private ISysMessageNoticeService sysMessageNoticeService;
@Autowired
private ISysCustomerService sysCustomerService;
/**
* 查询微信用户记录列表
*/
@ -164,21 +164,24 @@ public class SysWxUserLogController extends BaseController {
/**
* 获取微信用户记录详细信息
* @param id 打卡记录ID
* @param nextFlag 0当前 -1上一条 1下一条
* @return
*/
@PreAuthorize("@ss.hasPermi('custom:wxUserLog:query')")
@GetMapping(value = "/getPunchLogDetail/{id}")
public AjaxResult getPunchLogDetail(@PathVariable("id") String id) {
public AjaxResult getPunchLogDetail(@PathVariable("id") String id,
@RequestParam(value = "cusId", required = false)Long cusId,
@RequestParam(value = "nextFlag", required = false, defaultValue = "0")int nextFlag) {
SysWxUserLog sysWxUserLog = null;
//根据ID查询
SysWxUserLog param = new SysWxUserLog();
param.setId(Long.parseLong(id));
List<SysWxUserLog> sysWxUserLogList = sysWxUserLogService.selectSysWxUserLogList(param);
if(sysWxUserLogList != null && sysWxUserLogList.size() > 0){
sysWxUserLog = sysWxUserLogList.get(0);
}
if(sysWxUserLog == null){
return AjaxResult.error("打卡记录不存在");
}
param.setNextFlag(nextFlag);
param.setCustomerId(cusId);
sysWxUserLog = sysWxUserLogService.getPunchLogDetail(param);
if(sysWxUserLog != null){
Map<String, List<String>> imageUrlMap = new HashMap<>();
List<String> breakfastImagesUrlList = StringUtils.isNotEmpty(sysWxUserLog.getBreakfastImages()) ? Arrays.asList(sysWxUserLog.getBreakfastImages().split("\\|")) : new ArrayList<>();
imageUrlMap.put("breakfastImages", breakfastImagesUrlList);
@ -198,6 +201,13 @@ public class SysWxUserLogController extends BaseController {
//生成预览链接
Map<String,List<String>> downUrlList = AliyunOSSUtils.generatePresignedUrl(imageUrlMap);
sysWxUserLog.setImagesUrl(downUrlList);
//查询对应对应客户性别
if(sysWxUserLog.getCustomerId() != null){
sysWxUserLog.setSex( sysCustomerService.getCustomerSex(sysWxUserLog.getCustomerId()));
}
}
return AjaxResult.success(sysWxUserLog);
}

View File

@ -210,6 +210,12 @@ public class SysWxUserLog extends BaseEntity {
private JSONArray scaleBodyData;
//获取详情标识
private Integer nextFlag;
//客户性别
private Integer sex;
public void setDefecation(String defecation) {
if (defecation.equals("Y") || defecation.equals("N")) {
// this.defecation = defecation.equals("Y") ? "是" : "否";

View File

@ -88,4 +88,11 @@ public interface SysCustomerHealthyMapper
* @return
*/
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
/**
* 查询客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -73,4 +73,11 @@ public interface SysCustomerPhysicalSignsMapper
* @return
*/
int delCustomerSignByCustomerId(@Param("customerId")Long customerId);
/**
* 查询客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -123,4 +123,11 @@ public interface SysWxUserLogMapper
*/
List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer);
/**
* 查询打卡详情(下一条、上一条)
* @param sysWxUserLog
* @return
*/
SysWxUserLog getPunchLogDetail(SysWxUserLog sysWxUserLog);
}

View File

@ -94,4 +94,11 @@ public interface ISysCustomerHealthyService
* @return
*/
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData);
/**
* 查询客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -92,4 +92,11 @@ public interface ISysCustomerPhysicalSignsService {
*/
int delCustomerSignByCustomerId(Long customerId);
/**
* 获取客户性别
* @param cusId
* @return
*/
Integer getCustomerSexByCusId(Long cusId);
}

View File

@ -88,4 +88,11 @@ public interface ISysCustomerService
*/
SysCustomer getCustomerByOpenId(String openid);
/**
* 根据客户ID查询性别
* @param cusId 客户ID
* @return
*/
Integer getCustomerSex(Long cusId);
}

View File

@ -124,4 +124,11 @@ public interface ISysWxUserLogService
*/
List<SysCustomer> selectNotPunchCustomerByDate(SysCustomer sysCustomer);
/**
* 查询打卡详情(下一条、上一条)
* @param sysWxUserLog
* @return
*/
SysWxUserLog getPunchLogDetail(SysWxUserLog sysWxUserLog);
}

View File

@ -272,4 +272,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
public List<SysDictData> selectDictDataByTypeAndValue(SysDictData sysDictData){
return sysCustomerHealthyMapper.selectDictDataByTypeAndValue(sysDictData);
}
/**
* 查询客户性别
* @param cusId
* @return
*/
public Integer getCustomerSexByCusId(Long cusId){
return sysCustomerHealthyMapper.getCustomerSexByCusId(cusId);
}
}

View File

@ -192,4 +192,14 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
public int delCustomerSignByCustomerId(Long customerId){
return sysCustomerPhysicalSignsMapper.delCustomerSignByCustomerId(customerId);
}
/**
* 查询客户性别
* @param cusId
* @return
*/
@Override
public Integer getCustomerSexByCusId(Long cusId){
return sysCustomerPhysicalSignsMapper.getCustomerSexByCusId(cusId);
}
}

View File

@ -231,4 +231,17 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
}
}
}
/**
* 根据客户ID查询性别
* @param cusId 客户ID
* @return
*/
public Integer getCustomerSex(Long cusId){
Integer sex = sysCustomerHealthyService.getCustomerSexByCusId(cusId);
if(sex == null){
sex = sysCustomerPhysicalSignsService.getCustomerSexByCusId(cusId);
}
return sex;
}
}

View File

@ -227,7 +227,6 @@ public class SysOrderServiceImpl implements ISysOrderService {
sysOrder.setMainOrderId(0L);
sysOrder.setAfterSaleCommissOrder(0);
sysOrder.setPreSaleId(null);
sysOrder.setOnSaleId(null);
sysOrder.setPushPreSaleId(null);
sysOrder.setPlannerId(null);
sysOrder.setPlannerAssisId(null);
@ -327,7 +326,6 @@ public class SysOrderServiceImpl implements ISysOrderService {
sysOrder.setMainOrderId(0L);
sysOrder.setAfterSaleCommissOrder(0);
sysOrder.setPreSaleId(null);
sysOrder.setOnSaleId(null);
sysOrder.setPushPreSaleId(null);
sysOrder.setPlannerId(null);
sysOrder.setPlannerAssisId(null);

View File

@ -182,4 +182,13 @@ public class SysWxUserLogServiceImpl implements ISysWxUserLogService {
return sysWxUserLogMapper.selectNotPunchCustomerByDate(sysCustomer);
}
/**
* 查询打卡详情(下一条、上一条)
* @param sysWxUserLog
* @return
*/
public SysWxUserLog getPunchLogDetail(SysWxUserLog sysWxUserLog){
return sysWxUserLogMapper.getPunchLogDetail(sysWxUserLog);
}
}

View File

@ -44,7 +44,7 @@
</if>
<!-- 因为体验单、售中单都存在售中存在两种情况需要计算提成1、售中单 2、售中自己开的体验单通过售前是否为NULL或0判断售前不为空则表示售前开的体验单不计算售中提成 -->
<if test="postCode != null and postCode == 'on_sale_id'">
AND (order_type = 3 OR (order_type = 2 AND (pre_sale_id IS NULL || pre_sale_id = 0)))
AND (order_type = 3 OR order_type = 4 OR (order_type = 2 AND (pre_sale_id IS NULL || pre_sale_id = 0)))
</if>
GROUP BY ${column}
</sql>

View File

@ -583,4 +583,9 @@
from sys_customer_healthy_extended where del_flag = 0 and healthy_id = #{id} limit 1
</select>
<!-- 查询客户性别 -->
<select id="getCustomerSexByCusId" parameterType="Long" resultType="Integer">
select sex from sys_customer_healthy where del_flag = 0 and customer_id = #{cusId} limit 1
</select>
</mapper>

View File

@ -222,4 +222,9 @@
update sys_customer_physical_signs set del_flag = 1 where customer_id = #{customerId}
</update>
<!-- 查询客户性别 -->
<select id="getCustomerSexByCusId" parameterType="Long" resultType="Integer">
select sex from sys_customer_physical_signs where del_flag = 0 and customer_id = #{cusId} limit 1
</select>
</mapper>

View File

@ -49,6 +49,7 @@
<result property="menstrualPeriod" column="menstrual_period"/>
<!-- 非持久字段 -->
<result property="customerName" column="customer_name"/>
<result property="customerId" column="cus_id"/>
<!-- 营养师 -->
<result property="nutritionist" column="nutritionist"/>
<result property="afterNutritionist" column="after_nutritionist"/>
@ -500,5 +501,41 @@
order by plan.cus_id desc
</select>
<!-- 获取打卡详情(上一天、下一天) -->
<select id="getPunchLogDetail" parameterType="SysWxUserLog" resultMap="SysWxUserLogResult">
SELECT
wxlog.id,wxinfo.appid,wxinfo.openid,wxinfo.avatar_url,wxinfo.phone,wxlog.weight,wxlog.log_time,wxlog.sleep_time,
wxlog.wakeup_time,wxlog.defecation, wxlog.defecation_desc, wxlog.water, wxlog.insomnia,wxlog.sport,
wxlog.sport_desc,wxlog.diet, wxlog.diet_desc,wxlog.remark,
wxlog.emotion, wxlog.menstrual_period,
wxlog.emotion_desc,wxlog.sly_eat_food,wxlog.constipation,wxlog.ingredient_desc,wxlog.breakfast_images,
wxlog.lunch_images,wxlog.dinner_images,wxlog.extra_meal_images,wxlog.body_images,wxlog.body_desc,
wxlog.suggest,wxlog.execution_score,wxlog.comment,wxlog.health_manifesto, wxlog.log_time,
sc.id as cus_id,sc.name as customer_name
FROM sys_wx_user_log wxlog
left join sys_wx_user_info wxinfo on wxinfo.openid = wxlog.openid
left join sys_customer sc on sc.id = wxinfo.cus_id and sc.del_flag = 0
where wxlog.del_flag = 0
<if test="nextFlag == 0">
and wxlog.id = #{id}
</if>
<if test="nextFlag == -1">
and #{id} > wxlog.id
</if>
<if test="nextFlag == 1">
and wxlog.id > #{id}
</if>
<if test="customerId != null">
and sc.id = #{customerId}
</if>
<if test="nextFlag == -1">
order by id desc
</if>
<if test="nextFlag == 1">
order by id asc
</if>
limit 1
</select>
</mapper>

View File

@ -53,11 +53,11 @@ export function exportWxUserLog(query) {
}
// 根据ID查询打卡日志详情
export function getPunchLogDetail(id) {
export function getPunchLogDetail(id, cusId, nextFlag) {
return request({
url: '/custom/wxUserLog/getPunchLogDetail/' + id,
method: 'get',
params: {}
params: {'cusId': cusId ? cusId : null, 'nextFlag': nextFlag ? nextFlag : 0}
})
}

View File

@ -12,7 +12,7 @@
<div
:style="'float: left; width: ' + (commentVisible ? '900px' : '950px')"
>
<div style="float: right; margin-bottom: 10px">
<div style="float: right; margin-right:30px;">
<el-button
v-hasPermi="['custom:wxUserLog:query']"
type="primary"
@ -21,10 +21,11 @@
>打卡点评</el-button
>
</div>
<div style="height: 600px; overflow: auto; width:100%">
<h3>基础信息</h3>
<TableDetailMessage :data="punchLogDetail" :maxLength="10" />
<h3>食物以及对比照信息</h3>
<div style="height: 370px; overflow: auto">
<div>
<div v-if="punchLog != null && punchLog.ingredientDesc">
<h4>食物描述</h4>
<div>
@ -116,6 +117,7 @@
</div>
</div>
</div>
</div>
<div
style="width: 200px; margin-left: 40px; margin-top: 50px"
v-show="commentVisible"
@ -140,7 +142,7 @@
<el-form-item label="点评内容" prop="comment">
<el-input
type="textarea"
:rows="20"
:rows="15"
maxlength="200"
show-word-limit
placeholder="请输入点评内容"
@ -155,6 +157,11 @@
</div>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" plain style="float:left" @click="getPunchLogById(punchLog.customerId, -1)">前一天</el-button>
<el-button type="primary" plain @click="getPunchLogById(punchLog.customerId,1)">后一天</el-button>
</div>
</el-dialog>
</template>
@ -225,23 +232,38 @@ export default {
},
showDialog(data, callback) {
this.data = data;
if (data.sex) {
//性别判断改为根据id查询时返回的性别为准
/*if (data.sex) {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)", "生理期"];
this.punchValueData[0] = ["weight", "water", "menstrualPeriod"];
} else {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)"];
this.punchValueData[0] = ["weight", "water"];
}*/
this.callback = callback;
this.commentFlag = false;
this.title = `${data.customerName}` + " " + `${data.logTime}」打卡记录`;
this.getPunchLogById();
},
getPunchLogById(cusId, nextFlag) {
getPunchLogDetail(this.punchLog == null ? this.data.id : this.punchLog.id, cusId, nextFlag).then((res) => {
if (res.code == 200) {
if(res.data == null){
if(nextFlag && nextFlag != null){
this.msgInfo("打卡记录已到尽头");
}
return;
}
this.visible = true;
this.punchLog = res.data;
this.title = `${res.data.customerName}` + " " + `${res.data.logTime}」打卡记录`;
if (res.data.sex != null && res.data.sex == 1) {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)", "生理期"];
this.punchValueData[0] = ["weight", "water", "menstrualPeriod"];
} else {
this.punchTitleData[0] = ["体重(斤)", "饮水量(ml)"];
this.punchValueData[0] = ["weight", "water"];
}
this.callback = callback;
this.commentFlag = false;
this.title = `${data.customerName}` + " " + `${data.logTime}」打卡记录`;
this.getPunchLogById();
},
getPunchLogById() {
getPunchLogDetail(this.data.id).then((res) => {
if (res.code == 200) {
this.visible = true;
this.punchLog = res.data;
res.data.sport = res.data.sport === "Y" ? "是" : "否";
res.data.diet = res.data.diet === "Y" ? "是" : "否";
res.data.insomnia = res.data.insomnia === "Y" ? "是" : "否";

View File

@ -233,7 +233,7 @@ export function dealOrderModuleshowByOrderType(orderType, moduleshow, form){
form.operatorId = null;
form.operatorAssisId = null;
}
moduleshow.onSaleShow = true;
moduleshow.preSaleShow = false;
moduleshow.plannerShow = false;
moduleshow.plannerAssisShow = false;