commit
42208ab591
@ -1,6 +1,7 @@
|
|||||||
package com.stdiet.web.controller.custom;
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
import com.aliyun.vod20170321.models.GetPlayInfoResponseBody;
|
import com.aliyun.vod20170321.models.GetPlayInfoResponseBody;
|
||||||
|
import com.stdiet.common.constant.HttpStatus;
|
||||||
import com.stdiet.common.core.controller.BaseController;
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
import com.stdiet.common.core.domain.AjaxResult;
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
import com.stdiet.common.core.domain.entity.SysDictData;
|
import com.stdiet.common.core.domain.entity.SysDictData;
|
||||||
@ -16,6 +17,7 @@ import com.stdiet.common.utils.sign.AesUtils;
|
|||||||
import com.stdiet.custom.domain.*;
|
import com.stdiet.custom.domain.*;
|
||||||
import com.stdiet.custom.dto.response.CustomerCaseResponse;
|
import com.stdiet.custom.dto.response.CustomerCaseResponse;
|
||||||
import com.stdiet.custom.dto.response.MessageNoticeResponse;
|
import com.stdiet.custom.dto.response.MessageNoticeResponse;
|
||||||
|
import com.stdiet.custom.dto.response.NutritionQuestionResponse;
|
||||||
import com.stdiet.custom.dto.response.NutritionalVideoResponse;
|
import com.stdiet.custom.dto.response.NutritionalVideoResponse;
|
||||||
import com.stdiet.custom.page.WxLogInfo;
|
import com.stdiet.custom.page.WxLogInfo;
|
||||||
import com.stdiet.custom.service.*;
|
import com.stdiet.custom.service.*;
|
||||||
@ -77,13 +79,24 @@ public class WechatAppletController extends BaseController {
|
|||||||
* 查询微信小程序中展示的客户案例
|
* 查询微信小程序中展示的客户案例
|
||||||
*/
|
*/
|
||||||
@GetMapping("/caseList")
|
@GetMapping("/caseList")
|
||||||
public TableDataInfo caseList(SysCustomerCase sysCustomerCase) {
|
public TableDataInfo caseList(SysCustomerCase sysCustomerCase, @RequestParam(value = "pageSize",required = false,defaultValue = "10")int pageSize,
|
||||||
startPage();
|
@RequestParam(value="randomFlag",required = false,defaultValue = "false") boolean randomFlag) {
|
||||||
sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null);
|
if(randomFlag){
|
||||||
List<CustomerCaseResponse> list = sysCustomerCaseService.getWxCustomerCaseList(sysCustomerCase);
|
List<CustomerCaseResponse> reponseList = sysCustomerCaseService.getWxCustomerCaseByRandom(pageSize);
|
||||||
//处理ID加密
|
TableDataInfo rspData = new TableDataInfo();
|
||||||
dealIdEnc(list);
|
rspData.setCode(HttpStatus.SUCCESS);
|
||||||
return getDataTable(list);
|
rspData.setMsg("查询成功");
|
||||||
|
rspData.setRows(reponseList);
|
||||||
|
rspData.setTotal(pageSize);
|
||||||
|
return rspData;
|
||||||
|
}else{
|
||||||
|
startPage();
|
||||||
|
sysCustomerCase.setKeywordArray(StringUtils.isNotEmpty(sysCustomerCase.getKeyword()) ? sysCustomerCase.getKeyword().split(",") : null);
|
||||||
|
List<CustomerCaseResponse> list = sysCustomerCaseService.getWxCustomerCaseList(sysCustomerCase);
|
||||||
|
//处理ID加密
|
||||||
|
dealIdEnc(list);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -327,14 +340,30 @@ public class WechatAppletController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* 获取小程序展示的营养小知识列表
|
* 获取小程序展示的营养小知识列表
|
||||||
|
* @param sysNutritionQuestion 查询参数对象
|
||||||
|
* @param pageNum 分页当前页码
|
||||||
|
* @param pageSize 分页每页数量
|
||||||
|
* @param randomFlag 随机标识 true 随机获取指定pageSize数量的营养小知识,不支持分页、模糊查询 false 则正常查询
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getNutritionQuestionList")
|
@GetMapping(value = "/getNutritionQuestionList")
|
||||||
public AjaxResult getNutritionQuestionList(SysNutritionQuestion sysNutritionQuestion, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
|
public AjaxResult getNutritionQuestionList(SysNutritionQuestion sysNutritionQuestion, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
|
||||||
|
@RequestParam(value="randomFlag",required = false,defaultValue = "false") boolean randomFlag) {
|
||||||
sysNutritionQuestion.setShowFlag(1);
|
sysNutritionQuestion.setShowFlag(1);
|
||||||
Map<String, Object> result = sysNutritionQuestionService.getNutritionQuestionListByKey(sysNutritionQuestion, pageNum, pageSize);
|
if(randomFlag){
|
||||||
return AjaxResult.success(result);
|
//随机获取指定条数
|
||||||
|
sysNutritionQuestion.setKey(null);
|
||||||
|
List<NutritionQuestionResponse> list = sysNutritionQuestionService.getNutritionQuestionByRandom(sysNutritionQuestion, pageSize);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}else{
|
||||||
|
Map<String, Object> result = sysNutritionQuestionService.getNutritionQuestionListByKey(sysNutritionQuestion, pageNum, pageSize);
|
||||||
|
return AjaxResult.success(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,4 +75,11 @@ public interface SysCustomerCaseMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取指定数量的客户案例
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<CustomerCaseResponse> getWxCustomerCaseByRandom(@Param("pageSize")Integer pageSize);
|
||||||
}
|
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.stdiet.custom.domain.SysNutritionQuestion;
|
import com.stdiet.custom.domain.SysNutritionQuestion;
|
||||||
|
import com.stdiet.custom.dto.response.NutritionQuestionResponse;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,4 +88,12 @@ public interface SysNutritionQuestionMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取指定数量的营养小知识
|
||||||
|
* @param sysNutritionQuestion
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<NutritionQuestionResponse> getNutritionQuestionByRandom(SysNutritionQuestion sysNutritionQuestion, @Param("pageSize")Integer pageSize);
|
||||||
}
|
}
|
@ -82,4 +82,11 @@ public interface ISysCustomerCaseService {
|
|||||||
*/
|
*/
|
||||||
int updateWxShowByIds(Integer wxShow, Long[] ids);
|
int updateWxShowByIds(Integer wxShow, Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取指定数量的客户案例
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<CustomerCaseResponse> getWxCustomerCaseByRandom(Integer pageSize);
|
||||||
|
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysNutritionQuestion;
|
import com.stdiet.custom.domain.SysNutritionQuestion;
|
||||||
|
import com.stdiet.custom.dto.response.NutritionQuestionResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 营养知识小问答Service接口
|
* 营养知识小问答Service接口
|
||||||
@ -81,4 +82,12 @@ public interface ISysNutritionQuestionService
|
|||||||
*/
|
*/
|
||||||
public int updateWxShowByIds(Integer wxShow, Long[] ids);
|
public int updateWxShowByIds(Integer wxShow, Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取指定数量的营养小知识
|
||||||
|
* @param sysNutritionQuestion
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<NutritionQuestionResponse> getNutritionQuestionByRandom(SysNutritionQuestion sysNutritionQuestion, Integer pageSize);
|
||||||
|
|
||||||
}
|
}
|
@ -180,4 +180,14 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
|||||||
public int updateWxShowByIds(Integer wxShow, Long[] ids){
|
public int updateWxShowByIds(Integer wxShow, Long[] ids){
|
||||||
return sysCustomerCaseMapper.updateWxShowByIds(wxShow, ids);
|
return sysCustomerCaseMapper.updateWxShowByIds(wxShow, ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取指定数量的客户案例
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<CustomerCaseResponse> getWxCustomerCaseByRandom(Integer pageSize){
|
||||||
|
return sysCustomerCaseMapper.getWxCustomerCaseByRandom(pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
@ -326,4 +326,14 @@ public class SysNutritionQuestionServiceImpl implements ISysNutritionQuestionSer
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取指定数量的营养小知识
|
||||||
|
* @param sysNutritionQuestion
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<NutritionQuestionResponse> getNutritionQuestionByRandom(SysNutritionQuestion sysNutritionQuestion, Integer pageSize){
|
||||||
|
return sysNutritionQuestionMapper.getNutritionQuestionByRandom(sysNutritionQuestion, pageSize);
|
||||||
|
}
|
||||||
}
|
}
|
@ -154,4 +154,10 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 随机获取指定数量可展示的客户案例 -->
|
||||||
|
<select id="getWxCustomerCaseByRandom" parameterType="int" resultMap="SysCustomerCaseResponseResult">
|
||||||
|
SELECT id, name, keyword, remark, wx_show from sys_customer_case WHERE del_flag = 0 and wx_show = 1
|
||||||
|
and id >= ((SELECT MAX(id) FROM sys_customer_case )-(SELECT MIN(id) FROM sys_customer_case )) * RAND() + (SELECT MIN(id) FROM sys_customer_case) LIMIT #{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -24,7 +24,6 @@
|
|||||||
<result property="title" column="title" />
|
<result property="title" column="title" />
|
||||||
<result property="content" column="content" />
|
<result property="content" column="content" />
|
||||||
<result property="key" column="key" />
|
<result property="key" column="key" />
|
||||||
<result property="key" column="key" />
|
|
||||||
<result property="showFlag" column="show_flag" />
|
<result property="showFlag" column="show_flag" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
@ -127,6 +126,12 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 随机获取指定数量的营养小知识 -->
|
||||||
|
<select id="getNutritionQuestionByRandom" resultMap="SysNutritionQuestionResultExtended">
|
||||||
|
SELECT * FROM sys_nutrition_question WHERE del_flag = 0 and show_flag = 1
|
||||||
|
and id >= ((SELECT MAX(id) FROM sys_nutrition_question )-(SELECT MIN(id) FROM sys_nutrition_question )) * RAND() + (SELECT MIN(id) FROM sys_nutrition_question ) LIMIT #{pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -679,7 +679,8 @@ export default {
|
|||||||
(detailHealthy.tall / 100)
|
(detailHealthy.tall / 100)
|
||||||
).toFixed(1);
|
).toFixed(1);
|
||||||
|
|
||||||
this.detailHealthy = healthyData.dealHealthyExtend(detailHealthy);
|
healthyData.dealHealthyExtend(detailHealthy);
|
||||||
|
this.detailHealthy = detailHealthy;
|
||||||
for (let i = 0; i < this.healthyTitleData.length; i++) {
|
for (let i = 0; i < this.healthyTitleData.length; i++) {
|
||||||
let stepArray = [];
|
let stepArray = [];
|
||||||
for (let j = 0; j < this.healthyTitleData[i].length; j++) {
|
for (let j = 0; j < this.healthyTitleData[i].length; j++) {
|
||||||
@ -750,6 +751,7 @@ export default {
|
|||||||
},
|
},
|
||||||
generateReport() {
|
generateReport() {
|
||||||
let data = this.detailHealthy;
|
let data = this.detailHealthy;
|
||||||
|
console.log(this.detailHealthy);
|
||||||
if (
|
if (
|
||||||
!this.guidanceList[0].guidanceValue ||
|
!this.guidanceList[0].guidanceValue ||
|
||||||
this.guidanceList[0].guidanceValue.length == 0
|
this.guidanceList[0].guidanceValue.length == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user