Compare commits
12 Commits
d8c99e3cf9
...
6ff6b0c64f
| Author | SHA1 | Date |
|---|---|---|
|
|
6ff6b0c64f | |
|
|
24dcb9df96 | |
|
|
9c5425877c | |
|
|
8ba818a74a | |
|
|
4d40c002fb | |
|
|
c1f91ad75a | |
|
|
44ca42144c | |
|
|
d58eaae0d1 | |
|
|
1a59b8ef62 | |
|
|
4f204375af | |
|
|
64f7d7cf74 | |
|
|
dcb02879c1 |
|
|
@ -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())) {
|
||||
|
|
@ -803,4 +806,35 @@ public class DeviceController extends ControllerBase {
|
|||
);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务代理商公司变更记录
|
||||
*/
|
||||
@GetMapping("getServiceAgentChangeRecord")
|
||||
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)
|
||||
.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()
|
||||
.setId(r.getId())
|
||||
.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);
|
||||
}
|
||||
vos.sort(Comparator.comparingLong(DeviceAgentRecordVO::getId).reversed());
|
||||
return ApiResult.success(vos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,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);
|
||||
//将设备类型放入-设备类型表维护客户质量管理人
|
||||
|
||||
|
|
@ -158,8 +160,8 @@ public class AdminDeviceService {
|
|||
} else if (StrUtil.isBlank(u.getProductLine5__c())) {
|
||||
log.error("设备机型为空,{}", JSONUtil.toJsonStr(u));
|
||||
} else {
|
||||
Device ent = deviceMap.get(u.getId());
|
||||
if (StrUtil.isNotBlank(u.getMachine_Number__c())) {
|
||||
Device ent = deviceMap.get(u.getId());
|
||||
if (Objects.nonNull(ent)) {
|
||||
ent.setUpdateBy("crm");
|
||||
ent.setUpdateTime(LocalDateTime.now());
|
||||
|
|
@ -236,9 +238,16 @@ 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);
|
||||
}else if (Objects.nonNull(ent)){
|
||||
ent.setDataValidState(false);
|
||||
result.add(ent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
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 Long id;
|
||||
|
||||
/**
|
||||
* 变更前公司编码
|
||||
*/
|
||||
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)
|
||||
|
|
@ -843,4 +850,35 @@ public class DeviceController extends ControllerBase {
|
|||
);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务代理商公司变更记录
|
||||
*/
|
||||
@GetMapping("getServiceAgentChangeRecord")
|
||||
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)
|
||||
.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()
|
||||
.setId(r.getId())
|
||||
.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);
|
||||
}
|
||||
vos.sort(Comparator.comparingLong(DeviceAgentRecordVO::getId).reversed());
|
||||
return ApiResult.success(vos);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,16 @@ public class DeviceDetailResultVO {
|
|||
*/
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 服务代理商编码
|
||||
*/
|
||||
private String serviceAgentCode;
|
||||
|
||||
/**
|
||||
* 服务代理商名称
|
||||
*/
|
||||
private String serviceAgentName;
|
||||
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -67,6 +67,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<>();
|
||||
|
|
@ -167,8 +169,8 @@ public class AdminDeviceService {
|
|||
log.error("设备机型为空,{}", JSONUtil.toJsonStr(u));
|
||||
} else {
|
||||
log.debug("处理设备:"+u.getMachine_Number__c());
|
||||
GongfuDevice ent = deviceMap.get(u.getId());
|
||||
if (StrUtil.isNotBlank(u.getMachine_Number__c())) {
|
||||
GongfuDevice ent = deviceMap.get(u.getId());
|
||||
if (Objects.nonNull(ent)) {
|
||||
ent.setUpdateBy("crm");
|
||||
ent.setUpdateTime(LocalDateTime.now());
|
||||
|
|
@ -247,10 +249,17 @@ 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);
|
||||
result.add(ent);
|
||||
}else if (Objects.nonNull(ent)){
|
||||
ent.setDataValidState(false);
|
||||
result.add(ent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue