!54 客户档案的合同添加、复制健康调查链接

Merge pull request !54 from 德仔/xzj
This commit is contained in:
德仔
2021-02-01 19:45:14 +08:00
committed by Gitee
32 changed files with 621 additions and 1102 deletions

View File

@ -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<String, Object> 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);
}
}

View File

@ -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<String, Object> 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);
}
}

View File

@ -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();
}
/**