|
@ -5,7 +5,6 @@ import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.dto.form.ExternalCustomerFormDTO; |
|
|
import com.epmet.dto.form.ExternalCustomerFormDTO; |
|
|
import com.epmet.dto.result.ExternalCustomerResultDTO; |
|
|
import com.epmet.dto.result.ExternalCustomerResultDTO; |
|
|
import com.epmet.entity.ExternalCustomerEntity; |
|
|
|
|
|
import com.epmet.service.ExternalCustomerService; |
|
|
import com.epmet.service.ExternalCustomerService; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
@ -15,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotBlank; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 外部客户管理 |
|
|
* 外部客户管理 |
|
|
*/ |
|
|
*/ |
|
@ -48,11 +45,11 @@ public class ExternalCustomerController { |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@PostMapping("add") |
|
|
@PostMapping("add") |
|
|
public Result<ExternalCustomerEntity> add(@RequestBody ExternalCustomerFormDTO formDTO) { |
|
|
public Result<ExternalCustomerResultDTO> add(@RequestBody ExternalCustomerFormDTO formDTO) { |
|
|
ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.AddExternalCustomerGroup.class); |
|
|
ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.AddExternalCustomerGroup.class); |
|
|
String customerName = formDTO.getCustomerName(); |
|
|
String customerName = formDTO.getCustomerName(); |
|
|
ExternalCustomerEntity result = externalCustomerService.add(customerName); |
|
|
ExternalCustomerResultDTO result = externalCustomerService.add(customerName); |
|
|
return new Result<ExternalCustomerEntity>().ok(result); |
|
|
return new Result<ExternalCustomerResultDTO>().ok(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -61,12 +58,12 @@ public class ExternalCustomerController { |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@PostMapping("update") |
|
|
@PostMapping("update") |
|
|
public Result<ExternalCustomerEntity> update(@RequestBody ExternalCustomerFormDTO formDTO) { |
|
|
public Result<ExternalCustomerResultDTO> update(@RequestBody ExternalCustomerFormDTO formDTO) { |
|
|
ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.UpdateExternalCustomerGroup.class); |
|
|
ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.UpdateExternalCustomerGroup.class); |
|
|
String customerId = formDTO.getCustomerId(); |
|
|
String customerId = formDTO.getCustomerId(); |
|
|
String customerName = formDTO.getCustomerName(); |
|
|
String customerName = formDTO.getCustomerName(); |
|
|
ExternalCustomerEntity result = externalCustomerService.update(customerId, customerName); |
|
|
ExternalCustomerResultDTO result = externalCustomerService.update(customerId, customerName); |
|
|
return new Result<ExternalCustomerEntity>().ok(result); |
|
|
return new Result<ExternalCustomerResultDTO>().ok(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|