From 1be9f4c0ce7a4a1119d9c6dc784f8402a1c0c2ad Mon Sep 17 00:00:00 2001 From: xiezhijun <15270898033@163.com> Date: Mon, 4 Jan 2021 20:28:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BD=93=E5=BE=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysCustomerController.java | 40 +- .../stdiet/common/utils/bean/ObjectUtils.java | 2 +- .../request/CustomerInvestigateRequest.java | 2 +- .../dto/response/CustomerListResponse.java | 364 ++++++++++++++++++ .../framework/config/SecurityConfig.java | 3 +- stdiet-ui/src/views/custom/customer/index.vue | 35 +- .../custom/investigate/questionnaire.vue | 14 +- 7 files changed, 430 insertions(+), 30 deletions(-) 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 7c4b4dfc6..43a4b1b53 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 @@ -1,8 +1,15 @@ package com.stdiet.web.controller.custom; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; +import com.stdiet.custom.domain.SysPhysicalSigns; +import org.apache.commons.lang.StringUtils; + +import com.stdiet.common.utils.bean.ObjectUtils; import com.stdiet.custom.dto.request.CustomerInvestigateRequest; +import com.stdiet.custom.dto.response.CustomerListResponse; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -51,13 +58,30 @@ public class SysCustomerController extends BaseController * 导出客户信息列表 */ @PreAuthorize("@ss.hasPermi('custom:customer:export')") - @Log(title = "客户信息", businessType = BusinessType.EXPORT) + @Log(title = "客户体征", businessType = BusinessType.EXPORT) @GetMapping("/export") - public AjaxResult export(SysCustomer sysCustomer) + public AjaxResult export(SysCustomer sysCustomer) throws Exception { - List list = sysCustomerService.selectSysCustomerList(sysCustomer); - ExcelUtil util = new ExcelUtil(SysCustomer.class); - return util.exportExcel(list, "customer"); + List list = sysCustomerService.selectSysCustomerAndSignList(sysCustomer); + List responsesList = new ArrayList<>(); + CustomerListResponse customerListResponse = null; + for (SysCustomer customer : list) { + customerListResponse = ObjectUtils.getObjectByObject(customer.getSign(), CustomerListResponse.class); + customerListResponse.setName(customer.getName()); + customerListResponse.setPhone(customer.getPhone()); + StringBuilder signStr = new StringBuilder(); + if(customer.getSign().getSignList() != null && customer.getSign().getSignList().size() > 0){ + int i = 0; + for (SysPhysicalSigns s : customer.getSign().getSignList()) { + signStr.append((i != 0 ? "," : "") + s.getName()); + i++; + } + } + customerListResponse.setPhysicalSignsId(signStr.toString()); + responsesList.add(customerListResponse); + } + ExcelUtil util = new ExcelUtil(CustomerListResponse.class); + return util.exportExcel(responsesList, "客户体征数据"); } /** @@ -74,7 +98,7 @@ public class SysCustomerController extends BaseController * 新增客户信息 */ @PreAuthorize("@ss.hasPermi('custom:customer:add')") - @Log(title = "客户信息", businessType = BusinessType.INSERT) + @Log(title = "客户体征", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception { @@ -90,7 +114,7 @@ public class SysCustomerController extends BaseController * 修改客户信息 */ @PreAuthorize("@ss.hasPermi('custom:customer:edit')") - @Log(title = "客户信息", businessType = BusinessType.UPDATE) + @Log(title = "客户体征", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception { @@ -109,7 +133,7 @@ public class SysCustomerController extends BaseController * 删除客户信息 */ @PreAuthorize("@ss.hasPermi('custom:customer:remove')") - @Log(title = "客户信息", businessType = BusinessType.DELETE) + @Log(title = "客户体征", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/bean/ObjectUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/bean/ObjectUtils.java index 9a68ba70b..4cae2bb25 100644 --- a/stdiet-common/src/main/java/com/stdiet/common/utils/bean/ObjectUtils.java +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/bean/ObjectUtils.java @@ -58,7 +58,7 @@ public class ObjectUtils { //将指定对象变量上此 Field 对象表示的字段设置为指定的新值 field.set(t, val); }catch (Exception e){ - System.out.println(object.getClass().getName() + "没有该属性: " + field.getName()); + //System.out.println(object.getClass().getName() + "没有该属性: " + field.getName()); } } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/request/CustomerInvestigateRequest.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/request/CustomerInvestigateRequest.java index 828aac761..72976d3f4 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/dto/request/CustomerInvestigateRequest.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/request/CustomerInvestigateRequest.java @@ -4,7 +4,7 @@ import com.stdiet.common.annotation.Excel; import com.stdiet.common.core.domain.BaseEntity; /** - * 客户信息建档调查DTO + * 客户体征信息请求DTO * * @author xzj * @date 2020-12-31 diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerListResponse.java b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerListResponse.java index e69de29bb..deecaf600 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerListResponse.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/dto/response/CustomerListResponse.java @@ -0,0 +1,364 @@ +package com.stdiet.custom.dto.response; + +import com.stdiet.common.annotation.Excel; +import com.stdiet.common.core.domain.BaseEntity; + +/** + * 客户体征信息响应DTO + * + * @author xzj + * @date 2020-12-31 + */ +public class CustomerListResponse extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + //基础信息 + /** $column.columnComment */ + private Long id; + + /** 名字 */ + @Excel(name = "名字") + private String name; + + /** 手机号 */ + @Excel(name = "手机号") + private String phone; + + //体征信息 + /** 客户性别 0男 1女 */ + @Excel(name = "性别", readConverterExp = "0=男,1=女") + private Integer sex; + + /** 客户年龄(岁) */ + @Excel(name = "年龄") + private Integer age; + + /** 客户身高(厘米) */ + @Excel(name = "身高(厘米)") + private Integer tall; + + /** 客户体重(斤) */ + @Excel(name = "体重(斤)") + private Integer weight; + + /** 南方人还是北方人 0南方 1北方 */ + @Excel(name = "北方、南方", readConverterExp = "0=南方,1=北方") + private Integer position; + + /** 客户病史体征id */ + @Excel(name = "病史") + private String physicalSignsId; + + /** 客户忌口不爱吃食材id */ + @Excel(name = "忌口或过敏源") + private String dishesIngredientId; + + /** 是否便秘 0是 1否 */ + @Excel(name = "是否便秘", readConverterExp = "0=是,1=否") + private Integer constipation; + + /** 是否熬夜、失眠 0是 1否 */ + @Excel(name = "是否熬夜失眠", readConverterExp = "0=是,1=否") + private Integer staylate; + + /** 是否经常运动 0是 1否 */ + @Excel(name = "是否经常运动", readConverterExp = "0=是,1=否") + private Integer motion; + + /** 饮食方式 0自己做 1外面吃 */ + @Excel(name = "饮食方式", readConverterExp = "0=自己做,1=外面吃") + private Integer makeFoodType; + + /** 饮食备注 */ + @Excel(name = "饮食备注") + private String remarks; + + /** 饮食特点 0清淡 1重口味 */ + @Excel(name = "饮食特点",readConverterExp = "0=清淡,1=重口味") + private Integer makeFoodTaste; + + /** 工作职业 */ + @Excel(name = "工作职业") + private String vocation; + + /** 是否上夜班 */ + @Excel(name = "是否上夜班", readConverterExp = "0=是,1=否") + private Integer night; + + /** 平时是否久坐 0久坐多 1走动多 */ + @Excel(name = "久坐多还是运动多", readConverterExp = "0=久坐多,1=走动多") + private Integer walk; + + /** 是否浑身乏力 0是 1否 */ + @Excel(name = "是否浑身乏力", readConverterExp = "0=是,1=否") + private Integer weakness; + + /** 是否减脂反弹 0是 1否 */ + @Excel(name = "是否减脂反弹", readConverterExp = "0=是,1=否") + private Integer rebound; + + /** 能否认识到生活习惯的改善才是减脂的关键 0是 1否 */ + @Excel(name = "意识到生活习惯是减脂关键",readConverterExp = "0=是,1=否") + private Integer crux; + + /** 睡觉时间(24小时制) */ + @Excel(name = "睡觉时间", suffix = "点") + private Integer sleepTime; + + /** 起床时间(24小时制) */ + @Excel(name = "起床时间", suffix = "点") + private Integer getupTime; + + /** 联系沟通时间(24小时制) */ + @Excel(name = "方便沟通时间", suffix = "点") + private Integer connectTime; + + /** 湿气数据 */ + @Excel(name = "湿气数据") + private String bloodData; + + /** 气血数据 */ + @Excel(name = "气血数据") + private String moistureDate; + + /** 减脂经历 */ + @Excel(name = "减脂经历") + private String experience; + + /** 减脂过程遇到的困难 */ + @Excel(name = "减脂遇到的困难") + private String difficulty; + + 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 Integer getSex() { + return sex; + } + + public void setSex(Integer sex) { + this.sex = sex; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } + + public Integer getTall() { + return tall; + } + + public void setTall(Integer tall) { + this.tall = tall; + } + + public Integer getWeight() { + return weight; + } + + public void setWeight(Integer weight) { + this.weight = weight; + } + + public Integer getPosition() { + return position; + } + + public void setPosition(Integer position) { + this.position = position; + } + + public String getPhysicalSignsId() { + return physicalSignsId; + } + + public void setPhysicalSignsId(String physicalSignsId) { + this.physicalSignsId = physicalSignsId; + } + + public String getDishesIngredientId() { + return dishesIngredientId; + } + + public void setDishesIngredientId(String dishesIngredientId) { + this.dishesIngredientId = dishesIngredientId; + } + + public Integer getConstipation() { + return constipation; + } + + public void setConstipation(Integer constipation) { + this.constipation = constipation; + } + + public Integer getStaylate() { + return staylate; + } + + public void setStaylate(Integer staylate) { + this.staylate = staylate; + } + + public Integer getMotion() { + return motion; + } + + public void setMotion(Integer motion) { + this.motion = motion; + } + + public Integer getMakeFoodType() { + return makeFoodType; + } + + public void setMakeFoodType(Integer makeFoodType) { + this.makeFoodType = makeFoodType; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Integer getMakeFoodTaste() { + return makeFoodTaste; + } + + public void setMakeFoodTaste(Integer makeFoodTaste) { + this.makeFoodTaste = makeFoodTaste; + } + + public String getVocation() { + return vocation; + } + + public void setVocation(String vocation) { + this.vocation = vocation; + } + + public Integer getNight() { + return night; + } + + public void setNight(Integer night) { + this.night = night; + } + + public Integer getWalk() { + return walk; + } + + public void setWalk(Integer walk) { + this.walk = walk; + } + + public Integer getWeakness() { + return weakness; + } + + public void setWeakness(Integer weakness) { + this.weakness = weakness; + } + + public Integer getRebound() { + return rebound; + } + + public void setRebound(Integer rebound) { + this.rebound = rebound; + } + + public Integer getCrux() { + return crux; + } + + public void setCrux(Integer crux) { + this.crux = crux; + } + + public Integer getSleepTime() { + return sleepTime; + } + + public void setSleepTime(Integer sleepTime) { + this.sleepTime = sleepTime; + } + + public Integer getGetupTime() { + return getupTime; + } + + public void setGetupTime(Integer getupTime) { + this.getupTime = getupTime; + } + + public Integer getConnectTime() { + return connectTime; + } + + public void setConnectTime(Integer connectTime) { + this.connectTime = connectTime; + } + + public String getBloodData() { + return bloodData; + } + + public void setBloodData(String bloodData) { + this.bloodData = bloodData; + } + + public String getMoistureDate() { + return moistureDate; + } + + public void setMoistureDate(String moistureDate) { + this.moistureDate = moistureDate; + } + + public String getExperience() { + return experience; + } + + public void setExperience(String experience) { + this.experience = experience; + } + + public String getDifficulty() { + return difficulty; + } + + public void setDifficulty(String difficulty) { + this.difficulty = difficulty; + } +} \ No newline at end of file diff --git a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java index b53a409d4..c677b63fc 100644 --- a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java +++ b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java @@ -101,8 +101,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/custom/contract/file/**", "/custom/wxUserInfo/wx/**", "/custom/wxUserLog/wx/**", - "/investigate/**", - "/investigate/physicalSignsList" + "/investigate/**" ).anonymous() .antMatchers( HttpMethod.GET, diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue index 2cd8ae986..db5dda54e 100644 --- a/stdiet-ui/src/views/custom/customer/index.vue +++ b/stdiet-ui/src/views/custom/customer/index.vue @@ -46,7 +46,7 @@ v-hasPermi="['custom:customer:edit']" >修改 --> - - + + + 营养体征调查 + @@ -116,6 +122,7 @@ {{scope.row.sign.makeFoodType == 0 ? `自己做` : '外面吃'}} +