feat: bug-1286 设备售后公司转移
This commit is contained in:
parent
c1f91ad75a
commit
8ba818a74a
|
|
@ -22,6 +22,7 @@ import com.nflg.mobilebroken.common.constant.STATE;
|
|||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.request.IdPostRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceAgentRecordVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceQRCodeVO;
|
||||
import com.nflg.mobilebroken.common.util.*;
|
||||
import com.nflg.mobilebroken.repository.entity.*;
|
||||
|
|
@ -379,6 +380,8 @@ public class DeviceController extends ControllerBase {
|
|||
} else {
|
||||
device.setAgentName(customer.getAgencyCompanyName());
|
||||
device.setAgentCode(customer.getAgencyCompanyCode());
|
||||
device.setServiceAgentCode(customer.getAgencyCompanyCode());
|
||||
device.setServiceAgentName(customer.getAgencyCompanyName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(dto.getAreaName())) {
|
||||
|
|
@ -808,10 +811,28 @@ public class DeviceController extends ControllerBase {
|
|||
* 获取服务代理商公司变更记录
|
||||
*/
|
||||
@GetMapping("getServiceAgentChangeRecord")
|
||||
public ApiResult<List<DeviceAgentRecord>> getServiceAgentChangeRecord(@RequestParam Integer deviceId) {
|
||||
return ApiResult.success(deviceAgentRecordService.lambdaQuery()
|
||||
public ApiResult<List<DeviceAgentRecordVO>> getServiceAgentChangeRecord(@RequestParam Integer deviceId) {
|
||||
Device device = deviceService.getById(deviceId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(device)).throwMessage("设备不存在");
|
||||
List<DeviceAgentRecord> list = deviceAgentRecordService.lambdaQuery()
|
||||
.eq(DeviceAgentRecord::getDeviceId, deviceId)
|
||||
.orderByDesc(DeviceAgentRecord::getId)
|
||||
.list());
|
||||
.orderByAsc(DeviceAgentRecord::getId)
|
||||
.list();
|
||||
String oldAgentCode = device.getAgentCode();
|
||||
String oldAgentName = device.getAgentName();
|
||||
List<DeviceAgentRecordVO> vos = new ArrayList<>();
|
||||
for (DeviceAgentRecord r : list) {
|
||||
DeviceAgentRecordVO vo = new DeviceAgentRecordVO()
|
||||
.setOldAgentCode(oldAgentCode)
|
||||
.setOldAgentName(oldAgentName)
|
||||
.setNewAgentCode(r.getAgentCode())
|
||||
.setNewAgentName(r.getAgentName())
|
||||
.setCreateBy(r.getCreateBy())
|
||||
.setCreateTime(r.getCreateTime());
|
||||
oldAgentCode = r.getAgentCode();
|
||||
oldAgentName = r.getAgentName();
|
||||
vos.add(vo);
|
||||
}
|
||||
return ApiResult.success(vos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ public class AdminDeviceService {
|
|||
device.setProductLine(Constant.MOBILE_BROKEN);
|
||||
// device.setUpdateBy(AdminUserUtil.getUserName());
|
||||
// device.setUpdateTime(LocalDateTime.now());
|
||||
device.setServiceAgentCode(device.getAgentCode());
|
||||
device.setServiceAgentName(device.getAgentName());
|
||||
deviceService.save(device);
|
||||
//将设备类型放入-设备类型表维护客户质量管理人
|
||||
|
||||
|
|
@ -207,6 +209,10 @@ public class AdminDeviceService {
|
|||
}
|
||||
ent.setAgentCode(customer.getAgencyCompanyCode());
|
||||
ent.setAgentName(customer.getAgencyCompanyName());
|
||||
if (Objects.isNull(ent.getId())) {
|
||||
ent.setServiceAgentCode(ent.getAgentCode());
|
||||
ent.setServiceAgentName(ent.getAgentName());
|
||||
}
|
||||
}
|
||||
ent.setAddress(u.getSpecificAddress__c());
|
||||
result.add(ent);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package com.nflg.mobilebroken.common.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DeviceAgentRecordVO {
|
||||
|
||||
/**
|
||||
* 变更前公司编码
|
||||
*/
|
||||
private String oldAgentCode;
|
||||
|
||||
/**
|
||||
* 变更前公司名称
|
||||
*/
|
||||
private String oldAgentName;
|
||||
|
||||
/**
|
||||
* 变更后公司编码
|
||||
*/
|
||||
private String newAgentCode;
|
||||
|
||||
/**
|
||||
* 变更后公司名称
|
||||
*/
|
||||
private String newAgentName;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ import com.nflg.mobilebroken.common.constant.STATE;
|
|||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.request.IdPostRequest;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceAgentRecordVO;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DeviceQRCodeVO;
|
||||
import com.nflg.mobilebroken.common.util.*;
|
||||
import com.nflg.mobilebroken.gongfu.annotation.ApiMark;
|
||||
|
|
@ -382,6 +383,8 @@ public class DeviceController extends ControllerBase {
|
|||
} else {
|
||||
device.setAgentName(customer.getAgencyCompanyName());
|
||||
device.setAgentCode(customer.getAgencyCompanyCode());
|
||||
device.setServiceAgentCode(customer.getAgencyCompanyCode());
|
||||
device.setServiceAgentName(customer.getAgencyCompanyName());
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(dto.getAreaName())) {
|
||||
|
|
@ -822,6 +825,10 @@ public class DeviceController extends ControllerBase {
|
|||
@Transactional
|
||||
@PostMapping("changeServiceAgentCode")
|
||||
public ApiResult<Void> changeServiceAgentCode(@RequestBody ChangeServiceAgentCodeQuery query) {
|
||||
GongfuDevice device=deviceService.getById(query.getDeviceId());
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(device)).throwMessage("设备不存在");
|
||||
VUtils.trueThrowBusinessError(StrUtil.equals(device.getServiceAgentCode(), query.getServiceAgentCode()))
|
||||
.throwMessage("代理商未修改");
|
||||
TBaseCustomer customer = customerService.lambdaQuery()
|
||||
.eq(TBaseCustomer::getDelIs, 0)
|
||||
.eq(TBaseCustomer::getEnableState, 1)
|
||||
|
|
@ -848,10 +855,28 @@ public class DeviceController extends ControllerBase {
|
|||
* 获取服务代理商公司变更记录
|
||||
*/
|
||||
@GetMapping("getServiceAgentChangeRecord")
|
||||
public ApiResult<List<GongfuDeviceAgentRecord>> getServiceAgentChangeRecord(@RequestParam Long deviceId) {
|
||||
return ApiResult.success(gongfuDeviceAgentRecordService.lambdaQuery()
|
||||
public ApiResult<List<DeviceAgentRecordVO>> getServiceAgentChangeRecord(@RequestParam Long deviceId) {
|
||||
GongfuDevice device = deviceService.getById(deviceId);
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(device)).throwMessage("设备不存在");
|
||||
List<GongfuDeviceAgentRecord> list = gongfuDeviceAgentRecordService.lambdaQuery()
|
||||
.eq(GongfuDeviceAgentRecord::getDeviceId, deviceId)
|
||||
.orderByDesc(GongfuDeviceAgentRecord::getId)
|
||||
.list());
|
||||
.orderByAsc(GongfuDeviceAgentRecord::getId)
|
||||
.list();
|
||||
String oldAgentCode = device.getAgentCode();
|
||||
String oldAgentName = device.getAgentName();
|
||||
List<DeviceAgentRecordVO> vos = new ArrayList<>();
|
||||
for (GongfuDeviceAgentRecord r : list) {
|
||||
DeviceAgentRecordVO vo = new DeviceAgentRecordVO()
|
||||
.setOldAgentCode(oldAgentCode)
|
||||
.setOldAgentName(oldAgentName)
|
||||
.setNewAgentCode(r.getAgentCode())
|
||||
.setNewAgentName(r.getAgentName())
|
||||
.setCreateBy(r.getCreateBy())
|
||||
.setCreateTime(r.getCreateTime());
|
||||
oldAgentCode = r.getAgentCode();
|
||||
oldAgentName = r.getAgentName();
|
||||
vos.add(vo);
|
||||
}
|
||||
return ApiResult.success(vos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ public class AdminDeviceService {
|
|||
device.setCreateTime(LocalDateTime.now());
|
||||
// device.setUpdateBy(AdminUserUtil.getUserName());
|
||||
// device.setUpdateTime(LocalDateTime.now());
|
||||
device.setServiceAgentCode(device.getAgentCode());
|
||||
device.setServiceAgentName(device.getAgentName());
|
||||
deviceService.save(device);
|
||||
//将设备类型放入-设备类型表维护客户质量管理人
|
||||
Map<String, Set<String>> dataTypes = new HashMap<>();
|
||||
|
|
@ -214,6 +216,10 @@ public class AdminDeviceService {
|
|||
}
|
||||
ent.setAgentCode(customer.getAgencyCompanyCode());
|
||||
ent.setAgentName(customer.getAgencyCompanyName());
|
||||
if (Objects.isNull(ent.getId())) {
|
||||
ent.setServiceAgentCode(ent.getAgentCode());
|
||||
ent.setServiceAgentName(ent.getAgentName());
|
||||
}
|
||||
}
|
||||
ent.setAddress(u.getSpecificAddress__c());
|
||||
ent.setDataValidState(true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue