|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.gis.cms.entity.dto.SomeDataDto;
|
|
|
+import com.gis.cms.entity.dto.WorkDto;
|
|
|
import com.gis.cms.entity.po.WorkEntity;
|
|
|
import com.gis.cms.mapper.WorkMapper;
|
|
|
import com.gis.cms.service.WorkService;
|
|
@@ -25,6 +26,7 @@ import com.gis.common.util.RedisUtil;
|
|
|
import com.gis.common.util.Result;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -85,23 +87,17 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, WorkEntity> impleme
|
|
|
/**
|
|
|
* 目前只是用来保存密码, 也可以使用保存实体信息
|
|
|
*/
|
|
|
-// @Override
|
|
|
-// public Result<WorkEntity> entitySave(WorkDto param) {
|
|
|
-//// String id = param.getId();
|
|
|
-////// WorkEntity entity = this.findById(id);
|
|
|
-////
|
|
|
-//// WorkEntity entity = entityMapper.selectByPrimaryKey(id);
|
|
|
-////
|
|
|
-//// if (entity == null) {
|
|
|
-//// return Result.failure("对象不存在");
|
|
|
-//// }
|
|
|
-//// BeanUtils.copyProperties(param, entity);
|
|
|
-////
|
|
|
-//// entity.setUpdateTime(new Date());
|
|
|
-//// this.update(entity);
|
|
|
-//
|
|
|
-// return Result.success();
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public Result<WorkEntity> entitySave(WorkDto param) {
|
|
|
+ WorkEntity entity = this.getById(param.getId());
|
|
|
+ BaseRuntimeException.isNull(entity, ErrorEnum.FAILURE_SYS_2001);
|
|
|
+
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
+
|
|
|
+ entity.setUpdateTime(LocalDateTime.now());
|
|
|
+ this.updateById(entity);
|
|
|
+ return Result.success(entity);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -149,10 +145,7 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, WorkEntity> impleme
|
|
|
if (entity == null) {
|
|
|
return Result.success();
|
|
|
}
|
|
|
- entity.setIsDelete(1);
|
|
|
- entity.setUpdateTime(LocalDateTime.now());
|
|
|
-
|
|
|
- this.updateById(entity);
|
|
|
+ this.removeById(id);
|
|
|
|
|
|
// 删除redis
|
|
|
redisUtil.del(RedisConstant.WORK_ID + id);
|
|
@@ -417,6 +410,16 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, WorkEntity> impleme
|
|
|
return Result.success(uploadMap);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result uploadFixByWork(MultipartFile file, String workId) {
|
|
|
+ // 检查非法文件上传
|
|
|
+ BaseRuntimeException.isHas(!fileUtils.checkFile(file), null, "上传文件格式有误, 请重新上传");
|
|
|
+ Map<String, Object> uploadMap = fileUtils.uploadMap(file, "/" + workId, true);
|
|
|
+ return Result.success(uploadMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// @Override
|
|
|
// public List<WorkEntity> likeSceneCode(String sceneCode) {
|
|
|
// sceneCode = "%" + sceneCode + "%";
|