客户体征优化、客户健康修改
This commit is contained in:
@ -8,6 +8,7 @@ import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||
import com.stdiet.custom.domain.SysPhysicalSigns;
|
||||
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
||||
import com.stdiet.custom.service.ISysCustomerHealthyService;
|
||||
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
|
||||
import com.stdiet.custom.service.ISysCustomerService;
|
||||
import com.stdiet.custom.service.ISysPhysicalSignsService;
|
||||
import com.stdiet.system.service.ISysDictTypeService;
|
||||
@ -28,7 +29,7 @@ import java.util.List;
|
||||
public class InvestigateController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysCustomerService iSysCustomerService;
|
||||
private ISysCustomerPhysicalSignsService sysCustomerPhysicalSignsService;
|
||||
|
||||
@Autowired
|
||||
private ISysPhysicalSignsService iSysPhysicalSignsService;
|
||||
@ -45,13 +46,8 @@ public class InvestigateController extends BaseController {
|
||||
@PostMapping("/customerInvestigate")
|
||||
public AjaxResult customerInvestigate(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception
|
||||
{
|
||||
//验证是否已存在该手机号
|
||||
SysCustomer phoneCustomer = iSysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
|
||||
if(phoneCustomer != null){
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
customerInvestigateRequest.setId(null); //只能添加,无法修改
|
||||
return AjaxResult.success(iSysCustomerService.addOrupdateCustomerAndSign(customerInvestigateRequest));
|
||||
return sysCustomerPhysicalSignsService.addOrupdateCustomerAndSign(customerInvestigateRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,8 +76,7 @@ public class InvestigateController extends BaseController {
|
||||
@PostMapping("/addCustomerHealthy")
|
||||
public AjaxResult addCustomerHealthy(@RequestBody SysCustomerHealthy sysCustomerHealthy)
|
||||
{
|
||||
System.out.println(sysCustomerHealthy.getSex());
|
||||
return toAjax(1);
|
||||
return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,12 +4,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import com.stdiet.custom.domain.SysPhysicalSigns;
|
||||
|
||||
import com.stdiet.common.utils.bean.ObjectUtils;
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
||||
import com.stdiet.custom.dto.response.CustomerListResponse;
|
||||
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
|
||||
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -36,17 +38,20 @@ public class SysCustomerController extends BaseController
|
||||
@Autowired
|
||||
private ISysCustomerService sysCustomerService;
|
||||
|
||||
@Autowired
|
||||
private ISysCustomerPhysicalSignsService sysCustomerPhysicalSignsService;
|
||||
|
||||
/**
|
||||
* 查询客户信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:customer:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysCustomer sysCustomer)
|
||||
public TableDataInfo list(SysCustomerPhysicalSigns sysCustomerPhysicalSigns)
|
||||
{
|
||||
startPage();
|
||||
List<SysCustomer> list = sysCustomerService.selectSysCustomerAndSignList(sysCustomer);
|
||||
List<SysCustomerPhysicalSigns> list = sysCustomerPhysicalSignsService.selectSysCustomerAndSignList(sysCustomerPhysicalSigns);
|
||||
if(list != null && list.size() > 0){
|
||||
for(SysCustomer sysCus : list){
|
||||
for(SysCustomerPhysicalSigns sysCus : list){
|
||||
if(StringUtils.isNotEmpty(sysCus.getPhone())){
|
||||
sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
|
||||
}
|
||||
@ -61,22 +66,21 @@ public class SysCustomerController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('custom:customer:export')")
|
||||
@Log(title = "客户体征", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysCustomer sysCustomer) throws Exception
|
||||
public AjaxResult export(SysCustomerPhysicalSigns sysCustomerPhysicalSigns) throws Exception
|
||||
{
|
||||
List<SysCustomer> list = sysCustomerService.selectSysCustomerAndSignList(sysCustomer);
|
||||
List<SysCustomerPhysicalSigns> list = sysCustomerPhysicalSignsService.selectSysCustomerAndSignList(sysCustomerPhysicalSigns);
|
||||
List<CustomerListResponse> responsesList = new ArrayList<>();
|
||||
CustomerListResponse customerListResponse = null;
|
||||
for (SysCustomer customer : list) {
|
||||
customerListResponse = ObjectUtils.getObjectByObject(customer.getSign(), CustomerListResponse.class);
|
||||
customerListResponse.setCreateTime(customer.getCreateTime());
|
||||
customerListResponse.setName(customer.getName());
|
||||
if(StringUtils.isNotEmpty(customer.getPhone())){
|
||||
customerListResponse.setPhone(StringUtils.hiddenPhoneNumber(customer.getPhone()));
|
||||
for(SysCustomerPhysicalSigns sysCus : list){
|
||||
customerListResponse = ObjectUtils.getObjectByObject(sysCus, CustomerListResponse.class);
|
||||
customerListResponse.setCreateTime(sysCus.getCreateTime());
|
||||
if(StringUtils.isNotEmpty(sysCus.getPhone())){
|
||||
customerListResponse.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
|
||||
}
|
||||
StringBuilder signStr = new StringBuilder();
|
||||
if(customer.getSign().getSignList() != null && customer.getSign().getSignList().size() > 0){
|
||||
if(sysCus.getSignList() != null && sysCus.getSignList().size() > 0){
|
||||
int i = 0;
|
||||
for (SysPhysicalSigns s : customer.getSign().getSignList()) {
|
||||
for (SysPhysicalSigns s : sysCus.getSignList()) {
|
||||
signStr.append((i != 0 ? "," : "") + s.getName());
|
||||
i++;
|
||||
}
|
||||
@ -95,7 +99,7 @@ public class SysCustomerController extends BaseController
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysCustomerService.getCustomerAndSignById(id));
|
||||
return AjaxResult.success(sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,12 +110,7 @@ public class SysCustomerController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception
|
||||
{
|
||||
//验证是否已存在该手机号
|
||||
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
|
||||
if(phoneCustomer != null){
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
return toAjax(sysCustomerService.addOrupdateCustomerAndSign(customerInvestigateRequest));
|
||||
return sysCustomerPhysicalSignsService.addOrupdateCustomerAndSign(customerInvestigateRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -122,15 +121,7 @@ public class SysCustomerController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception
|
||||
{
|
||||
SysCustomer oldCustomer = sysCustomerService.selectSysCustomerById(customerInvestigateRequest.getId());
|
||||
if(oldCustomer != null && !oldCustomer.getPhone().equals(customerInvestigateRequest.getPhone())){
|
||||
//验证是否已存在该手机号
|
||||
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
|
||||
if(phoneCustomer != null){
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
}
|
||||
return toAjax(sysCustomerService.addOrupdateCustomerAndSign(customerInvestigateRequest));
|
||||
return sysCustomerPhysicalSignsService.addOrupdateCustomerAndSign(customerInvestigateRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -141,10 +132,9 @@ public class SysCustomerController extends BaseController
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysCustomerService.delCustomerAndSignById(ids));
|
||||
return toAjax(sysCustomerPhysicalSignsService.deleteSysCustomerPhysicalSignsByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据手机号查看用户体征
|
||||
*/
|
||||
@ -152,9 +142,9 @@ public class SysCustomerController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('custom:customer:query')")
|
||||
public AjaxResult getCustomerAndSignByPhone(@RequestParam("phone")String phone)
|
||||
{
|
||||
SysCustomer sysCustomer = null;
|
||||
SysCustomerPhysicalSigns sysCustomer = null;
|
||||
if(StringUtils.isNotEmpty(phone)){
|
||||
sysCustomer = sysCustomerService.selectSysCustomerAndSignByPhone(phone);
|
||||
sysCustomer = sysCustomerPhysicalSignsService.selectSysCustomerAndSignByPhone(phone);
|
||||
}
|
||||
return AjaxResult.success(sysCustomer);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ import com.stdiet.common.core.page.TableDataInfo;
|
||||
* @date 2021-01-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/customer/healthy")
|
||||
@RequestMapping("/custom/healthy")
|
||||
public class SysCustomerHealthyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
@ -36,7 +36,7 @@ public class SysCustomerHealthyController extends BaseController
|
||||
/**
|
||||
* 查询客户健康列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:healthy:list')")
|
||||
@PreAuthorize("@ss.hasPermi('custom:healthy:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysCustomerHealthy sysCustomerHealthy)
|
||||
{
|
||||
@ -48,7 +48,7 @@ public class SysCustomerHealthyController extends BaseController
|
||||
/**
|
||||
* 导出客户健康列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:healthy:export')")
|
||||
@PreAuthorize("@ss.hasPermi('custom:healthy:export')")
|
||||
@Log(title = "客户健康", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysCustomerHealthy sysCustomerHealthy)
|
||||
@ -61,7 +61,7 @@ public class SysCustomerHealthyController extends BaseController
|
||||
/**
|
||||
* 获取客户健康详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:healthy:query')")
|
||||
@PreAuthorize("@ss.hasPermi('custom:healthy:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
@ -76,24 +76,24 @@ public class SysCustomerHealthyController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysCustomerHealthy sysCustomerHealthy)
|
||||
{
|
||||
return toAjax(sysCustomerHealthyService.insertSysCustomerHealthy(sysCustomerHealthy));
|
||||
return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户健康
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:healthy:edit')")
|
||||
@PreAuthorize("@ss.hasPermi('custom:healthy:edit')")
|
||||
@Log(title = "客户健康", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysCustomerHealthy sysCustomerHealthy)
|
||||
{
|
||||
return toAjax(sysCustomerHealthyService.updateSysCustomerHealthy(sysCustomerHealthy));
|
||||
return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户健康
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:healthy:remove')")
|
||||
@PreAuthorize("@ss.hasPermi('custom:healthy:remove')")
|
||||
@Log(title = "客户健康", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
|
Reference in New Issue
Block a user