| | |
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.bus.help.HelpClass;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.exception.config.HelpClassException;
|
| | | import com.yeshi.fanli.exception.homemodule.FloatADException;
|
| | | import com.yeshi.fanli.service.inter.help.HelpClassService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | String filePath ="/img/HelpClass/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | String filePath =FilePathEnum.helpClass.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | picture = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | }
|
| | |
|
| | |
| | | if (record.getId() == null) {
|
| | | int maxOrder = helpClassMapper.getMaxOrder();
|
| | | record.setSort(maxOrder + 1);
|
| | | record.setPicture(picture);
|
| | | record.setCreateTime(new Date());
|
| | | helpClassMapper.insertSelective(record);
|
| | | } else {
|
| | | // 修改
|
| | | HelpClass resultObj = helpClassMapper.selectByPrimaryKey(record.getId());
|
| | | if (resultObj == null)
|
| | | throw new FloatADException(1, "修改内容已不存在");
|
| | | throw new HelpClassException(1, "修改内容已不存在");
|
| | |
|
| | | if (picture != null && picture.trim().length() > 0) {
|
| | | String pictureOld = resultObj.getPicture();
|
| | |
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | helpClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void switchState(Long id) throws HelpClassException {
|
| | | if (id == null) {
|
| | | throw new HelpClassException(1, "请传递正确参数");
|
| | | }
|
| | | |
| | | HelpClass resultObj = helpClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new HelpClassException(1, "此内容已不存在");
|
| | | }
|
| | | |
| | | Integer state = resultObj.getShowState();
|
| | | if (state == null || state == 0) {
|
| | | state = 1;
|
| | | } else {
|
| | | state = 0;
|
| | | }
|
| | | |
| | | HelpClass updateObj = new HelpClass();
|
| | | updateObj.setId(id);
|
| | | updateObj.setShowState(state);
|
| | | helpClassMapper.updateByPrimaryKeySelective(updateObj);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | |
|
| | | String filePath ="/img/HelpClass/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | String filePath =FilePathEnum.helpClass.getPath()+ UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | |
|
| | | /* 修改图片时,先删除已存在图片 */
|
| | | String picture = helpClass.getPicture();
|