|
|
@ -50,9 +50,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: yxt_supervise(宇信通监管) <br/> |
|
|
@ -71,6 +69,7 @@ import java.util.Map; |
|
|
|
public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, ShStorehouse> { |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private ShStorehouseAttachmentService shStorehouseAttachmentService; |
|
|
|
private QueryWrapper<ShStorehouse> createQueryWrapper(ShStorehouseQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -104,12 +103,11 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
@Transactional |
|
|
|
public void saveOrUpdateDto(ShStorehouseDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
shStorehouseAttachmentService.deleteByHouseSid(dtoSid); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
this.insertByDto(dto); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.updateByDto(dto); |
|
|
|
} |
|
|
|
|
|
|
@ -127,7 +125,7 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseSid(entity.getSid()); |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseName(entity.getName()); |
|
|
|
ShStorehouseAttachmentDto picdto=new ShStorehouseAttachmentDto(); |
|
|
|
BeanUtil.copyProperties(pic,picdto); |
|
|
|
BeanUtil.copyProperties(shStorehouseAttachmentDetailsVo,picdto); |
|
|
|
shStorehouseAttachmentService.updateByDto(picdto); |
|
|
|
} |
|
|
|
baseMapper.insert(entity); |
|
|
@ -137,7 +135,16 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
List<ShStorehouseAttachmentVo> shStorehouseAttachmentVos=new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(dtoSid)) { |
|
|
|
shStorehouseAttachmentVos= shStorehouseAttachmentService.fetchDetailsVoByShSid(dtoSid); |
|
|
|
} |
|
|
|
Map<String,String> picsmap2=new HashMap<>(); |
|
|
|
for (ShStorehouseAttachmentVo shStorehouseAttachmentVo : shStorehouseAttachmentVos) { |
|
|
|
picsmap2.put(shStorehouseAttachmentVo.getSid(),shStorehouseAttachmentVo.getSid()); |
|
|
|
} |
|
|
|
|
|
|
|
ShStorehouse entity = fetchBySid(dtoSid); |
|
|
|
String provinceName = dto.getProvinceName(); |
|
|
|
String cityName = dto.getCityName(); |
|
|
@ -146,12 +153,25 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
entity.setRegionName(regionName); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
List<String> pics = dto.getPics(); |
|
|
|
Map<String,String> picsmap=new HashMap<>(); |
|
|
|
for (String pic : pics) { |
|
|
|
picsmap.put(pic,pic); |
|
|
|
} |
|
|
|
|
|
|
|
Set<Map.Entry<String, String>> entries = picsmap2.entrySet(); |
|
|
|
for (Map.Entry<String, String> entry : entries) { |
|
|
|
String key = entry.getKey(); |
|
|
|
if(picsmap.get(key)==null){ |
|
|
|
shStorehouseAttachmentService.deleteBySid(key); |
|
|
|
} |
|
|
|
} |
|
|
|
for (String pic : pics) { |
|
|
|
|
|
|
|
ShStorehouseAttachmentDetailsVo shStorehouseAttachmentDetailsVo = shStorehouseAttachmentService.fetchDetailsVoBySid(pic); |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseSid(entity.getSid()); |
|
|
|
shStorehouseAttachmentDetailsVo.setStorehouseName(entity.getName()); |
|
|
|
ShStorehouseAttachmentDto picdto=new ShStorehouseAttachmentDto(); |
|
|
|
BeanUtil.copyProperties(pic,picdto); |
|
|
|
BeanUtil.copyProperties(shStorehouseAttachmentDetailsVo,picdto); |
|
|
|
shStorehouseAttachmentService.updateByDto(picdto); |
|
|
|
} |
|
|
|
baseMapper.updateById(entity); |
|
|
@ -160,7 +180,7 @@ public class ShStorehouseService extends MybatisBaseService<ShStorehouseMapper, |
|
|
|
public ShStorehouseDetailsVo fetchDetailsVoBySid(String sid){ |
|
|
|
ShStorehouse entity = fetchBySid(sid); |
|
|
|
ShStorehouseDetailsVo vo = new ShStorehouseDetailsVo(); |
|
|
|
if (vo==null) |
|
|
|
if (entity==null) |
|
|
|
return null; |
|
|
|
List<ShStorehouseAttachmentVo> pics=shStorehouseAttachmentService.fetchDetailsVoByShSid(sid); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|