|
|
|
@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
@ -55,6 +56,16 @@ public class UpgradeServiceImpl implements UpgradeService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean upload(MntnUpgrades item, MultipartFile file) throws Exception {
|
|
|
|
|
if (StringUtils.hasLength(item.getApp()) && StringUtils.hasLength(item.getVersion())) {
|
|
|
|
|
MntnUpgradesExample example = new MntnUpgradesExample();
|
|
|
|
|
MntnUpgradesExample.Criteria criteria = example.createCriteria();
|
|
|
|
|
criteria.andAppEqualTo(item.getApp());
|
|
|
|
|
criteria.andVersionEqualTo(item.getVersion());
|
|
|
|
|
List<MntnUpgrades> list = mapper.selectByExample(example);
|
|
|
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
|
throw new ApiException("该版本已存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String fileName = file.getOriginalFilename();
|
|
|
|
|
String ext = StringUtils.getFilenameExtension(fileName);
|
|
|
|
|
String path = DateUtil.format(new Date(), "yyyyMMdd") + "_upd_"
|
|
|
|
@ -93,5 +104,8 @@ public class UpgradeServiceImpl implements UpgradeService {
|
|
|
|
|
MntnUpgrades record = mapper.selectByPrimaryKey(id);
|
|
|
|
|
mapper.deleteByPrimaryKey(id);
|
|
|
|
|
new File(apkpath + record.getPath()).delete();
|
|
|
|
|
if (StringUtils.hasLength(record.getApp()) && StringUtils.hasLength(record.getVersion())) {
|
|
|
|
|
patchService.delete(record.getApp(), record.getVersion());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|