Compare commits
No commits in common. "9dca96b3cfe632b165edbd57dc80e45117cc49c1" and "c0dfd52506f120f0d7001aad991b8e4efac7c76b" have entirely different histories.
9dca96b3cf
...
c0dfd52506
|
|
@ -40,9 +40,9 @@ public class DeployTest {
|
|||
|
||||
private void handleDir(SSHUtil sshUtil, String localPath, String remotePath, String dirName) throws Exception {
|
||||
printInfo("处理目录:" + dirName);
|
||||
List<Path> files = getFileList(localPath + dirName);
|
||||
List<Path> files = getFileList(localPath + "lib");
|
||||
for (Path file : files) {
|
||||
handleFile(sshUtil, file.toString(), remotePath +dirName+ "/" + file.getFileName().toString());
|
||||
handleFile(sshUtil, file.toString(), remotePath + "lib/" + file.getFileName().toString());
|
||||
}
|
||||
printInfo("处理目录完成");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ public class DeployTest {
|
|||
|
||||
private void handleDir(SSHUtil sshUtil, String localPath, String remotePath, String dirName) throws Exception {
|
||||
printInfo("处理目录:" + dirName);
|
||||
List<Path> files = getFileList(localPath + dirName);
|
||||
List<Path> files = getFileList(localPath + "lib");
|
||||
for (Path file : files) {
|
||||
handleFile(sshUtil, file.toString(), remotePath + dirName + "/" + file.getFileName().toString());
|
||||
handleFile(sshUtil, file.toString(), remotePath + "lib/" + file.getFileName().toString());
|
||||
}
|
||||
printInfo("处理目录完成");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ public class DeployTest {
|
|||
|
||||
private void handleDir(SSHUtil sshUtil, String localPath, String remotePath, String dirName) throws Exception {
|
||||
printInfo("处理目录:" + dirName);
|
||||
List<Path> files = getFileList(localPath + dirName);
|
||||
List<Path> files = getFileList(localPath + "lib");
|
||||
for (Path file : files) {
|
||||
handleFile(sshUtil, file.toString(), remotePath + dirName+ "/" + file.getFileName().toString());
|
||||
handleFile(sshUtil, file.toString(), remotePath + "lib/" + file.getFileName().toString());
|
||||
}
|
||||
printInfo("处理目录完成");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import com.nflg.mobilebroken.repository.service.*;
|
|||
import com.nflg.mobilebroken.starter.annotation.MethodInfoMark;
|
||||
import com.nflg.mobilebroken.starter.service.FileUploadService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
|
|
@ -44,6 +43,8 @@ import org.ttzero.excel.entity.Workbook;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
|
@ -171,7 +172,7 @@ public class DeviceController extends ControllerBase {
|
|||
@PostMapping("add")
|
||||
@MethodInfoMark(value = "新增", menuName = "设备管理")
|
||||
@ApiMark(moduleName = "设备管理", apiName = "新增")
|
||||
public ApiResult<Boolean> add(@RequestBody DeviceDTO deviceDTO) {
|
||||
public ApiResult<Boolean> add(@Valid @RequestBody DeviceDTO deviceDTO) {
|
||||
VUtils.trueThrow(deviceService.lambdaQuery()
|
||||
.eq(GongfuDevice::getDeviceNo, deviceDTO.getDeviceNo())
|
||||
.eq(GongfuDevice::getDeviceState, deviceDTO.getDeviceState())
|
||||
|
|
@ -186,7 +187,7 @@ public class DeviceController extends ControllerBase {
|
|||
@PostMapping("update")
|
||||
@MethodInfoMark(value = "编辑", menuName = "设备管理")
|
||||
@ApiMark(moduleName = "设备管理", apiName = "编辑")
|
||||
public ApiResult<Boolean> update(@RequestBody DeviceDTO deviceDTO) {
|
||||
public ApiResult<Boolean> update(@Valid @RequestBody DeviceDTO deviceDTO) {
|
||||
VUtils.trueThrow(deviceDTO.getId() <= 0).throwMessage(STATE.ParamErr, "编辑时ID参数不能<=0");
|
||||
adminDeviceService.update(deviceDTO);
|
||||
return ApiResult.success(true);
|
||||
|
|
@ -497,7 +498,7 @@ public class DeviceController extends ControllerBase {
|
|||
*/
|
||||
@PostMapping("exportSelect")
|
||||
@ApiMark(moduleName = "设备管理", apiName = "导出选中的设备")
|
||||
public void exportSelect(HttpServletResponse response, @RequestBody @NotEmpty List<Long> ids) throws Exception {
|
||||
public void exportSelect(HttpServletResponse response, @Valid @RequestBody @NotEmpty List<Long> ids) throws Exception {
|
||||
List<GongfuDevice> devices = deviceService.listByIds(ids);
|
||||
List<DictionaryItem> states = dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_DEVICE_STATE);
|
||||
List<DeviceUpdateImportDTO> datas = devices.stream().map(d -> {
|
||||
|
|
@ -749,7 +750,7 @@ public class DeviceController extends ControllerBase {
|
|||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("getQRCode")
|
||||
public ApiResult<List<DeviceQRCodeVO>> getQRCode(@RequestBody IdPostRequest request) {
|
||||
public ApiResult<List<DeviceQRCodeVO>> getQRCode(@Valid @RequestBody IdPostRequest request) {
|
||||
List<GongfuDevice> devices = deviceService.listByIds(request.getIds());
|
||||
List<DeviceQRCodeVO> vos = new ArrayList<>();
|
||||
devices.forEach(device -> {
|
||||
|
|
@ -771,7 +772,7 @@ public class DeviceController extends ControllerBase {
|
|||
* @param request 请求参数
|
||||
*/
|
||||
@PostMapping("exportImages")
|
||||
public ResponseEntity<byte[]> exportImages(@RequestBody IdPostRequest request) {
|
||||
public ResponseEntity<byte[]> exportImages(@Valid @RequestBody IdPostRequest request) {
|
||||
List<GongfuDevice> devices = deviceService.listByIds(request.getIds());
|
||||
if (CollUtil.isNotEmpty(devices)) {
|
||||
try {
|
||||
|
|
@ -824,35 +825,29 @@ public class DeviceController extends ControllerBase {
|
|||
@Transactional
|
||||
@PostMapping("changeServiceAgentCode")
|
||||
public ApiResult<Void> changeServiceAgentCode(@RequestBody ChangeServiceAgentCodeQuery query) {
|
||||
List<GongfuDevice> devices = deviceService.lambdaQuery()
|
||||
.in(GongfuDevice::getId, query.getDeviceIds())
|
||||
.list();
|
||||
if (CollectionUtil.isEmpty(devices)){
|
||||
return ApiResult.error("没有需要修改的设备");
|
||||
}
|
||||
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)
|
||||
.eq(TBaseCustomer::getAgencyCompanyCode, query.getServiceAgentCode())
|
||||
.one();
|
||||
VUtils.trueThrowBusinessError(Objects.isNull(customer)).throwMessage("代理商公司不存在");
|
||||
devices.forEach(device -> {
|
||||
if (!StrUtil.equals(device.getServiceAgentCode(), query.getServiceAgentCode())){
|
||||
deviceService.lambdaUpdate()
|
||||
.set(GongfuDevice::getServiceAgentCode, query.getServiceAgentCode())
|
||||
.set(GongfuDevice::getServiceAgentName, customer.getAgencyCompanyName())
|
||||
.eq(GongfuDevice::getId, device.getId())
|
||||
.update();
|
||||
gongfuDeviceAgentRecordService.save(new GongfuDeviceAgentRecord()
|
||||
.setDeviceId(device.getId())
|
||||
.setAgentCode(query.getServiceAgentCode())
|
||||
.setAgentName(customer.getAgencyCompanyName())
|
||||
.setCreateById(AdminUserUtil.getUserId())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now())
|
||||
);
|
||||
}
|
||||
});
|
||||
deviceService.lambdaUpdate()
|
||||
.set(GongfuDevice::getServiceAgentCode, query.getServiceAgentCode())
|
||||
.set(GongfuDevice::getServiceAgentName, customer.getAgencyCompanyName())
|
||||
.eq(GongfuDevice::getId, query.getDeviceId())
|
||||
.update();
|
||||
gongfuDeviceAgentRecordService.save(new GongfuDeviceAgentRecord()
|
||||
.setDeviceId(query.getDeviceId())
|
||||
.setAgentCode(query.getServiceAgentCode())
|
||||
.setAgentName(customer.getAgencyCompanyName())
|
||||
.setCreateById(AdminUserUtil.getUserId())
|
||||
.setCreateBy(AdminUserUtil.getUserName())
|
||||
.setCreateTime(LocalDateTime.now())
|
||||
);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import lombok.Data;
|
|||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ChangeServiceAgentCodeQuery {
|
||||
|
|
@ -13,7 +12,7 @@ public class ChangeServiceAgentCodeQuery {
|
|||
* 设备ID
|
||||
*/
|
||||
@NotNull
|
||||
private List<Long> deviceIds;
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 服务代理商编码
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ public class DeployTest {
|
|||
|
||||
private void handleDir(SSHUtil sshUtil, String localPath, String remotePath, String dirName) throws Exception {
|
||||
printInfo("处理目录:" + dirName);
|
||||
List<Path> files = getFileList(localPath + dirName);
|
||||
List<Path> files = getFileList(localPath + "lib");
|
||||
for (Path file : files) {
|
||||
handleFile(sshUtil, file.toString(), remotePath + dirName + "/" + file.getFileName().toString());
|
||||
handleFile(sshUtil, file.toString(), remotePath + "lib/" + file.getFileName().toString());
|
||||
}
|
||||
printInfo("处理目录完成");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ public class DeployTest {
|
|||
|
||||
private void handleDir(SSHUtil sshUtil, String localPath, String remotePath, String dirName) throws Exception {
|
||||
printInfo("处理目录:" + dirName);
|
||||
List<Path> files = getFileList(localPath + dirName);
|
||||
List<Path> files = getFileList(localPath + "lib");
|
||||
for (Path file : files) {
|
||||
handleFile(sshUtil, file.toString(), remotePath + dirName + "/" + file.getFileName().toString());
|
||||
handleFile(sshUtil, file.toString(), remotePath + "lib/" + file.getFileName().toString());
|
||||
}
|
||||
printInfo("处理目录完成");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ public class DeployTest {
|
|||
|
||||
private void handleDir(SSHUtil sshUtil, String localPath, String remotePath, String dirName) throws Exception {
|
||||
printInfo("处理目录:" + dirName);
|
||||
List<Path> files = getFileList(localPath + dirName);
|
||||
List<Path> files = getFileList(localPath + "lib");
|
||||
for (Path file : files) {
|
||||
handleFile(sshUtil, file.toString(), remotePath + dirName + "/" + file.getFileName().toString());
|
||||
handleFile(sshUtil, file.toString(), remotePath + "lib/" + file.getFileName().toString());
|
||||
}
|
||||
printInfo("处理目录完成");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue