diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/common/InvestigateController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/common/InvestigateController.java index 4651865cd..e262c25ba 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/common/InvestigateController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/common/InvestigateController.java @@ -3,6 +3,8 @@ package com.stdiet.web.controller.common; 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.utils.StringUtils; +import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysCustomerHealthy; import com.stdiet.custom.domain.SysPhysicalSigns; @@ -16,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 客户相关信息调查Controller @@ -40,14 +44,18 @@ public class InvestigateController extends BaseController { @Autowired private ISysCustomerHealthyService sysCustomerHealthyService; + @Autowired + private ISysCustomerService sysCustomerService; + /** * 建立客户信息档案 */ @PostMapping("/customerInvestigate") public AjaxResult customerInvestigate(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception { - customerInvestigateRequest.setId(null); //只能添加,无法修改 - return sysCustomerPhysicalSignsService.addOrupdateCustomerAndSign(customerInvestigateRequest); + return AjaxResult.error("请填写新版健康评估表"); + //customerInvestigateRequest.setId(null); //只能添加,无法修改 + //return sysCustomerPhysicalSignsService.addOrupdateCustomerAndSign(customerInvestigateRequest); } /** @@ -70,13 +78,33 @@ public class InvestigateController extends BaseController { return AjaxResult.success(dictTypeService.selectDictDataByType(dictType)); } + /** + * 根据加密ID获取客户基本信息 + * @param enc_id + * @return + */ + @GetMapping("/getCustomerBaseMessage/{id}") + public AjaxResult getCustomerBaseMessage(@PathVariable(value = "id") String enc_id){ + String id = StringUtils.isEmpty(enc_id) ? "" : AesUtils.decrypt(enc_id, null); + if(StringUtils.isNotEmpty(id)){ + SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(Long.parseLong(id)); + if(sysCustomer != null){ + Map result = new HashMap<>(); + result.put("name", sysCustomer.getName()); + result.put("phone", sysCustomer.getPhone()); + return AjaxResult.success(result); + } + } + return AjaxResult.success(); + } + /** * 新增客户健康 */ @PostMapping("/addCustomerHealthy") public AjaxResult addCustomerHealthy(@RequestBody SysCustomerHealthy sysCustomerHealthy) { - return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy); + return sysCustomerHealthyService.insertSysCustomerHealthy(sysCustomerHealthy); } } 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 e2c52cfd0..e559be4f7 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 @@ -7,6 +7,7 @@ import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.enums.BusinessType; 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; @@ -86,7 +87,10 @@ public class SysCustomerController extends BaseController { @Log(title = "客户档案", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysCustomer sysCustomer) throws Exception { - return toAjax(sysCustomerService.insertSysCustomer(sysCustomer)); + if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){ + return toAjax(sysCustomerService.insertSysCustomer(sysCustomer)); + } + return AjaxResult.error("该手机号客户已存在"); } /** @@ -96,7 +100,10 @@ public class SysCustomerController extends BaseController { @Log(title = "客户档案", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysCustomer sysCustomer) throws Exception { - return toAjax(sysCustomerService.updateSysCustomer(sysCustomer)); + if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){ + return toAjax(sysCustomerService.updateSysCustomer(sysCustomer)); + } + return AjaxResult.error("该手机号客户已存在"); } /** @@ -131,6 +138,7 @@ public class SysCustomerController extends BaseController { @GetMapping("/physicalSigns/{id}") public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) { Map result = new HashMap<>(); + String key = "customerHealthy"; result.put("type", 0); //查询健康评估信息 SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id); @@ -138,7 +146,7 @@ public class SysCustomerController extends BaseController { if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) { sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone())); } - result.put("customerHealthy", sysCustomerHealthy); + result.put(key, sysCustomerHealthy); }else{ //查询体征信息 SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id); @@ -148,8 +156,22 @@ public class SysCustomerController extends BaseController { } result.put("type", 1); } - result.put("customerHealthy", sysCustomerPhysicalSigns); + result.put(key, sysCustomerPhysicalSigns); } + //对ID进行加密 + result.put("enc_id", id != null ? AesUtils.encrypt(id+"", null) : ""); return AjaxResult.success(result); } + + /** + * 根据客户ID删除对应体征信息或健康评估信息 + * @param id 客户ID + * @return + */ + @GetMapping("/delCustomerHealthy/{id}") + public AjaxResult delCustomerHealthy(@PathVariable("id") Long customerId) { + int signRow = sysCustomerPhysicalSignsService.delCustomerSignByCustomerId(customerId); + int healthyRow = sysCustomerHealthyService.deleteCustomerHealthyByCustomerId(customerId); + return toAjax(signRow + healthyRow); + } } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java index 5c74ad5d3..ba3e78ea1 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerHealthyController.java @@ -85,7 +85,7 @@ public class SysCustomerHealthyController extends BaseController @PostMapping public AjaxResult add(@RequestBody SysCustomerHealthy sysCustomerHealthy) { - return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy); + return AjaxResult.success(); } /** @@ -96,7 +96,7 @@ public class SysCustomerHealthyController extends BaseController @PutMapping public AjaxResult edit(@RequestBody SysCustomerHealthy sysCustomerHealthy) { - return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy); + return AjaxResult.success(); } /** diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/sign/AesUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/sign/AesUtils.java new file mode 100644 index 000000000..28ff51491 --- /dev/null +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/sign/AesUtils.java @@ -0,0 +1,95 @@ +package com.stdiet.common.utils.sign; + +import org.apache.commons.codec.binary.Hex; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import java.security.SecureRandom; + +/** + * AES加密工具类 + */ +public class AesUtils { + + private static final String KEY_ALGORITHM = "AES"; + private static final int KEYSIZE = 128; //AES密钥长度 + private static final String DEFAULT_CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding"; //默认的加密算法 + private static final String DEFAULT_KEY = "Yhokm#876OTG!c"; + + /** + * AES 加密操作 + * @param content 待加密内容 + * @param key 加密密码 + * @return 返回Base64转码后的加密数据 + */ + public static String encrypt(String content, String key) { + key = key == null ? DEFAULT_KEY : key; + try { + Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);// 创建密码器 + + byte[] byteContent = content.getBytes("utf-8"); + + cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(key)); // 初始化为加密模式的密码器 + + byte[] result = cipher.doFinal(byteContent); // 加密 + + return Hex.encodeHexString(result); + //return Base64Utils.encodeToString(result); //通过Base64转码返回 + } catch (Exception ex) { + ex.printStackTrace(); + } + + return null; + } + + /** + * AES 解密操作 + * @param content + * @param key + * @return + */ + public static String decrypt(String content, String key) { + key = key == null ? DEFAULT_KEY : key; + try { + //实例化 + Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM); + + //使用密钥初始化,设置为解密模式 + cipher.init(Cipher.DECRYPT_MODE, getSecretKey(key)); + + //执行操作 + byte[] result = cipher.doFinal(Hex.decodeHex(content));//Base64Utils.decodeFromString(content) + + return new String(result, "utf-8"); + } catch (Exception ex) { + ex.printStackTrace(); + } + + return null; + } + + /** + * 生成加密秘钥 + * + * @return + */ + private static SecretKeySpec getSecretKey(String key) { + //返回生成指定算法密钥生成器的 KeyGenerator 对象 + KeyGenerator kg = null; + try { + kg = KeyGenerator.getInstance(KEY_ALGORITHM); + SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); + random.setSeed(key.getBytes()); + //AES 要求密钥长度为 128 + kg.init(KEYSIZE, random); + //生成一个密钥 + SecretKey secretKey = kg.generateKey(); + return new SecretKeySpec(secretKey.getEncoded(), KEY_ALGORITHM);// 转换为AES专用密钥 + } catch (Exception ex) { + ex.printStackTrace(); + } + return null; + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java index 2734f2107..bac140cd5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerHealthy.java @@ -1,7 +1,6 @@ package com.stdiet.custom.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; +import lombok.Data; import com.stdiet.common.annotation.Excel; import com.stdiet.common.core.domain.BaseEntity; @@ -13,6 +12,7 @@ import java.util.List; * @author xzj * @date 2021-01-23 */ +@Data public class SysCustomerHealthy extends BaseEntity { private static final long serialVersionUID = 1L; @@ -24,6 +24,9 @@ public class SysCustomerHealthy extends BaseEntity //@Excel(name = "客户ID") private Long customerId; + /** 加密的客户ID,非持久化字段 **/ + private String customerEncId; + /** 客户姓名,非持久化字段 */ @Excel(name = "客户姓名") private String name; @@ -432,1029 +435,4 @@ public class SysCustomerHealthy extends BaseEntity /** 删除标识 0未删除 1已删除。默认0 */ private Long delFlag; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setCustomerId(Long customerId) - { - this.customerId = customerId; - } - - public Long getCustomerId() - { - return customerId; - } - public void setConditioningProjectId(Long conditioningProjectId) - { - this.conditioningProjectId = conditioningProjectId; - } - - public Long getConditioningProjectId() - { - return conditioningProjectId; - } - public void setSex(Long sex) - { - this.sex = sex; - } - - public Long getSex() - { - return sex; - } - public void setAge(Long age) - { - this.age = age; - } - - public Long getAge() - { - return age; - } - public void setCondiment(String condiment) - { - this.condiment = condiment; - } - - public String getCondiment() - { - return condiment; - } - public void setOtherCondiment(String otherCondiment) - { - this.otherCondiment = otherCondiment; - } - - public String getOtherCondiment() - { - return otherCondiment; - } - public void setCookingStyle(String cookingStyle) - { - this.cookingStyle = cookingStyle; - } - - public String getCookingStyle() - { - return cookingStyle; - } - public void setCookingStyleRate(String cookingStyleRate) - { - this.cookingStyleRate = cookingStyleRate; - } - - public String getCookingStyleRate() - { - return cookingStyleRate; - } - public void setWashVegetablesStyle(String washVegetablesStyle) - { - this.washVegetablesStyle = washVegetablesStyle; - } - - public String getWashVegetablesStyle() - { - return washVegetablesStyle; - } - public void setOtherWashVegetablesStyle(String otherWashVegetablesStyle) - { - this.otherWashVegetablesStyle = otherWashVegetablesStyle; - } - - public String getOtherWashVegetablesStyle() - { - return otherWashVegetablesStyle; - } - public void setBreakfastType(String breakfastType) - { - this.breakfastType = breakfastType; - } - - public String getBreakfastType() - { - return breakfastType; - } - public void setBreakfastFood(String breakfastFood) - { - this.breakfastFood = breakfastFood; - } - - public String getBreakfastFood() - { - return breakfastFood; - } - public void setLunchType(String lunchType) - { - this.lunchType = lunchType; - } - - public String getLunchType() - { - return lunchType; - } - public void setDinner(String dinner) - { - this.dinner = dinner; - } - - public String getDinner() - { - return dinner; - } - public void setVegetableRate(Long vegetableRate) - { - this.vegetableRate = vegetableRate; - } - - public Long getVegetableRate() - { - return vegetableRate; - } - public void setCommonMeat(String commonMeat) - { - this.commonMeat = commonMeat; - } - - public String getCommonMeat() - { - return commonMeat; - } - public void setDinnerTime(String dinnerTime) - { - this.dinnerTime = dinnerTime; - } - - public String getDinnerTime() - { - return dinnerTime; - } - public void setSupperNum(Long supperNum) - { - this.supperNum = supperNum; - } - - public Long getSupperNum() - { - return supperNum; - } - public void setSupperFood(String supperFood) - { - this.supperFood = supperFood; - } - - public String getSupperFood() - { - return supperFood; - } - public void setDietHotAndCold(String dietHotAndCold) - { - this.dietHotAndCold = dietHotAndCold; - } - - public String getDietHotAndCold() - { - return dietHotAndCold; - } - public void setDietFlavor(String dietFlavor) - { - this.dietFlavor = dietFlavor; - } - - public String getDietFlavor() - { - return dietFlavor; - } - public void setVegetablesNum(Long vegetablesNum) - { - this.vegetablesNum = vegetablesNum; - } - - public Long getVegetablesNum() - { - return vegetablesNum; - } - public void setVegetablesRateType(String vegetablesRateType) - { - this.vegetablesRateType = vegetablesRateType; - } - - public String getVegetablesRateType() - { - return vegetablesRateType; - } - public void setFruitsNum(Long fruitsNum) - { - this.fruitsNum = fruitsNum; - } - - public Long getFruitsNum() - { - return fruitsNum; - } - public void setFruitsTime(String fruitsTime) - { - this.fruitsTime = fruitsTime; - } - - public String getFruitsTime() - { - return fruitsTime; - } - public void setFruitsRate(String fruitsRate) - { - this.fruitsRate = fruitsRate; - } - - public String getFruitsRate() - { - return fruitsRate; - } - public void setRiceNum(Long riceNum) - { - this.riceNum = riceNum; - } - - public Long getRiceNum() - { - return riceNum; - } - public void setRiceFull(Long riceFull) - { - this.riceFull = riceFull; - } - - public Long getRiceFull() - { - return riceFull; - } - public void setEatingSpeed(String eatingSpeed) - { - this.eatingSpeed = eatingSpeed; - } - - public String getEatingSpeed() - { - return eatingSpeed; - } - public void setSnacks(String snacks) - { - this.snacks = snacks; - } - - public String getSnacks() - { - return snacks; - } - public void setOtherSnacks(String otherSnacks) - { - this.otherSnacks = otherSnacks; - } - - public String getOtherSnacks() - { - return otherSnacks; - } - public void setHealthProductsFlag(Long healthProductsFlag) - { - this.healthProductsFlag = healthProductsFlag; - } - - public Long getHealthProductsFlag() - { - return healthProductsFlag; - } - public void setHealthProductsBrand(String healthProductsBrand) - { - this.healthProductsBrand = healthProductsBrand; - } - - public String getHealthProductsBrand() - { - return healthProductsBrand; - } - public void setHealthProductsName(String healthProductsName) - { - this.healthProductsName = healthProductsName; - } - - public String getHealthProductsName() - { - return healthProductsName; - } - public void setHealthProductsWeekRate(Long healthProductsWeekRate) - { - this.healthProductsWeekRate = healthProductsWeekRate; - } - - public Long getHealthProductsWeekRate() - { - return healthProductsWeekRate; - } - public void setHealthProductsDayRate(Long healthProductsDayRate) - { - this.healthProductsDayRate = healthProductsDayRate; - } - - public Long getHealthProductsDayRate() - { - return healthProductsDayRate; - } - public void setWaterNum(Long waterNum) - { - this.waterNum = waterNum; - } - - public Long getWaterNum() - { - return waterNum; - } - public void setWaterType(String waterType) - { - this.waterType = waterType; - } - - public String getWaterType() - { - return waterType; - } - public void setWaterHabit(String waterHabit) - { - this.waterHabit = waterHabit; - } - - public String getWaterHabit() - { - return waterHabit; - } - public void setDrinksNum(String drinksNum) - { - this.drinksNum = drinksNum; - } - - public String getDrinksNum() - { - return drinksNum; - } - public void setDrinkWineFlag(String drinkWineFlag) - { - this.drinkWineFlag = drinkWineFlag; - } - - public String getDrinkWineFlag() - { - return drinkWineFlag; - } - public void setDrinkWineClassify(String drinkWineClassify) - { - this.drinkWineClassify = drinkWineClassify; - } - - public String getDrinkWineClassify() - { - return drinkWineClassify; - } - public void setOtherWineClassify(String otherWineClassify) - { - this.otherWineClassify = otherWineClassify; - } - - public String getOtherWineClassify() - { - return otherWineClassify; - } - public void setDrinkWineAmount(String drinkWineAmount) - { - this.drinkWineAmount = drinkWineAmount; - } - - public String getDrinkWineAmount() - { - return drinkWineAmount; - } - public void setSmokeFlag(Long smokeFlag) - { - this.smokeFlag = smokeFlag; - } - - public Long getSmokeFlag() - { - return smokeFlag; - } - public void setSmokeRate(String smokeRate) - { - this.smokeRate = smokeRate; - } - - public String getSmokeRate() - { - return smokeRate; - } - public void setSecondSmoke(Long secondSmoke) - { - this.secondSmoke = secondSmoke; - } - - public Long getSecondSmoke() - { - return secondSmoke; - } - public void setWorkIndustry(String workIndustry) - { - this.workIndustry = workIndustry; - } - - public String getWorkIndustry() - { - return workIndustry; - } - public void setWorkType(String workType) - { - this.workType = workType; - } - - public String getWorkType() - { - return workType; - } - public void setDefecationNum(String defecationNum) - { - this.defecationNum = defecationNum; - } - - public String getDefecationNum() - { - return defecationNum; - } - public void setOtherDefecationNum(Long otherDefecationNum) - { - this.otherDefecationNum = otherDefecationNum; - } - - public Long getOtherDefecationNum() - { - return otherDefecationNum; - } - public void setDefecationTime(String defecationTime) - { - this.defecationTime = defecationTime; - } - - public String getDefecationTime() - { - return defecationTime; - } - public void setDefecationShape(String defecationShape) - { - this.defecationShape = defecationShape; - } - - public String getDefecationShape() - { - return defecationShape; - } - public void setDefecationSmell(String defecationSmell) - { - this.defecationSmell = defecationSmell; - } - - public String getDefecationSmell() - { - return defecationSmell; - } - public void setDefecationSpeed(String defecationSpeed) - { - this.defecationSpeed = defecationSpeed; - } - - public String getDefecationSpeed() - { - return defecationSpeed; - } - public void setDefecationColor(String defecationColor) - { - this.defecationColor = defecationColor; - } - - public String getDefecationColor() - { - return defecationColor; - } - public void setMotionNum(Long motionNum) - { - this.motionNum = motionNum; - } - - public Long getMotionNum() - { - return motionNum; - } - public void setMotionDuration(Long motionDuration) - { - this.motionDuration = motionDuration; - } - - public Long getMotionDuration() - { - return motionDuration; - } - public void setMotionTime(String motionTime) - { - this.motionTime = motionTime; - } - - public String getMotionTime() - { - return motionTime; - } - public void setAerobicMotionClassify(String aerobicMotionClassify) - { - this.aerobicMotionClassify = aerobicMotionClassify; - } - - public String getAerobicMotionClassify() - { - return aerobicMotionClassify; - } - public void setAnaerobicMotionClassify(String anaerobicMotionClassify) - { - this.anaerobicMotionClassify = anaerobicMotionClassify; - } - - public String getAnaerobicMotionClassify() - { - return anaerobicMotionClassify; - } - public void setAnaerobicAerobicMotionClassify(String anaerobicAerobicMotionClassify) - { - this.anaerobicAerobicMotionClassify = anaerobicAerobicMotionClassify; - } - - public String getAnaerobicAerobicMotionClassify() - { - return anaerobicAerobicMotionClassify; - } - public void setOtherMotionClassify(String otherMotionClassify) - { - this.otherMotionClassify = otherMotionClassify; - } - - public String getOtherMotionClassify() - { - return otherMotionClassify; - } - public void setMotionField(String motionField) - { - this.motionField = motionField; - } - - public String getMotionField() - { - return motionField; - } - public void setOtherMotionField(String otherMotionField) - { - this.otherMotionField = otherMotionField; - } - - public String getOtherMotionField() - { - return otherMotionField; - } - public void setSleepTime(String sleepTime) - { - this.sleepTime = sleepTime; - } - - public String getSleepTime() - { - return sleepTime; - } - public void setSleepQuality(String sleepQuality) - { - this.sleepQuality = sleepQuality; - } - - public String getSleepQuality() - { - return sleepQuality; - } - public void setSleepDrugFlag(Long sleepDrugFlag) - { - this.sleepDrugFlag = sleepDrugFlag; - } - - public Long getSleepDrugFlag() - { - return sleepDrugFlag; - } - public void setSleepDrug(String sleepDrug) - { - this.sleepDrug = sleepDrug; - } - - public String getSleepDrug() - { - return sleepDrug; - } - public void setStayupLateFlag(Long stayupLateFlag) - { - this.stayupLateFlag = stayupLateFlag; - } - - public Long getStayupLateFlag() - { - return stayupLateFlag; - } - public void setStayupLateWeekNum(Long stayupLateWeekNum) - { - this.stayupLateWeekNum = stayupLateWeekNum; - } - - public Long getStayupLateWeekNum() - { - return stayupLateWeekNum; - } - public void setFamilyIllnessHistory(String familyIllnessHistory) - { - this.familyIllnessHistory = familyIllnessHistory; - } - - public String getFamilyIllnessHistory() - { - return familyIllnessHistory; - } - public void setOtherFamilyIllnessHistory(String otherFamilyIllnessHistory) - { - this.otherFamilyIllnessHistory = otherFamilyIllnessHistory; - } - - public String getOtherFamilyIllnessHistory() - { - return otherFamilyIllnessHistory; - } - public void setOperationHistory(String operationHistory) - { - this.operationHistory = operationHistory; - } - - public String getOperationHistory() - { - return operationHistory; - } - public void setOtherOperationHistory(String otherOperationHistory) - { - this.otherOperationHistory = otherOperationHistory; - } - - public String getOtherOperationHistory() - { - return otherOperationHistory; - } - public void setNearOperationFlag(Long nearOperationFlag) - { - this.nearOperationFlag = nearOperationFlag; - } - - public Long getNearOperationFlag() - { - return nearOperationFlag; - } - public void setRecoveryeSituation(String recoveryeSituation) - { - this.recoveryeSituation = recoveryeSituation; - } - - public String getRecoveryeSituation() - { - return recoveryeSituation; - } - public void setLongEatDrugFlag(Long longEatDrugFlag) - { - this.longEatDrugFlag = longEatDrugFlag; - } - - public Long getLongEatDrugFlag() - { - return longEatDrugFlag; - } - public void setLongEatDrugClassify(String longEatDrugClassify) - { - this.longEatDrugClassify = longEatDrugClassify; - } - - public String getLongEatDrugClassify() - { - return longEatDrugClassify; - } - public void setOtherLongEatDrugClassify(String otherLongEatDrugClassify) - { - this.otherLongEatDrugClassify = otherLongEatDrugClassify; - } - - public String getOtherLongEatDrugClassify() - { - return otherLongEatDrugClassify; - } - public void setAllergyFlag(Long allergyFlag) - { - this.allergyFlag = allergyFlag; - } - - public Long getAllergyFlag() - { - return allergyFlag; - } - public void setAllergySituation(String allergySituation) - { - this.allergySituation = allergySituation; - } - - public String getAllergySituation() - { - return allergySituation; - } - public void setAllergen(String allergen) - { - this.allergen = allergen; - } - - public String getAllergen() - { - return allergen; - } - public void setOtherAllergen(String otherAllergen) - { - this.otherAllergen = otherAllergen; - } - - public String getOtherAllergen() - { - return otherAllergen; - } - public void setMedicalReport(String medicalReport) - { - this.medicalReport = medicalReport; - } - - public String getMedicalReport() - { - return medicalReport; - } - public void setDelFlag(Long delFlag) - { - this.delFlag = delFlag; - } - - public Long getDelFlag() - { - return delFlag; - } - - 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 String getConditioningProject() { - return conditioningProject; - } - - public void setConditioningProject(String conditioningProject) { - this.conditioningProject = conditioningProject; - } - - public Long getWeight() { - return weight; - } - - public void setWeight(Long weight) { - this.weight = weight; - } - - public String getMedicalReportName() { - return medicalReportName; - } - - public void setMedicalReportName(String medicalReportName) { - this.medicalReportName = medicalReportName; - } - - public Integer getPosition() { - return position; - } - - public void setPosition(Integer position) { - this.position = position; - } - - public String getExperience() { - return experience; - } - - public void setExperience(String experience) { - this.experience = experience; - } - - public Integer getRebound() { - return rebound; - } - - public void setRebound(Integer rebound) { - this.rebound = rebound; - } - - public String getDifficulty() { - return difficulty; - } - - public void setDifficulty(String difficulty) { - this.difficulty = difficulty; - } - - public Integer getCrux() { - return crux; - } - - public void setCrux(Integer crux) { - this.crux = crux; - } - - public String getDishesIngredient() { - return dishesIngredient; - } - - public void setDishesIngredient(String dishesIngredient) { - this.dishesIngredient = dishesIngredient; - } - - public Long getMakeFoodType() { - return makeFoodType; - } - - public void setMakeFoodType(Long makeFoodType) { - this.makeFoodType = makeFoodType; - } - - public Integer getTall() { - return tall; - } - - public void setTall(Integer tall) { - this.tall = tall; - } - - public String getPhysicalSignsId() { - return physicalSignsId; - } - - public void setPhysicalSignsId(String physicalSignsId) { - this.physicalSignsId = physicalSignsId; - } - - public List getSignList() { - return signList; - } - - public void setSignList(List signList) { - this.signList = signList; - } - - public String getOtherPhysicalSigns() { - return otherPhysicalSigns; - } - - public void setOtherPhysicalSigns(String otherPhysicalSigns) { - this.otherPhysicalSigns = otherPhysicalSigns; - } - - 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; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("customerId", getCustomerId()) - .append("conditioningProjectId", getConditioningProjectId()) - .append("sex", getSex()) - .append("age", getAge()) - .append("condiment", getCondiment()) - .append("otherCondiment", getOtherCondiment()) - .append("cookingStyle", getCookingStyle()) - .append("cookingStyleRate", getCookingStyleRate()) - .append("washVegetablesStyle", getWashVegetablesStyle()) - .append("otherWashVegetablesStyle", getOtherWashVegetablesStyle()) - .append("breakfastType", getBreakfastType()) - .append("breakfastFood", getBreakfastFood()) - .append("lunchType", getLunchType()) - .append("dinner", getDinner()) - .append("vegetableRate", getVegetableRate()) - .append("commonMeat", getCommonMeat()) - .append("dinnerTime", getDinnerTime()) - .append("supperNum", getSupperNum()) - .append("supperFood", getSupperFood()) - .append("dietHotAndCold", getDietHotAndCold()) - .append("dietFlavor", getDietFlavor()) - .append("vegetablesNum", getVegetablesNum()) - .append("vegetablesRateType", getVegetablesRateType()) - .append("fruitsNum", getFruitsNum()) - .append("fruitsTime", getFruitsTime()) - .append("fruitsRate", getFruitsRate()) - .append("riceNum", getRiceNum()) - .append("riceFull", getRiceFull()) - .append("eatingSpeed", getEatingSpeed()) - .append("snacks", getSnacks()) - .append("otherSnacks", getOtherSnacks()) - .append("healthProductsFlag", getHealthProductsFlag()) - .append("healthProductsBrand", getHealthProductsBrand()) - .append("healthProductsName", getHealthProductsName()) - .append("healthProductsWeekRate", getHealthProductsWeekRate()) - .append("healthProductsDayRate", getHealthProductsDayRate()) - .append("waterNum", getWaterNum()) - .append("waterType", getWaterType()) - .append("waterHabit", getWaterHabit()) - .append("drinksNum", getDrinksNum()) - .append("drinkWineFlag", getDrinkWineFlag()) - .append("drinkWineClassify", getDrinkWineClassify()) - .append("otherWineClassify", getOtherWineClassify()) - .append("drinkWineAmount", getDrinkWineAmount()) - .append("smokeFlag", getSmokeFlag()) - .append("smokeRate", getSmokeRate()) - .append("secondSmoke", getSecondSmoke()) - .append("workIndustry", getWorkIndustry()) - .append("workType", getWorkType()) - .append("defecationNum", getDefecationNum()) - .append("otherDefecationNum", getOtherDefecationNum()) - .append("defecationTime", getDefecationTime()) - .append("defecationShape", getDefecationShape()) - .append("defecationSmell", getDefecationSmell()) - .append("defecationSpeed", getDefecationSpeed()) - .append("defecationColor", getDefecationColor()) - .append("motionNum", getMotionNum()) - .append("motionDuration", getMotionDuration()) - .append("motionTime", getMotionTime()) - .append("aerobicMotionClassify", getAerobicMotionClassify()) - .append("anaerobicMotionClassify", getAnaerobicMotionClassify()) - .append("anaerobicAerobicMotionClassify", getAnaerobicAerobicMotionClassify()) - .append("otherMotionClassify", getOtherMotionClassify()) - .append("motionField", getMotionField()) - .append("otherMotionField", getOtherMotionField()) - .append("sleepTime", getSleepTime()) - .append("sleepQuality", getSleepQuality()) - .append("sleepDrugFlag", getSleepDrugFlag()) - .append("sleepDrug", getSleepDrug()) - .append("stayupLateFlag", getStayupLateFlag()) - .append("stayupLateWeekNum", getStayupLateWeekNum()) - .append("familyIllnessHistory", getFamilyIllnessHistory()) - .append("otherFamilyIllnessHistory", getOtherFamilyIllnessHistory()) - .append("operationHistory", getOperationHistory()) - .append("otherOperationHistory", getOtherOperationHistory()) - .append("nearOperationFlag", getNearOperationFlag()) - .append("recoveryeSituation", getRecoveryeSituation()) - .append("longEatDrugFlag", getLongEatDrugFlag()) - .append("longEatDrugClassify", getLongEatDrugClassify()) - .append("otherLongEatDrugClassify", getOtherLongEatDrugClassify()) - .append("allergyFlag", getAllergyFlag()) - .append("allergySituation", getAllergySituation()) - .append("allergen", getAllergen()) - .append("otherAllergen", getOtherAllergen()) - .append("medicalReport", getMedicalReport()) - .append("createTime", getCreateTime()) - .append("createBy", getCreateBy()) - .append("updateTime", getUpdateTime()) - .append("updateBy", getUpdateBy()) - .append("delFlag", getDelFlag()) - .toString(); - } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java index 35b2c21cd..c60456991 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerHealthyMapper.java @@ -72,4 +72,11 @@ public interface SysCustomerHealthyMapper * 根据客户ID查询健康评估表信息 */ SysCustomerHealthy selectSysCustomerHealthyByCustomerId(@Param("customerId")Long customerId); + + /** + * 根据客户ID删除客户健康评估信息 + * @param customerId + * @return + */ + int deleteCustomerHealthyByCustomerId(@Param("customerId")Long customerId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerPhysicalSignsMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerPhysicalSignsMapper.java index e724a85ea..38a1a90c3 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerPhysicalSignsMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerPhysicalSignsMapper.java @@ -66,4 +66,11 @@ public interface SysCustomerPhysicalSignsMapper * @return */ SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone); + + /** + * 根据客户ID删除对应体征信息 + * @param customerId + * @return + */ + int delCustomerSignByCustomerId(@Param("customerId")Long customerId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java index 1ae261f20..3782af713 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderMapper.java @@ -2,6 +2,9 @@ package com.stdiet.custom.mapper; import java.math.BigDecimal; import java.util.List; + +import com.stdiet.custom.domain.SysCommision; +import com.stdiet.custom.domain.SysCommissionDayDetail; import com.stdiet.custom.domain.SysOrder; import org.apache.ibatis.annotations.Param; @@ -72,5 +75,5 @@ public interface SysOrderMapper * 获取订单信息 * @return */ - List selectSimpleOrderMessage(@Param("userId") Long userId); + List selectSimpleOrderMessage(SysCommision sysCommision); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java index 9896c98a6..def3df440 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerHealthyService.java @@ -31,13 +31,21 @@ public interface ISysCustomerHealthyService public List selectSysCustomerHealthyList(SysCustomerHealthy sysCustomerHealthy); /** - * 新增或修改客户健康 + * 新增或修改客户健康(已弃用) * * @param sysCustomerHealthy 客户健康 * @return 结果 */ public AjaxResult insertOrUpdateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy); + /** + * 新增客户健康 + * + * @param sysCustomerHealthy 客户健康 + * @return 结果 + */ + public AjaxResult insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy); + /** * 批量删除客户健康 * @@ -64,4 +72,11 @@ public interface ISysCustomerHealthyService * 根据客户ID查询健康评估表信息 */ SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId); + + /** + * 根据客户ID删除客户健康评估信息 + * @param customerId + * @return + */ + int deleteCustomerHealthyByCustomerId(Long customerId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java index ba14b6e17..368c82b55 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerPhysicalSignsService.java @@ -6,6 +6,7 @@ import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysCustomerPhysicalSigns; import com.stdiet.custom.dto.request.CustomerInvestigateRequest; +import org.apache.ibatis.annotations.Param; /** * 客户体征信息Service接口 @@ -84,4 +85,11 @@ public interface ISysCustomerPhysicalSignsService { */ SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone); + /** + * 根据客户ID删除对应体征信息 + * @param customerId + * @return + */ + int delCustomerSignByCustomerId(Long customerId); + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java index 213a46ac2..fae82ddcd 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java @@ -67,4 +67,11 @@ public interface ISysCustomerService * @return 结果 */ SysCustomer getCustomerByPhone(String phone); + + /** + * 判断客户手机号是否已存在 + * @param sysCustomer + * @return + */ + boolean isCustomerExistByPhone(SysCustomer sysCustomer); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java index ef26782ec..25f6520f3 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCommissionDayServiceImpl.java @@ -40,7 +40,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { total.setTotalNotSentCommissionAmount(new BigDecimal(0)); total.setNextMonthCommission(new BigDecimal(0)); if(list != null && list.size() > 0){ - Map> orderDetailMap = getOrderByList(sysCommision.getUserId()); + Map> orderDetailMap = getOrderByList(sysCommision); SysCommissionDayDetail sysCommissionDayDetail = null; for(SysCommision commision : list){ sysCommissionDayDetail = new SysCommissionDayDetail(); @@ -232,9 +232,9 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService { /** * 查询2021年1月份之后所有订单,对订单进行处理,得出每笔订单的相关信息 * */ - public Map> getOrderByList(Long userId){ + public Map> getOrderByList(SysCommision sysCommision){ //查询2021年1月份之后所有订单 - List orderList = sysOrderMapper.selectSimpleOrderMessage(userId); + List orderList = sysOrderMapper.selectSimpleOrderMessage(sysCommision); //整理出每个用户对应的订单List Map> userOrderResultMap = new HashMap<>(); for (SysOrder sysOrder : orderList) { diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java index 0a76e826a..959830ab9 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerHealthyServiceImpl.java @@ -3,7 +3,9 @@ package com.stdiet.custom.service.impl; import java.util.List; import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.bean.ObjectUtils; +import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.domain.SysCustomerPhysicalSigns; import com.stdiet.custom.service.ISysCustomerService; @@ -53,7 +55,7 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService } /** - * 新增客户健康 + * 新增客户健康(已弃用) * * @param sysCustomerHealthy 客户健康 * @return 结果 @@ -119,6 +121,34 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService return rows > 0 ? AjaxResult.success() : AjaxResult.error(); } + /** + * 新增客户健康 + * + * @param sysCustomerHealthy 客户健康 + * @return 结果 + */ + public AjaxResult insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy){ + //客户ID解密 + String customerId = StringUtils.isNotEmpty(sysCustomerHealthy.getCustomerEncId()) ? AesUtils.decrypt(sysCustomerHealthy.getCustomerEncId(), null) : ""; + if(StringUtils.isEmpty(customerId)){ + return AjaxResult.error("客户不存在"); + } + //判断客户是否存在 + SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(Long.parseLong(customerId)); + if(sysCustomer == null){ + return AjaxResult.error("客户不存在"); + } + //判断是否已存在客户健康评估 + SysCustomerHealthy customerHealthy = selectSysCustomerHealthyByCustomerId(Long.parseLong(customerId)); + if(customerHealthy != null){ + return AjaxResult.error("已存在健康评估信息,无法重复添加"); + } + //设置客户ID + sysCustomerHealthy.setCustomerId(Long.parseLong(customerId)); + int rows = sysCustomerHealthyMapper.insertSysCustomerHealthy(sysCustomerHealthy); + return rows > 0 ? AjaxResult.success() : AjaxResult.error(); + } + /** * 批量删除客户健康 * @@ -158,4 +188,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService public SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId){ return sysCustomerHealthyMapper.selectSysCustomerHealthyByCustomerId(customerId); } + + /** + * 根据客户ID删除客户健康评估信息 + * @param customerId + * @return + */ + public int deleteCustomerHealthyByCustomerId(Long customerId){ + return sysCustomerHealthyMapper.deleteCustomerHealthyByCustomerId(customerId); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerPhysicalSignsServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerPhysicalSignsServiceImpl.java index cb9bf8a85..5fa132119 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerPhysicalSignsServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerPhysicalSignsServiceImpl.java @@ -182,4 +182,14 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical public SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone){ return sysCustomerPhysicalSignsMapper.selectSysCustomerAndSignByPhone(phone); } + + /** + * 根据客户ID删除对应体征信息 + * @param customerId + * @return + */ + @Override + public int delCustomerSignByCustomerId(Long customerId){ + return sysCustomerPhysicalSignsMapper.delCustomerSignByCustomerId(customerId); + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java index 096395324..a3e7c2694 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java @@ -5,6 +5,7 @@ import java.util.List; import com.stdiet.common.core.domain.model.LoginUser; import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.SecurityUtils; +import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.bean.ObjectUtils; import com.stdiet.custom.domain.SysCustomerPhysicalSigns; import com.stdiet.custom.dto.request.CustomerInvestigateRequest; @@ -115,4 +116,23 @@ public class SysCustomerServiceImpl implements ISysCustomerService public SysCustomer getCustomerByPhone(String phone){ return sysCustomerMapper.getCustomerByPhone(phone); } + + /** + * 判断客户手机号是否已存在 + * @param sysCustomer + * @return + */ + public boolean isCustomerExistByPhone(SysCustomer sysCustomer){ + if(sysCustomer.getId() != null){ + if(StringUtils.isNotEmpty(sysCustomer.getPhone())){ + SysCustomer phoneCustomer = getCustomerByPhone(sysCustomer.getPhone()); + return phoneCustomer != null && phoneCustomer.getId().intValue() != sysCustomer.getId().intValue(); + } + }else{ + if(StringUtils.isNotEmpty(sysCustomer.getPhone())){ + return getCustomerByPhone(sysCustomer.getPhone()) != null; + } + } + return false; + } } \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml index cb0376e7d..bf11ab505 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerHealthyMapper.xml @@ -508,5 +508,9 @@ where sch.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1 + + + update sys_customer_healthy set del_flag = 1 where customer_id = #{customerId} + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml index 821ae9697..cff20111f 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerPhysicalSignsMapper.xml @@ -207,4 +207,9 @@ where scps.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1 + + + update sys_customer_physical_signs set del_flag = 1 where customer_id = #{customerId} + + \ No newline at end of file diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml index d1fda373a..62f469973 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderMapper.xml @@ -318,7 +318,7 @@ - select o.order_id,o.order_time,o.start_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name from sys_order o left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0 @@ -327,6 +327,12 @@ and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId}) + + AND o.order_time >= #{beginTime} + + + AND DATE_FORMAT(o.order_time,'%Y-%m-%d') <= #{endTime} + order by o.order_time desc diff --git a/stdiet-ui/src/api/custom/customer.js b/stdiet-ui/src/api/custom/customer.js index 85d9a53a1..385009f37 100644 --- a/stdiet-ui/src/api/custom/customer.js +++ b/stdiet-ui/src/api/custom/customer.js @@ -68,3 +68,12 @@ export function getCustomerPhysicalSignsByCusId(id) { method: "get" }); } + +// 删除客户健康评估信息或体征信息 +export function delCustomerHealthy(id) { + return request({ + url: "/custom/customer/delCustomerHealthy/" + id, + method: "get" + }); +} + diff --git a/stdiet-ui/src/api/custom/customerInvestigation.js b/stdiet-ui/src/api/custom/customerInvestigation.js index 57c739566..05fd7dd6e 100644 --- a/stdiet-ui/src/api/custom/customerInvestigation.js +++ b/stdiet-ui/src/api/custom/customerInvestigation.js @@ -34,3 +34,12 @@ export function addCustomerHealthy(data) { data: data }) } + +// 根据加密客户ID获取对应客户信息 +export function getCustomerBaseMessage(id) { + return request({ + url: '/investigate/getCustomerBaseMessage/' + id, + method: 'get' + }) +} + diff --git a/stdiet-ui/src/components/ContractAdd/index.vue b/stdiet-ui/src/components/ContractAdd/index.vue new file mode 100644 index 000000000..763d095c6 --- /dev/null +++ b/stdiet-ui/src/components/ContractAdd/index.vue @@ -0,0 +1,180 @@ + + diff --git a/stdiet-ui/src/components/ContractDrawer/index.vue b/stdiet-ui/src/components/ContractDrawer/index.vue index d1d51e9c3..0a5c5e96a 100644 --- a/stdiet-ui/src/components/ContractDrawer/index.vue +++ b/stdiet-ui/src/components/ContractDrawer/index.vue @@ -8,17 +8,18 @@ size="40%" >
- + @@ -71,7 +72,7 @@
- + @@ -80,11 +81,13 @@ import {delContract, listContract} from "@/api/custom/contract"; import ContractDetail from "@/components/ContractDetail"; import Clipboard from 'clipboard'; + import ContractAdd from "@/components/ContractAdd"; export default { name: "CustomerContractDrawer", components: { - 'contract-detail': ContractDetail + 'contract-detail': ContractDetail, + 'add-contract':ContractAdd }, data() { return { @@ -111,17 +114,14 @@ export default { }); }, handleAdd() { - this.$refs.cusCreateOrderDialogRef.showDialog( + this.$refs.cusAddContractDialogRef.showDialog( { customer: this.data.name, - cusId: this.data.id, - preSaleId: this.data.salesman, - afterSaleId: this.data.afterDietitian, - nutritionistId: this.data.mainDietitian, - nutriAssisId: this.data.assistantDietitian, + customerId: this.data.id, + nutritionistId: this.data.mainDietitian }, () => { - this.fetchOrderList(this.data.id); + this.fetchContractList(this.data.id); } ); }, diff --git a/stdiet-ui/src/components/OrderDrawer/index.vue b/stdiet-ui/src/components/OrderDrawer/index.vue index 51f1f39a0..ce68a8b57 100644 --- a/stdiet-ui/src/components/OrderDrawer/index.vue +++ b/stdiet-ui/src/components/OrderDrawer/index.vue @@ -14,6 +14,7 @@ type="primary" icon="el-icon-plus" size="mini" + v-hasPermi="['custom:order:add']" @click="handleAdd" >创建订单 @@ -73,12 +74,14 @@ size="mini" type="text" @click="handleOnEditClick(scope.row)" + v-hasPermi="['custom:order:edit']" >修改 删除 diff --git a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue index 170b7f88d..a2a1f4f0c 100644 --- a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue @@ -1,5 +1,9 @@ diff --git a/stdiet-ui/src/permission.js b/stdiet-ui/src/permission.js index 3347aef45..e1be14bf1 100644 --- a/stdiet-ui/src/permission.js +++ b/stdiet-ui/src/permission.js @@ -49,7 +49,7 @@ router.beforeEach((to, from, next) => { } } else { // 没有token - if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/')) { + if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/')) { // 在免登录白名单,直接进入 next() } else { diff --git a/stdiet-ui/src/router/index.js b/stdiet-ui/src/router/index.js index de87f2b2b..7ca90eddf 100644 --- a/stdiet-ui/src/router/index.js +++ b/stdiet-ui/src/router/index.js @@ -150,7 +150,7 @@ export const constantRoutes = [ meta: { title: '营养体征调查问卷'} }, { - path: '/subhealthyInvestigation', + path: '/subhealthyInvestigation/:id', component: (resolve) => require(['@/views/custom/subhealthy/investigation'], resolve), hidden: true, meta: { title: '胜唐体控健康评估表'} diff --git a/stdiet-ui/src/views/custom/commision/detail/index.vue b/stdiet-ui/src/views/custom/commision/detail/index.vue index 9f00f573d..1bf3c7dd3 100644 --- a/stdiet-ui/src/views/custom/commision/detail/index.vue +++ b/stdiet-ui/src/views/custom/commision/detail/index.vue @@ -12,7 +12,7 @@ - + - + - + 搜索 重置 @@ -239,7 +239,7 @@ /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); - this.handleQuery(); + //this.handleQuery(); this.searchUserIdOptions = this.totalUserIdOptions.slice(); }, // 多选框选中数据 diff --git a/stdiet-ui/src/views/custom/contract/index.vue b/stdiet-ui/src/views/custom/contract/index.vue index e682a6885..bfe92c518 100644 --- a/stdiet-ui/src/views/custom/contract/index.vue +++ b/stdiet-ui/src/views/custom/contract/index.vue @@ -54,14 +54,14 @@ - 新增 - + --> diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue index 94cc695ab..7b39ab1d1 100644 --- a/stdiet-ui/src/views/custom/customer/index.vue +++ b/stdiet-ui/src/views/custom/customer/index.vue @@ -25,7 +25,7 @@ @keyup.enter.native="handleQuery" /> - + - + - + - + - +