Compare commits
No commits in common. "57d850e17fc53c97604d892d00621e344e480ecd" and "9dca96b3cfe632b165edbd57dc80e45117cc49c1" have entirely different histories.
57d850e17f
...
9dca96b3cf
|
|
@ -785,35 +785,25 @@ public class DeviceController extends ControllerBase {
|
||||||
@Transactional
|
@Transactional
|
||||||
@PostMapping("changeServiceAgentCode")
|
@PostMapping("changeServiceAgentCode")
|
||||||
public ApiResult<Void> changeServiceAgentCode(@RequestBody ChangeServiceAgentCodeQuery query) {
|
public ApiResult<Void> changeServiceAgentCode(@RequestBody ChangeServiceAgentCodeQuery query) {
|
||||||
List<Device> devices = deviceService.lambdaQuery()
|
|
||||||
.in(Device::getId, query.getDeviceIds())
|
|
||||||
.list();
|
|
||||||
if (CollectionUtil.isEmpty(devices)){
|
|
||||||
return ApiResult.error("没有需要修改的设备");
|
|
||||||
}
|
|
||||||
TBaseCustomer customer = customerService.lambdaQuery()
|
TBaseCustomer customer = customerService.lambdaQuery()
|
||||||
.eq(TBaseCustomer::getDelIs, 0)
|
.eq(TBaseCustomer::getDelIs, 0)
|
||||||
.eq(TBaseCustomer::getEnableState, 1)
|
.eq(TBaseCustomer::getEnableState, 1)
|
||||||
.eq(TBaseCustomer::getAgencyCompanyCode, query.getServiceAgentCode())
|
.eq(TBaseCustomer::getAgencyCompanyCode, query.getServiceAgentCode())
|
||||||
.one();
|
.one();
|
||||||
VUtils.trueThrowBusinessError(Objects.isNull(customer)).throwMessage("代理商公司不存在");
|
VUtils.trueThrowBusinessError(Objects.isNull(customer)).throwMessage("代理商公司不存在");
|
||||||
devices.forEach(device -> {
|
deviceService.lambdaUpdate()
|
||||||
if (!StrUtil.equals(device.getServiceAgentCode(), query.getServiceAgentCode())){
|
.set(Device::getServiceAgentCode, query.getServiceAgentCode())
|
||||||
deviceService.lambdaUpdate()
|
.set(Device::getServiceAgentName, customer.getAgencyCompanyName())
|
||||||
.set(Device::getServiceAgentCode, query.getServiceAgentCode())
|
.eq(Device::getId, query.getDeviceId())
|
||||||
.set(Device::getServiceAgentName, customer.getAgencyCompanyName())
|
.update();
|
||||||
.eq(Device::getId, device.getId())
|
deviceAgentRecordService.save(new DeviceAgentRecord()
|
||||||
.update();
|
.setDeviceId(query.getDeviceId())
|
||||||
deviceAgentRecordService.save(new DeviceAgentRecord()
|
.setAgentCode(query.getServiceAgentCode())
|
||||||
.setDeviceId(device.getId())
|
.setAgentName(customer.getAgencyCompanyName())
|
||||||
.setAgentCode(query.getServiceAgentCode())
|
.setCreateById(AdminUserUtil.getUserId())
|
||||||
.setAgentName(customer.getAgencyCompanyName())
|
.setCreateBy(AdminUserUtil.getUserName())
|
||||||
.setCreateById(AdminUserUtil.getUserId())
|
.setCreateTime(LocalDateTime.now())
|
||||||
.setCreateBy(AdminUserUtil.getUserName())
|
);
|
||||||
.setCreateTime(LocalDateTime.now())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,16 @@ package com.nflg.mobilebroken.admin.pojo.query;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class ChangeServiceAgentCodeQuery {
|
public class ChangeServiceAgentCodeQuery {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备ID列表
|
* 设备ID
|
||||||
*/
|
*/
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private List<Long> deviceIds;
|
private Integer deviceId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务代理商编码
|
* 服务代理商编码
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.nflg.mobilebroken.gongfu.pojo.query;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -11,9 +10,9 @@ import java.util.List;
|
||||||
public class ChangeServiceAgentCodeQuery {
|
public class ChangeServiceAgentCodeQuery {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备ID列表
|
* 设备ID
|
||||||
*/
|
*/
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private List<Long> deviceIds;
|
private List<Long> deviceIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue