Commit 8548f1e4 by HlQ

[chg] 代码优化,TODO 解决

1 parent c3e92131
...@@ -51,7 +51,6 @@ public class AccountController { ...@@ -51,7 +51,6 @@ public class AccountController {
@DeleteMapping("/account/{id}") @DeleteMapping("/account/{id}")
@SaCheckPermission(value = "account:remove", orRole = "admin") @SaCheckPermission(value = "account:remove", orRole = "admin")
public String remove(@PathVariable(name = "id") Integer id) { public String remove(@PathVariable(name = "id") Integer id) {
// todo 删除时,得判断集团下是否关联其他东西
accountService.removeById(id); accountService.removeById(id);
return "集团删除成功"; return "集团删除成功";
} }
......
...@@ -47,7 +47,7 @@ public class DeviceController { ...@@ -47,7 +47,7 @@ public class DeviceController {
} }
@PostMapping("/circulate") @PostMapping("/circulate")
@SaCheckPermission(value = "device:circulateBatch", orRole = "admin") @SaCheckPermission(value = "device:circulate", orRole = "admin")
public String circulateBatch(@RequestBody List<DeviceDTO> dtoList) { public String circulateBatch(@RequestBody List<DeviceDTO> dtoList) {
return deviceService.circulateBatch(dtoList); return deviceService.circulateBatch(dtoList);
} }
......
package vion.controller; package vion.controller;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.data.id.IdUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter; import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.hutool.core.data.id.IdUtil;
import org.dromara.hutool.core.lang.Assert;
import org.redisson.api.RMap;
import org.redisson.api.RedissonClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import vion.constant.RedisKeyEnum;
import vion.dto.ServiceOrderDTO; import vion.dto.ServiceOrderDTO;
import vion.model.Dictionary;
import vion.model.ServiceOrder; import vion.model.ServiceOrder;
import vion.service.IDictionaryService;
import vion.service.IServiceOrderService; import vion.service.IServiceOrderService;
import vion.vo.ServiceOrderVO; import vion.vo.ServiceOrderVO;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 服务单 * 服务单
* *
...@@ -30,7 +27,7 @@ import java.util.stream.Collectors; ...@@ -30,7 +27,7 @@ import java.util.stream.Collectors;
public class ServiceOrderController { public class ServiceOrderController {
private final IServiceOrderService serviceOrderService; private final IServiceOrderService serviceOrderService;
private final IDictionaryService dictionaryService; private final RedissonClient redissonClient;
private final Converter converter; private final Converter converter;
@GetMapping("/orders") @GetMapping("/orders")
...@@ -71,9 +68,7 @@ public class ServiceOrderController { ...@@ -71,9 +68,7 @@ public class ServiceOrderController {
@GetMapping("/order/sign/{unid}") @GetMapping("/order/sign/{unid}")
public ServiceOrderVO getOrderByUnid(@PathVariable String unid) { public ServiceOrderVO getOrderByUnid(@PathVariable String unid) {
// todo 字典加入缓存 RMap<Integer, String> serviceTypeMap = redissonClient.getMap(RedisKeyEnum.DICT_PREFIX.getVal() + RedisKeyEnum.SERVICE_TYPE.getVal());
List<Dictionary> dictionaryList = dictionaryService.lambdaQuery().eq(Dictionary::getType, "service_type").list();
Map<Integer, String> serviceTypeMap = dictionaryList.stream().collect(Collectors.toMap(Dictionary::getKey, Dictionary::getValue));
ServiceOrder order = serviceOrderService.lambdaQuery().eq(ServiceOrder::getUnid, unid).one(); ServiceOrder order = serviceOrderService.lambdaQuery().eq(ServiceOrder::getUnid, unid).one();
ServiceOrderVO vo = converter.convert(order, ServiceOrderVO.class); ServiceOrderVO vo = converter.convert(order, ServiceOrderVO.class);
vo.setServiceType(serviceTypeMap.get(order.getServiceType())); vo.setServiceType(serviceTypeMap.get(order.getServiceType()));
......
...@@ -93,6 +93,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord ...@@ -93,6 +93,7 @@ public class DeliveryRecordServiceImpl extends MPJBaseServiceImpl<DeliveryRecord
@Override @Override
public String saveBatch(List<DeliveryRecordDTO> dto) { public String saveBatch(List<DeliveryRecordDTO> dto) {
List<DeliveryRecord> records = converter.convert(dto, DeliveryRecord.class); List<DeliveryRecord> records = converter.convert(dto, DeliveryRecord.class);
// todo 合同编号如何和合同id关联起来
if (this.saveBatch(records)) { if (this.saveBatch(records)) {
records.forEach(this::updStatusAndPushMsg); records.forEach(this::updStatusAndPushMsg);
return "新增成功"; return "新增成功";
......
...@@ -331,8 +331,10 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po ...@@ -331,8 +331,10 @@ public class PointInfoServiceImpl extends MPJBaseServiceImpl<PointInfoMapper, Po
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public String delById(Long id) { public String delById(Long id) {
if (this.removeById(id)) { if (this.removeById(id)) {
// todo 文件删除 var fileList = fileService.lambdaQuery().eq(FileInfo::getSourceId, id).in(FileInfo::getSourceType,
fileService.lambdaUpdate().eq(FileInfo::getSourceId, id).in(FileInfo::getSourceType, ListUtil.of(5, 16, 17, 18, 19, 20)).remove(); ListUtil.of(5, 16, 17, 18, 19, 20)).list();
fileList.forEach(f -> FileUtil.del(f.getUrl()));
fileService.removeBatchByIds(fileList.stream().map(FileInfo::getId).collect(Collectors.toList()));
pointWxService.lambdaUpdate().eq(RPointWx::getPointId, id).remove(); pointWxService.lambdaUpdate().eq(RPointWx::getPointId, id).remove();
rejectInfoService.lambdaUpdate().eq(RejectInfo::getPointId, id).remove(); rejectInfoService.lambdaUpdate().eq(RejectInfo::getPointId, id).remove();
pointDeviceService.lambdaUpdate().eq(RPointDevice::getPointId, id).remove(); pointDeviceService.lambdaUpdate().eq(RPointDevice::getPointId, id).remove();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!