|
@@ -285,16 +285,17 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
}
|
|
|
|
|
|
// 更新作品信息
|
|
|
- boolean isEdit = editEntity(param, entity);
|
|
|
+ JSONObject someDataToJson = someDataToJson(param);
|
|
|
+ boolean isEdit = editEntity(someDataToJson, entity);
|
|
|
DateUtils.spendTime(startTime, "更新作品表完成");
|
|
|
if (!isEdit) {
|
|
|
return Result.failure(ErrorEnum.FAILURE_SYS_3001.code(), "对象不存在");
|
|
|
}
|
|
|
|
|
|
log.info("更新作品完成");
|
|
|
- JSONObject someDataToJson = someDataToJson(param);
|
|
|
+
|
|
|
// 保存someData.json
|
|
|
- editSomeData(param);
|
|
|
+ editSomeData(someDataToJson, id);
|
|
|
DateUtils.spendTime(startTime, "someData更新oss完成");
|
|
|
|
|
|
// 更新跟目录tour.xml 2022-09-15
|
|
@@ -355,20 +356,18 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
/**
|
|
|
* 更新作品实体信息
|
|
|
*/
|
|
|
- private boolean editEntity(SomeDataDto param, WorkEntity entity) {
|
|
|
- String someData = param.getSomeData();
|
|
|
- JSONObject sd = JSONObject.parseObject(someData);
|
|
|
- entity.setName(sd.getString("name"));
|
|
|
- entity.setIcon(sd.getString("icon"));
|
|
|
- entity.setShare(sd.getString("share"));
|
|
|
- entity.setQrCode(sd.getString("qrCode"));
|
|
|
- entity.setStatus(sd.getInteger("status"));
|
|
|
- entity.setPassword(sd.getString("password"));
|
|
|
- String scenes = sd.getString("scenes");
|
|
|
+ private boolean editEntity(JSONObject someDataJson, WorkEntity entity) {
|
|
|
+ entity.setName(someDataJson.getString("name"));
|
|
|
+ entity.setIcon(someDataJson.getString("icon"));
|
|
|
+ entity.setShare(someDataJson.getString("share"));
|
|
|
+ entity.setQrCode(someDataJson.getString("qrCode"));
|
|
|
+ entity.setStatus(someDataJson.getInteger("status"));
|
|
|
+ entity.setPassword(someDataJson.getString("password"));
|
|
|
+ String scenes = someDataJson.getString("scenes");
|
|
|
entity.setSceneCodes(getSceneCodes(scenes));
|
|
|
// 更新logoQrCode
|
|
|
- Boolean logoChange = sd.getBoolean("logoChange");
|
|
|
- String logoUrl = sd.getString("logo");
|
|
|
+ Boolean logoChange = someDataJson.getBoolean("logoChange");
|
|
|
+ String logoUrl = someDataJson.getString("logo");
|
|
|
if (logoChange) {
|
|
|
Boolean isLogo = updateQrCode(entity.getId(), logoUrl);
|
|
|
if (!isLogo) {
|
|
@@ -376,11 +375,11 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
entity.setUpdateTime(new Date());
|
|
|
-
|
|
|
this.update(entity);
|
|
|
+
|
|
|
+ // 2022-10-28 将更新logoChange重置为false, 防止下次又自动生成logo二维码
|
|
|
+ someDataJson.put("logoChange", false);
|
|
|
return true;
|
|
|
|
|
|
}
|
|
@@ -450,21 +449,21 @@ public class WorkServiceImpl extends IBaseStrServiceImpl<WorkEntity, String> imp
|
|
|
/**
|
|
|
* 更新someData.json
|
|
|
*/
|
|
|
- private void editSomeData(SomeDataDto param) {
|
|
|
+ private void editSomeData(JSONObject someDataJson, String workId) {
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
|
|
- String id = param.getId();
|
|
|
- String baseSomeDathPath = id + "/someData.json";
|
|
|
- String saveSomeDataPath = configConstant.serverBasePath + baseSomeDathPath;
|
|
|
+// String id = param.getId();
|
|
|
+ String baseSomeDataPath = workId + "/someData.json";
|
|
|
+ String saveSomeDataPath = configConstant.serverBasePath + baseSomeDataPath;
|
|
|
// 写入服务器
|
|
|
- FileUtil.writeUtf8String(param.getSomeData(), saveSomeDataPath);
|
|
|
+ FileUtil.writeUtf8String(someDataJson.toJSONString(), saveSomeDataPath);
|
|
|
|
|
|
// 保存oss
|
|
|
if (!FileUtil.isFile(saveSomeDataPath)) {
|
|
|
Result.failure(ErrorEnum.FAILURE_CODE_3103.code(), "服务器someData.json文件不存在");
|
|
|
}
|
|
|
DateUtils.spendTime(startTime, "someData写入服务器");
|
|
|
- String ossKeyPath = configConstant.ossBasePath + baseSomeDathPath;
|
|
|
+ String ossKeyPath = configConstant.ossBasePath + baseSomeDataPath;
|
|
|
aliyunOssUtil.upload(saveSomeDataPath, ossKeyPath);
|
|
|
log.info("someData.json 上传完成 : {}", ossKeyPath);
|
|
|
String ossUrl = configConstant.ossDomain + ossKeyPath;
|