|
|
|
@ -28,7 +28,6 @@ import com.thing.eq.file.service.FileService; |
|
|
|
import com.thing.sys.biz.dto.SysDeptDTO; |
|
|
|
import com.thing.sys.biz.dto.SysDictTypeListDTO; |
|
|
|
import com.thing.sys.biz.entity.SysDictDataEntity; |
|
|
|
import com.thing.sys.biz.entity.SysDictTypeEntity; |
|
|
|
import com.thing.sys.biz.service.SysDeptService; |
|
|
|
import com.thing.sys.biz.service.SysDictDataService; |
|
|
|
import com.thing.sys.biz.service.SysDictTypeService; |
|
|
|
@ -38,11 +37,13 @@ import io.swagger.v3.oas.annotations.Parameter; |
|
|
|
import io.swagger.v3.oas.annotations.Parameters; |
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
import jakarta.servlet.http.HttpServletResponse; |
|
|
|
import org.apache.commons.lang3.ArrayUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -94,7 +95,7 @@ public class EqWxPlanController { |
|
|
|
// private IotDictTypeService iotDictTypeService; |
|
|
|
|
|
|
|
@GetMapping("page") |
|
|
|
@Operation(summary= "分页") |
|
|
|
@Operation(summary = "分页") |
|
|
|
@Parameters({ |
|
|
|
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始"), |
|
|
|
@Parameter(name = Constant.LIMIT, description = "每页显示记录数"), |
|
|
|
@ -128,16 +129,16 @@ public class EqWxPlanController { |
|
|
|
EqWxInfoRes eqWxInfoRes = ConvertUtils.sourceToTarget(data, EqWxInfoRes.class); |
|
|
|
//调整 |
|
|
|
String userId = data.getWxUser(); |
|
|
|
if(StringUtils.isNotBlank(userId)){ |
|
|
|
if (StringUtils.isNotBlank(userId)) { |
|
|
|
String[] split = userId.split(","); |
|
|
|
List<Long> longs = new ArrayList<>(); |
|
|
|
for (String s : split) { |
|
|
|
longs.add(Long.parseLong(s)); |
|
|
|
} |
|
|
|
List<String> planUserName = sysUserService.getUserNameLists(longs); |
|
|
|
String name=""; |
|
|
|
String name = ""; |
|
|
|
for (String s : planUserName) { |
|
|
|
name+=s+","; |
|
|
|
name += s + ","; |
|
|
|
} |
|
|
|
name = name.substring(0, name.length() - 1); |
|
|
|
eqWxInfoRes.setWxUseText(name); |
|
|
|
@ -157,7 +158,7 @@ public class EqWxPlanController { |
|
|
|
eqWxInfoRes.setBxInfo(storeEqBxMap.get(data.getEqBxId())); |
|
|
|
} else { |
|
|
|
EqBxEntity eqBxEntity = null; |
|
|
|
if(!Objects.isNull(data.getEqBxId())){ |
|
|
|
if (!Objects.isNull(data.getEqBxId())) { |
|
|
|
eqBxEntity = eqBxService.getById(data.getEqBxId()); |
|
|
|
} |
|
|
|
if (!Objects.isNull(eqBxEntity)) { |
|
|
|
@ -177,55 +178,59 @@ public class EqWxPlanController { |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("{id}/{relationTypeId}") |
|
|
|
@Operation(summary= "信息") |
|
|
|
@Operation(summary = "信息") |
|
|
|
// @RequiresPermissions("eqwxplan:eqwxplan:info") |
|
|
|
public Result<EqWxInfoRes> get(@PathVariable("id") Long id, @PathVariable(value = "relationTypeId") Long relationTypeId) { |
|
|
|
EqWxPlanDTO data = eqWxPlanService.getByIdAs(id,EqWxPlanDTO.class); |
|
|
|
EqWxInfoRes data = eqWxPlanService.getByIdAs(id, EqWxInfoRes.class); |
|
|
|
|
|
|
|
if (Objects.isNull(data)) { |
|
|
|
throw new SysException("维修计划不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
EqWxInfoRes eqWxInfoRes = new EqWxInfoRes(); |
|
|
|
BeanUtils.copyProperties(data, eqWxInfoRes); |
|
|
|
// |
|
|
|
// EqWxInfoRes eqWxInfoRes = new EqWxInfoRes(); |
|
|
|
// BeanUtils.copyProperties(data, eqWxInfoRes); |
|
|
|
// 查询设备信息 |
|
|
|
ThingDTO thingDTO = new ThingDTO(); |
|
|
|
iotThingBaseInfoService.getThingInfo(thingDTO, data.getThingId(), null, "1", String.valueOf(relationTypeId)); |
|
|
|
eqWxInfoRes.setBaseInfo(thingDTO); |
|
|
|
ThingDTO thingInfo = iotThingBaseInfoService.getThingInfo(thingDTO, data.getThingId(), null, "1", String.valueOf(relationTypeId)); |
|
|
|
data.setBaseInfo(thingInfo); |
|
|
|
|
|
|
|
//调整 |
|
|
|
String userId = data.getWxUser(); |
|
|
|
String[] split = userId.split(","); |
|
|
|
List<Long> longs = new ArrayList<>(); |
|
|
|
|
|
|
|
if (ArrayUtils.isNotEmpty(split)) { |
|
|
|
List<Long> longs = new ArrayList<>(); |
|
|
|
for (String s : split) { |
|
|
|
longs.add(Long.parseLong(s)); |
|
|
|
} List<String> planUserName = sysUserService.getUserNameLists(longs); |
|
|
|
String name=""; |
|
|
|
for (String s : planUserName) { |
|
|
|
name+=s+","; |
|
|
|
if(StringUtils.isNotBlank(s)){ |
|
|
|
longs.add(Long.parseLong(s)); |
|
|
|
} |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(longs)){ |
|
|
|
List<String> planUserName = sysUserService.getUserNameLists(longs); |
|
|
|
String name = ""; |
|
|
|
for (String s : planUserName) { |
|
|
|
name += s + ","; |
|
|
|
} |
|
|
|
name = name.substring(0, name.length() - 1); |
|
|
|
data.setWxUseText(name); |
|
|
|
} |
|
|
|
} |
|
|
|
name = name.substring(0, name.length() - 1); |
|
|
|
eqWxInfoRes.setWxUseText(name); |
|
|
|
|
|
|
|
BxInfoDTO bxInfoDTO = new BxInfoDTO(); |
|
|
|
// 查询报修信息 |
|
|
|
EqBxEntity eqBxEntity = eqBxService.getById(data.getEqBxId()); |
|
|
|
if (!Objects.isNull(eqBxEntity)) { |
|
|
|
BeanUtils.copyProperties(eqBxEntity, bxInfoDTO); |
|
|
|
eqWxInfoRes.setBxInfo(bxInfoDTO); |
|
|
|
|
|
|
|
BxInfoDTO bxInfoDTO = eqBxService.getByIdAs(data.getEqBxId(),BxInfoDTO.class); |
|
|
|
if (!Objects.isNull(bxInfoDTO)) { |
|
|
|
data.setBxInfo(bxInfoDTO); |
|
|
|
Map<String, List<EqAttacmentDTO>> document = fileService.getDocument(data.getEqBxId()); |
|
|
|
bxInfoDTO.setImageUrls(document.get("image")); |
|
|
|
bxInfoDTO.setAttachmentUrls(document.get("attachment")); |
|
|
|
} |
|
|
|
// 查询维修备件信息 |
|
|
|
eqWxInfoRes.setReplacements(eqWxReplacementService.getWxReplacementByWxPlanId(data.getId())); |
|
|
|
data.setReplacements(eqWxReplacementService.getWxReplacementByWxPlanId(data.getId())); |
|
|
|
|
|
|
|
return new Result<EqWxInfoRes>().ok(eqWxInfoRes); |
|
|
|
return new Result<EqWxInfoRes>().ok(data); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping |
|
|
|
@Operation(summary= "保存") |
|
|
|
@Operation(summary = "保存") |
|
|
|
@LogOperation("保存") |
|
|
|
// @RequiresPermissions("equipment:maintainRecords:add") |
|
|
|
public Result save(@RequestBody EqWxPlanAddDTO dto) { |
|
|
|
@ -254,7 +259,7 @@ public class EqWxPlanController { |
|
|
|
} |
|
|
|
|
|
|
|
@PutMapping |
|
|
|
@Operation(summary= "修改") |
|
|
|
@Operation(summary = "修改") |
|
|
|
@LogOperation("修改") |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
// @RequiresPermissions("equipment:maintainRecords:update") |
|
|
|
@ -278,7 +283,7 @@ public class EqWxPlanController { |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping |
|
|
|
@Operation(summary= "删除") |
|
|
|
@Operation(summary = "删除") |
|
|
|
@LogOperation("删除") |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
// @RequiresPermissions("equipment:maintainRecords:delete") |
|
|
|
@ -287,7 +292,7 @@ public class EqWxPlanController { |
|
|
|
AssertUtils.isArrayEmpty(ids, "id"); |
|
|
|
|
|
|
|
for (Long id : ids) { |
|
|
|
EqWxPlanDTO eqWxPlanDTO = eqWxPlanService.getByIdAs(id,EqWxPlanDTO.class); |
|
|
|
EqWxPlanDTO eqWxPlanDTO = eqWxPlanService.getByIdAs(id, EqWxPlanDTO.class); |
|
|
|
if (!Objects.isNull(eqWxPlanDTO) && "2".equals(eqWxPlanDTO.getWxStatus())) { |
|
|
|
throw new SysException("不能删除已完成的维修记录"); |
|
|
|
} |
|
|
|
@ -303,7 +308,7 @@ public class EqWxPlanController { |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("export") |
|
|
|
@Operation(summary= "导出") |
|
|
|
@Operation(summary = "导出") |
|
|
|
@LogOperation("导出") |
|
|
|
// @Parameters({ |
|
|
|
// @Parameter(name = "relationTypeId", description = "结构类型id", paramType = "query", required = true, dataType = "String"), |
|
|
|
@ -356,13 +361,14 @@ public class EqWxPlanController { |
|
|
|
//调整 |
|
|
|
String userId = data.getWxUser(); |
|
|
|
String[] split = userId.split(","); |
|
|
|
List<Long> longs = new ArrayList<>(); |
|
|
|
for (String s : split) { |
|
|
|
longs.add(Long.parseLong(s)); |
|
|
|
} List<String> planUserName = sysUserService.getUserNameLists(longs); |
|
|
|
String name=""; |
|
|
|
List<Long> longs = new ArrayList<>(); |
|
|
|
for (String s : split) { |
|
|
|
longs.add(Long.parseLong(s)); |
|
|
|
} |
|
|
|
List<String> planUserName = sysUserService.getUserNameLists(longs); |
|
|
|
String name = ""; |
|
|
|
for (String s : planUserName) { |
|
|
|
name+=s+","; |
|
|
|
name += s + ","; |
|
|
|
} |
|
|
|
name = name.substring(0, name.length() - 1); |
|
|
|
eqWxPlanExcel.setWxUser(name); |
|
|
|
@ -424,16 +430,16 @@ public class EqWxPlanController { |
|
|
|
} |
|
|
|
List<EqWxPlanExcel> newList = new ArrayList<>(); |
|
|
|
List<Long> idList = new ArrayList<>(Arrays.asList(ids)); |
|
|
|
if (CollectionUtil.isNotEmpty(idList)){ |
|
|
|
for (EqWxPlanExcel eqWxPlanExcel : excels ){ |
|
|
|
if (idList.contains(eqWxPlanExcel.getId())){ |
|
|
|
if (CollectionUtil.isNotEmpty(idList)) { |
|
|
|
for (EqWxPlanExcel eqWxPlanExcel : excels) { |
|
|
|
if (idList.contains(eqWxPlanExcel.getId())) { |
|
|
|
newList.add(eqWxPlanExcel); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
newList.addAll(excels); |
|
|
|
} |
|
|
|
ExcelUtils.exportExcel(newList,null, "维修记录", EqWxPlanExcel.class,"维修记录.xls",response); |
|
|
|
ExcelUtils.exportExcel(newList, null, "维修记录", EqWxPlanExcel.class, "维修记录.xls", response); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -443,15 +449,15 @@ public class EqWxPlanController { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
List<SysDictDataEntity> temp = new ArrayList<>(); |
|
|
|
Object obj = dictMap.get(dictType); |
|
|
|
temp= JSON.parseArray(JSON.toJSONString(obj),SysDictDataEntity.class); |
|
|
|
Object obj = dictMap.get(dictType); |
|
|
|
temp = JSON.parseArray(JSON.toJSONString(obj), SysDictDataEntity.class); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(temp)) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
Map<String, String> dictObject = new HashMap<>(); |
|
|
|
for (SysDictDataEntity dictData:temp){ |
|
|
|
dictObject.put(dictData.getDictValue(),dictData.getDictLabel()); |
|
|
|
for (SysDictDataEntity dictData : temp) { |
|
|
|
dictObject.put(dictData.getDictValue(), dictData.getDictLabel()); |
|
|
|
} |
|
|
|
|
|
|
|
// List<Map> temp = (List<Map>) dictMap.get(dictType); |
|
|
|
|