|
@@ -4,10 +4,11 @@ import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.amazonaws.services.dynamodbv2.xspec.S;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.gis.common.constant.ConfigConstant;
|
|
|
import com.gis.common.constant.ErrorEnum;
|
|
|
import com.gis.common.constant.RedisConstant;
|
|
@@ -16,17 +17,14 @@ import com.gis.common.exception.BaseRuntimeException;
|
|
|
import com.gis.common.httpclient.FdkkClient;
|
|
|
import com.gis.common.util.*;
|
|
|
import com.gis.domain.dto.*;
|
|
|
-import com.gis.domain.entity.FodderEntity;
|
|
|
-import com.gis.domain.entity.WorkEntity;
|
|
|
-import com.gis.domain.entity.WorkHotsFodderEntity;
|
|
|
+import com.gis.domain.entity.*;
|
|
|
import com.gis.domain.vo.ReportWorkVo;
|
|
|
import com.gis.mapper.*;
|
|
|
import com.gis.oss.util.FileAndOssUtil;
|
|
|
import com.gis.oss.util.FileUtils;
|
|
|
import com.gis.oss.util.QrCodeUtils;
|
|
|
-import com.gis.service.FodderService;
|
|
|
-import com.gis.service.WorkHotsFodderService;
|
|
|
-import com.gis.service.WorkService;
|
|
|
+import com.gis.service.*;
|
|
|
+import com.gis.util.UserRequest;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -39,7 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
-import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
@@ -53,7 +50,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
-public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> implements WorkService {
|
|
|
+public class WorkServiceImpl extends ServiceImpl<WorkMapper,WorkEntity> implements WorkService {
|
|
|
|
|
|
@Autowired
|
|
|
private WorkMapper entityMapper;
|
|
@@ -84,16 +81,29 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
@Resource
|
|
|
FdkkClient fdkkClient;
|
|
|
|
|
|
- @Override
|
|
|
- public IBaseStrMapper<WorkEntity, String> getBaseMapper() {
|
|
|
- return this.entityMapper;
|
|
|
- }
|
|
|
+ @Autowired
|
|
|
+ WorkOpeningTipService workOpeningTipService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ WorkOpeningAnimationService workOpeningAnimationService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ WorkCoverTypeService workCoverTypeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ WorkLogoService workLogoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ WorkCustomMaskService workCustomMaskService;
|
|
|
+ @Autowired
|
|
|
+ WorkCustomButtonService workCustomButtonService;
|
|
|
+ @Autowired
|
|
|
+ UserRequest userRequest;
|
|
|
|
|
|
@Override
|
|
|
public Result search(AgePageDto param, boolean isAdmin) {
|
|
|
- startPage(param);
|
|
|
- String userNameForToken = getUserNameForToken();
|
|
|
+ PageHelper.startPage(param.getPageNum(), param.getPageSize(), true);
|
|
|
+ String userNameForToken = userRequest.getUserNameForToken();
|
|
|
if (isAdmin){
|
|
|
userNameForToken = null;
|
|
|
}
|
|
@@ -134,7 +144,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
@Override
|
|
|
public Result<WorkEntity> entitySave(WorkDto param) {
|
|
|
String id = param.getId();
|
|
|
- WorkEntity entity = entityMapper.selectByPrimaryKey(id);
|
|
|
+ WorkEntity entity = getById(id);
|
|
|
|
|
|
if (entity == null) {
|
|
|
return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(),"对象不存在");
|
|
@@ -142,7 +152,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
BeanUtils.copyProperties(param, entity);
|
|
|
|
|
|
entity.setUpdateTime(new Date());
|
|
|
- this.update(entity);
|
|
|
+ this.updateById(entity);
|
|
|
|
|
|
return Result.success();
|
|
|
}
|
|
@@ -154,7 +164,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
WorkEntity entity = new WorkEntity();
|
|
|
entity.setId(SnowFlakeUUidUtils.getUuid("WK"));
|
|
|
- entity.setUserId(getUserNameForToken());
|
|
|
+ entity.setUserId(userRequest.getUserNameForToken());
|
|
|
entity.setStatus(0);
|
|
|
Date date = new Date();
|
|
|
entity.setCreateTime(date);
|
|
@@ -190,7 +200,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
// 创建二维码、二维码url
|
|
|
String shareUrl = configConstant.domain4dKK + "/panorama/showMobile.html?id=" + id;
|
|
|
- String qrCode = qrCodeUtils.generateLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, id);
|
|
|
+ String qrCode = qrCodeUtils.generateLogoQrCode(shareUrl, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, id,"zh");
|
|
|
jsonObject.put("share", shareUrl);
|
|
|
jsonObject.put("qrCode", qrCode);
|
|
|
|
|
@@ -239,7 +249,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
@Override
|
|
|
public Result remove(String id) {
|
|
|
- WorkEntity entity = this.findById(id);
|
|
|
+ WorkEntity entity = getById(id);
|
|
|
if (entity == null) {
|
|
|
return Result.success();
|
|
|
}
|
|
@@ -249,7 +259,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
// 删除服务器器文件
|
|
|
fileUtils.del(entity.getId());
|
|
|
|
|
|
- this.update(entity);
|
|
|
+ this.updateById(entity);
|
|
|
|
|
|
// 删除redis
|
|
|
redisUtil.delete(RedisConstant.WORK_ID + id);
|
|
@@ -277,25 +287,24 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
@Override
|
|
|
public List<WorkEntity> findByStatus(int i) {
|
|
|
- Condition condition = new Condition(WorkEntity.class);
|
|
|
- condition.and().andEqualTo("status", i);
|
|
|
-
|
|
|
- return this.findAll(condition);
|
|
|
+ LambdaQueryWrapper<WorkEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(WorkEntity::getStatus, i);
|
|
|
+ return list(wrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<WorkEntity> getUserWork() {
|
|
|
- Condition condition = new Condition(WorkEntity.class);
|
|
|
- condition.and().andEqualTo("status", 1);
|
|
|
- condition.and().andEqualTo("userId", this.getUserNameForToken());
|
|
|
- return this.findAll(condition);
|
|
|
+ LambdaQueryWrapper<WorkEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(WorkEntity::getStatus, 1);
|
|
|
+ wrapper.eq(WorkEntity::getUserId, userRequest.getUserNameForToken());
|
|
|
+ return list(wrapper);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean getUserWorkCountBySceneCodes(List<String> sceneCodes) {
|
|
|
for (String sceneCode : sceneCodes) {
|
|
|
String format = StrUtil.format("SELECT count(1) FROM tb_work WHERE is_delete=0 and status={} and user_id = '{}' and find_in_set('{}' , scene_codes ) ",
|
|
|
- 1, this.getUserNameForToken(),sceneCode);
|
|
|
+ 1, userRequest.getUserNameForToken(),sceneCode);
|
|
|
Integer count = entityMapper.getCountStr(format);
|
|
|
if (count > 0){
|
|
|
return true;
|
|
@@ -418,7 +427,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
} catch (InterruptedException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- String userNameForToken = getUserNameForToken();
|
|
|
+ String userNameForToken = userRequest.getUserNameForToken();
|
|
|
if (!userNameForToken.equals(entity.getUserId())) {
|
|
|
return Result.failure(ErrorEnum.FAILURE_SYS_3011.code(), "当前无操作权限");
|
|
|
}
|
|
@@ -574,7 +583,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
}
|
|
|
}
|
|
|
entity.setUpdateTime(new Date());
|
|
|
- this.update(entity);
|
|
|
+ this.updateById(entity);
|
|
|
|
|
|
// 2022-10-28 将更新logoChange重置为false, 防止下次又自动生成logo二维码
|
|
|
someDataJson.put("logoChange", false);
|
|
@@ -587,7 +596,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
if (ObjectUtil.isNotNull(workHotsFodderEntity)){
|
|
|
workHotsFodderEntity.setFodderId(Long.valueOf(String.valueOf(id)));
|
|
|
workHotsFodderEntity.setWorkId(entity.getId());
|
|
|
- workHotsFodderService.update(workHotsFodderEntity);
|
|
|
+ workHotsFodderService.updateById(workHotsFodderEntity);
|
|
|
}else {
|
|
|
workHotsFodderEntity=new WorkHotsFodderEntity();
|
|
|
workHotsFodderEntity.setFodderId(Long.valueOf(String.valueOf(id)));
|
|
@@ -655,7 +664,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
entity.setTitle(hotspotTitle);
|
|
|
entity.setName(name);
|
|
|
entity.setType(SomeDataConstant.hot);
|
|
|
- workHotsFodderService.update(entity);
|
|
|
+ workHotsFodderService.updateById(entity);
|
|
|
}else {
|
|
|
entity=new WorkHotsFodderEntity();
|
|
|
entity.setSceneCode(sceneCode);
|
|
@@ -687,7 +696,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
workHotsFodderEntity.setWorkId(workId);
|
|
|
workHotsFodderEntity.setName(audioName);
|
|
|
workHotsFodderEntity.setType(SomeDataConstant.explanation_audio);
|
|
|
- workHotsFodderService.update(workHotsFodderEntity);
|
|
|
+ workHotsFodderService.updateById(workHotsFodderEntity);
|
|
|
}else {
|
|
|
workHotsFodderEntity=new WorkHotsFodderEntity();
|
|
|
workHotsFodderEntity.setSceneCode(sceneCode);
|
|
@@ -827,7 +836,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
|
|
|
@Override
|
|
|
public Result select4dkk(PageDto param, String workId) {
|
|
|
- startPage(param);
|
|
|
+ PageHelper.startPage(param.getPageNum(), param.getPageSize(), true);
|
|
|
|
|
|
String url = configConstant.domain4dKK + "/api/user/scene/list";
|
|
|
JSONObject reqParam = new JSONObject();
|
|
@@ -842,7 +851,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
reqParam.put("sceneSource", "1,3");
|
|
|
|
|
|
HashMap<String, String> headers = new HashMap<>();
|
|
|
- String token = getToken();
|
|
|
+ String token = userRequest.getCurrentToken();
|
|
|
if (StringUtils.isBlank(token)) {
|
|
|
return Result.failure(ErrorEnum.FAILURE_SYS_5001.code(), "token无空");
|
|
|
}
|
|
@@ -896,7 +905,7 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
@Override
|
|
|
public List<WorkEntity> likeSceneCode(String sceneCode) {
|
|
|
sceneCode = "%" + sceneCode + "%";
|
|
|
- return entityMapper.likeSceneCode(sceneCode, getUserNameForToken());
|
|
|
+ return entityMapper.likeSceneCode(sceneCode, userRequest.getUserNameForToken());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1037,4 +1046,91 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
return Result.success();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result addWork(WorkAddDto workAddDto) {
|
|
|
+
|
|
|
+ WorkEntity entity = new WorkEntity();
|
|
|
+ entity.setId(SnowFlakeUUidUtils.getUuid("WK"));
|
|
|
+ entity.setUserId(userRequest.getUserNameForToken());
|
|
|
+ entity.setStatus(1);
|
|
|
+ Date date = new Date();
|
|
|
+ entity.setCreateTime(date);
|
|
|
+ entity.setUpdateTime(date);
|
|
|
+ entity.setIcon(workAddDto.getIcon());
|
|
|
+
|
|
|
+ String id = entity.getId();
|
|
|
+ log.info("创建对象完成: {}", id);
|
|
|
+
|
|
|
+ // 创建二维码、二维码url
|
|
|
+ String shareUrlZH = configConstant.domain4dKK + "/panorama/showMobile.html?lang=zh&id=" + id;
|
|
|
+ String shareUrlEN = configConstant.domain4dKK + "/panorama/showMobile.html?lang=en&id=" + id;
|
|
|
+ String qrZHCode = qrCodeUtils.generateLogoQrCode(shareUrlZH, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, id,"zh");
|
|
|
+ String qrENCode = qrCodeUtils.generateLogoQrCode(shareUrlEN, configConstant.serverBasePath, configConstant.ossBasePath, configConstant.ossDomain, id,"en");
|
|
|
+ entity.setQrCode(qrZHCode);
|
|
|
+ entity.setQrENCode(qrENCode);
|
|
|
+ this.save(entity);
|
|
|
+
|
|
|
+ WorkOpeningTipEntity workOpeningTipEntity=new WorkOpeningTipEntity();
|
|
|
+ workOpeningTipEntity.setWorkId(entity.getId());
|
|
|
+ workOpeningTipEntity.setIsRemind(1);
|
|
|
+ workOpeningTipEntity.setRemindTime(1);
|
|
|
+ workOpeningTipService.save(workOpeningTipEntity);
|
|
|
+
|
|
|
+ WorkOpeningAnimationEntity workOpeningAnimationEntity=new WorkOpeningAnimationEntity();
|
|
|
+ workOpeningAnimationEntity.setIsShowOpeningAnimation(true);
|
|
|
+ workOpeningAnimationEntity.setOpeningAnimationType(1);
|
|
|
+ workOpeningAnimationEntity.setWorkId(entity.getId());
|
|
|
+ workOpeningAnimationService.save(workOpeningAnimationEntity);
|
|
|
+
|
|
|
+
|
|
|
+ WorkCoverTypeEntity workCoverTypeEntity=new WorkCoverTypeEntity();
|
|
|
+ workCoverTypeEntity.setWorkId(entity.getId());
|
|
|
+ workCoverTypeService.save(workCoverTypeEntity);
|
|
|
+
|
|
|
+ WorkLogoEntity workLogoEntity=new WorkLogoEntity();
|
|
|
+ workLogoEntity.setWorkId(entity.getId());
|
|
|
+ workLogoService.save(workLogoEntity);
|
|
|
+
|
|
|
+ WorkCustomMaskEntity earth=new WorkCustomMaskEntity();
|
|
|
+ earth.setWorkId(entity.getId());
|
|
|
+ earth.setType("earth");
|
|
|
+ workCustomMaskService.save(earth);
|
|
|
+ WorkCustomMaskEntity sky=new WorkCustomMaskEntity();
|
|
|
+ sky.setWorkId(entity.getId());
|
|
|
+ sky.setType("sky");
|
|
|
+ workCustomMaskService.save(sky);
|
|
|
+
|
|
|
+ WorkCustomButtonEntity phone=new WorkCustomButtonEntity();
|
|
|
+ phone.setWorkId(entity.getId());
|
|
|
+ phone.setName("电话");
|
|
|
+ phone.setType("phone");
|
|
|
+ workCustomButtonService.save(phone);
|
|
|
+
|
|
|
+ WorkCustomButtonEntity link=new WorkCustomButtonEntity();
|
|
|
+ link.setWorkId(entity.getId());
|
|
|
+ link.setName("链接");
|
|
|
+ link.setType("link");
|
|
|
+ workCustomButtonService.save(link);
|
|
|
+
|
|
|
+ return Result.success(entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result<WorkEntity> editWork(WordAllDto workAddDto) {
|
|
|
+ if (ObjectUtil.isNotNull(workAddDto.getWorkInfo())){
|
|
|
+ WorkNewDto workInfo = workAddDto.getWorkInfo();
|
|
|
+ WorkEntity workEntity = new WorkEntity();
|
|
|
+ BeanUtils.copyProperties(workInfo, workEntity);
|
|
|
+ updateById(workEntity);
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotNull(workAddDto.getWorkOpeningTipInfo())){
|
|
|
+ WorkOpeningTipDTO workOpeningTipInfo = workAddDto.getWorkOpeningTipInfo();
|
|
|
+ WorkOpeningTipEntity workOpeningTipEntity = new WorkOpeningTipEntity();
|
|
|
+ BeanUtils.copyProperties(workOpeningTipInfo, workOpeningTipEntity,"parentId");
|
|
|
+ workOpeningTipService.updateById(workOpeningTipEntity);
|
|
|
+
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|