食谱展示界面开发
This commit is contained in:
@ -9,19 +9,15 @@ import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||
import com.stdiet.common.utils.sign.AesUtils;
|
||||
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
|
||||
@ -53,7 +49,7 @@ public class SysCustomerController extends BaseController {
|
||||
for (SysCustomer sysCus : list) {
|
||||
if (StringUtils.isNotEmpty(sysCus.getPhone())) {
|
||||
sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
|
||||
sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId()+"", null) : "");
|
||||
sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId() + "", null) : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,7 +84,7 @@ public class SysCustomerController extends BaseController {
|
||||
@Log(title = "客户档案", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysCustomer sysCustomer) throws Exception {
|
||||
if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){
|
||||
if (!sysCustomerService.isCustomerExistByPhone(sysCustomer)) {
|
||||
return toAjax(sysCustomerService.insertSysCustomer(sysCustomer));
|
||||
}
|
||||
return AjaxResult.error("该手机号客户已存在");
|
||||
@ -101,7 +97,7 @@ public class SysCustomerController extends BaseController {
|
||||
@Log(title = "客户档案", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysCustomer sysCustomer) throws Exception {
|
||||
if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){
|
||||
if (!sysCustomerService.isCustomerExistByPhone(sysCustomer)) {
|
||||
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer));
|
||||
}
|
||||
return AjaxResult.error("该手机号客户已存在");
|
||||
@ -122,51 +118,29 @@ public class SysCustomerController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/getCustomerAndSignByPhone")
|
||||
@PreAuthorize("@ss.hasPermi('custom:customer:query')")
|
||||
public AjaxResult getCustomerAndSignByPhone(@RequestParam("phone")String phone)
|
||||
{
|
||||
public AjaxResult getCustomerAndSignByPhone(@RequestParam("phone") String phone) {
|
||||
SysCustomerPhysicalSigns sysCustomer = null;
|
||||
if(StringUtils.isNotEmpty(phone)){
|
||||
sysCustomer = sysCustomerPhysicalSignsService.selectSysCustomerAndSignByPhone(phone);
|
||||
if (StringUtils.isNotEmpty(phone)) {
|
||||
sysCustomer = sysCustomerPhysicalSignsService.selectSysCustomerAndSignByPhone(phone);
|
||||
}
|
||||
return AjaxResult.success(sysCustomer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户ID获取体征或健康评估信息,优先健康评估信息
|
||||
*
|
||||
* @param id 客户ID
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/physicalSigns/{id}")
|
||||
public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
String key = "customerHealthy";
|
||||
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(key, 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(key, sysCustomerPhysicalSigns);
|
||||
}
|
||||
//对ID进行加密
|
||||
result.put("enc_id", id != null ? AesUtils.encrypt(id+"", null) : "");
|
||||
return AjaxResult.success(result);
|
||||
return AjaxResult.success(sysCustomerService.getPhysicalSignsById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户ID删除对应体征信息或健康评估信息
|
||||
* @param id 客户ID
|
||||
*
|
||||
* @param customerId 客户ID
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/delCustomerHealthy/{id}")
|
||||
|
@ -79,4 +79,5 @@ public class SysRecipesController extends BaseController {
|
||||
public AjaxResult delete(@PathVariable Long id) {
|
||||
return toAjax(sysRecipesService.deleteDishes(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.custom.service.ISysRecipesPlanService;
|
||||
import com.stdiet.custom.service.ISysRecipesService;
|
||||
import com.stdiet.custom.service.ISysWapServices;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wap")
|
||||
public class SysWapController extends BaseController {
|
||||
@Autowired
|
||||
ISysWapServices iSysWapServices;
|
||||
|
||||
@Autowired
|
||||
ISysRecipesService iSysRecipesService;
|
||||
|
||||
/**
|
||||
* 客户食谱详情
|
||||
* @param outId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/recipes/plans/{outId}")
|
||||
public AjaxResult detail(@PathVariable String outId) {
|
||||
return AjaxResult.success(iSysWapServices.getRecipesPlanListInfo(outId));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/healthyInfo/{outId}")
|
||||
public AjaxResult healthy(@PathVariable String outId) {
|
||||
return AjaxResult.success(iSysWapServices.getHealthyDataByOutId(outId));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/recipes/menu/{id}")
|
||||
public AjaxResult dayilyMenu(@PathVariable Long id) {
|
||||
return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(id));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user