建议调查问卷页面以及后台
This commit is contained in:
		| @@ -4,8 +4,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.HealthyUtils; | ||||
| import com.stdiet.common.utils.StringUtils; | ||||
| import com.stdiet.common.utils.sign.AesUtils; | ||||
| import com.stdiet.common.utils.uuid.IdUtils; | ||||
| import com.stdiet.custom.domain.*; | ||||
| import com.stdiet.custom.dto.request.CustomerInvestigateRequest; | ||||
| import com.stdiet.custom.dto.request.FoodHeatCalculatorRequest; | ||||
| @@ -18,6 +20,7 @@ import org.springframework.web.bind.annotation.*; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.UUID; | ||||
|  | ||||
| /** | ||||
|  * 客户相关信息调查Controller | ||||
| @@ -139,6 +142,7 @@ public class InvestigateController extends BaseController { | ||||
|         if(oldSysPreSale != null){ | ||||
|             return AjaxResult.error("已提交过问卷,无法重复提交"); | ||||
|         } | ||||
|         sysPreSaleSurvey.setQuestionType(0); | ||||
|         return toAjax(sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey)); | ||||
|     } | ||||
|  | ||||
| @@ -155,4 +159,21 @@ public class InvestigateController extends BaseController { | ||||
|         SysPreSaleSurvey preSaleSurvey = sysPreSaleSurveyService.getSysPreSaleSurveyByKey(customerKey); | ||||
|         return AjaxResult.success(preSaleSurvey); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 添加用户简易问卷 | ||||
|      */ | ||||
|     @PostMapping("/addSimpleCustomerSurvey") | ||||
|     public AjaxResult addSimpleCustomerSurvey(@RequestBody SysPreSaleSurvey sysPreSaleSurvey) | ||||
|     { | ||||
|         sysPreSaleSurvey.setQuestionType(1); | ||||
|         sysPreSaleSurvey.setCustomerKey(IdUtils.fastSimpleUUID()); | ||||
|         int row = sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey); | ||||
|         if(row > 0){ | ||||
|             //获取标准体重 | ||||
|             Double standardWeight = HealthyUtils.calculateStandardWeightByBMI(sysPreSaleSurvey.getTall(), sysPreSaleSurvey.getAge(), sysPreSaleSurvey.getSex()); | ||||
|             return AjaxResult.success(standardWeight); | ||||
|         } | ||||
|         return AjaxResult.error("提交失败"); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,112 @@ | ||||
| package com.stdiet.web.controller.custom; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.stdiet.common.utils.HealthyUtils; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.PutMapping; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import com.stdiet.common.annotation.Log; | ||||
| import com.stdiet.common.core.controller.BaseController; | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.enums.BusinessType; | ||||
| import com.stdiet.custom.domain.SysPreSaleSurvey; | ||||
| import com.stdiet.custom.service.ISysPreSaleSurveyService; | ||||
| import com.stdiet.common.utils.poi.ExcelUtil; | ||||
| import com.stdiet.common.core.page.TableDataInfo; | ||||
|  | ||||
| /** | ||||
|  * 简易问卷调查Controller | ||||
|  * | ||||
|  * @author xzj | ||||
|  * @date 2021-07-21 | ||||
|  */ | ||||
| @RestController | ||||
| @RequestMapping("/custom/preSaleSurvey") | ||||
| public class SysPreSaleSurveyController extends BaseController | ||||
| { | ||||
|     @Autowired | ||||
|     private ISysPreSaleSurveyService sysPreSaleSurveyService; | ||||
|  | ||||
|     /** | ||||
|      * 查询简易问卷调查列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:list')") | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(SysPreSaleSurvey sysPreSaleSurvey) | ||||
|     { | ||||
|         startPage(); | ||||
|         sysPreSaleSurvey.setQuestionType(1); | ||||
|         List<SysPreSaleSurvey> list = sysPreSaleSurveyService.selectSysPreSaleSurveyList(sysPreSaleSurvey); | ||||
|         if(list != null && list.size() > 0){ | ||||
|             for (SysPreSaleSurvey survey : list) { | ||||
|                 //计算标准体重 | ||||
|                 survey.setStandardWeight(HealthyUtils.calculateStandardWeightByBMI(survey.getTall(), survey.getAge(), survey.getSex())); | ||||
|             } | ||||
|         } | ||||
|         return getDataTable(list); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 导出简易问卷调查列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:export')") | ||||
|     @Log(title = "简易问卷调查", businessType = BusinessType.EXPORT) | ||||
|     @GetMapping("/export") | ||||
|     public AjaxResult export(SysPreSaleSurvey sysPreSaleSurvey) | ||||
|     { | ||||
|         List<SysPreSaleSurvey> list = sysPreSaleSurveyService.selectSysPreSaleSurveyList(sysPreSaleSurvey); | ||||
|         ExcelUtil<SysPreSaleSurvey> util = new ExcelUtil<SysPreSaleSurvey>(SysPreSaleSurvey.class); | ||||
|         return util.exportExcel(list, "preSaleSurvey"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取简易问卷调查详细信息 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:query')") | ||||
|     @GetMapping(value = "/{id}") | ||||
|     public AjaxResult getInfo(@PathVariable("id") Long id) | ||||
|     { | ||||
|         return AjaxResult.success(sysPreSaleSurveyService.selectSysPreSaleSurveyById(id)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 新增简易问卷调查 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:add')") | ||||
|     @Log(title = "简易问卷调查", businessType = BusinessType.INSERT) | ||||
|     @PostMapping | ||||
|     public AjaxResult add(@RequestBody SysPreSaleSurvey sysPreSaleSurvey) | ||||
|     { | ||||
|         return toAjax(sysPreSaleSurveyService.insertSysPreSaleSurvey(sysPreSaleSurvey)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 修改简易问卷调查 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:edit')") | ||||
|     @Log(title = "简易问卷调查", businessType = BusinessType.UPDATE) | ||||
|     @PutMapping | ||||
|     public AjaxResult edit(@RequestBody SysPreSaleSurvey sysPreSaleSurvey) | ||||
|     { | ||||
|         return toAjax(sysPreSaleSurveyService.updateSysPreSaleSurvey(sysPreSaleSurvey)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 删除简易问卷调查 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('custom:preSaleSurvey:remove')") | ||||
|     @Log(title = "简易问卷调查", businessType = BusinessType.DELETE) | ||||
|     @DeleteMapping("/{ids}") | ||||
|     public AjaxResult remove(@PathVariable Long[] ids) | ||||
|     { | ||||
|         return toAjax(sysPreSaleSurveyService.deleteSysPreSaleSurveyByIds(ids)); | ||||
|     } | ||||
| } | ||||
| @@ -507,6 +507,12 @@ public class WechatAppletController extends BaseController { | ||||
|  | ||||
|             sysWxUserInfo.setCusId(sysCustomer.getId()); | ||||
|             sysWxUserInfo.setUpdateTime(DateUtils.getNowDate()); | ||||
|             //先根据cusId查询是否已经绑定过微信用户 | ||||
|             SysWxUserInfo cusIdWxUserInfo = sysWxUserInfoService.selectSysWxUserInfoByCusId(sysCustomer.getId()); | ||||
|             if(cusIdWxUserInfo != null && !sysWxUserInfo.getOpenid().equals(curWxUserInfo.getOpenid())){ | ||||
|                 //解绑之前记录 | ||||
|                 sysWxUserInfoService.removeCusIdByOpenId(curWxUserInfo.getOpenid()); | ||||
|             } | ||||
|             if (StringUtils.isNull(curWxUserInfo)) { | ||||
|                 // 新增sys_wx_user_info | ||||
|                 sysWxUserInfo.setCreateTime(DateUtils.getNowDate()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user