Commit 7747acf1 authored by alex yao's avatar alex yao

fix:【应用广场】应用更新发布后,应用不应在应用广场自动下架

parent 876dd01a
...@@ -140,10 +140,15 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ ...@@ -140,10 +140,15 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
} }
//发布应用 //发布应用
bizAgentApplicationPublishService.deleteByAgentId(bizAgentApplicationInfoEntity.getAgentId());
BizAgentApplicationPublishEntity publishEntity = new BizAgentApplicationPublishEntity(); BizAgentApplicationPublishEntity publishEntity = new BizAgentApplicationPublishEntity();
BeanUtil.copyProperties(bizAgentApplicationInfoEntity, publishEntity); BeanUtil.copyProperties(bizAgentApplicationInfoEntity, publishEntity);
BizAgentApplicationPublishEntity oldPublishEntity = bizAgentApplicationPublishService.getByAgentId(bizAgentApplicationInfoEntity.getAgentId());
if (oldPublishEntity != null) {
publishEntity.setId(oldPublishEntity.getId());
bizAgentApplicationPublishService.update(publishEntity);
} else {
bizAgentApplicationPublishService.save(publishEntity); bizAgentApplicationPublishService.save(publishEntity);
}
//【变量】结构改变,删除会话缓存 //【变量】结构改变,删除会话缓存
List<DialogsIdsQueryByAgentIdQueryItem> items = bizAgentApplicationDialoguesRecordService.queryDialogsIds(bizAgentApplicationInfoEntity.getAgentId()); List<DialogsIdsQueryByAgentIdQueryItem> items = bizAgentApplicationDialoguesRecordService.queryDialogsIds(bizAgentApplicationInfoEntity.getAgentId());
......
...@@ -62,7 +62,6 @@ public class BizAgentApplicationPublishConvert { ...@@ -62,7 +62,6 @@ public class BizAgentApplicationPublishConvert {
entity.setCreatedTime(model.getCreatedTime()); entity.setCreatedTime(model.getCreatedTime());
entity.setModifier(model.getModifier()); entity.setModifier(model.getModifier());
entity.setModifiedTime(model.getModifiedTime()); entity.setModifiedTime(model.getModifiedTime());
entity.setSysVersion(model.getSysVersion());
return entity; return entity;
} }
...@@ -101,7 +100,6 @@ public class BizAgentApplicationPublishConvert { ...@@ -101,7 +100,6 @@ public class BizAgentApplicationPublishConvert {
model.setCreatedTime(entity.getCreatedTime()); model.setCreatedTime(entity.getCreatedTime());
model.setModifier(entity.getModifier()); model.setModifier(entity.getModifier());
model.setModifiedTime(entity.getModifiedTime()); model.setModifiedTime(entity.getModifiedTime());
model.setSysVersion(entity.getSysVersion());
return model; return model;
} }
......
...@@ -340,16 +340,5 @@ public class BizAgentApplicationPublishEntity { ...@@ -340,16 +340,5 @@ public class BizAgentApplicationPublishEntity {
public void setModifiedTime(java.util.Date modifiedTime){ public void setModifiedTime(java.util.Date modifiedTime){
this.modifiedTime = modifiedTime; this.modifiedTime = modifiedTime;
} }
/** SYS_VERSION
*乐观锁,版本号
*/
private java.lang.Integer sysVersion;
public java.lang.Integer getSysVersion(){
return this.sysVersion;
}
public void setSysVersion(java.lang.Integer sysVersion){
this.sysVersion = sysVersion;
}
} }
\ No newline at end of file
...@@ -18,8 +18,6 @@ public interface BizAgentApplicationPublishRest extends BaseRest { ...@@ -18,8 +18,6 @@ public interface BizAgentApplicationPublishRest extends BaseRest {
BizAgentApplicationPublishDto save(@RequestBody BizAgentApplicationPublishDto dto) throws Exception; BizAgentApplicationPublishDto save(@RequestBody BizAgentApplicationPublishDto dto) throws Exception;
BizAgentApplicationPublishDto update(@RequestBody BizAgentApplicationPublishDto dto) throws Exception;
void deletedById(@RequestParam java.lang.Integer id) throws Exception; void deletedById(@RequestParam java.lang.Integer id) throws Exception;
} }
\ No newline at end of file
...@@ -38,12 +38,6 @@ public class BizAgentApplicationPublishRestImpl implements BizAgentApplicationPu ...@@ -38,12 +38,6 @@ public class BizAgentApplicationPublishRestImpl implements BizAgentApplicationPu
return BizAgentApplicationPublishConvert.entityToDto(bizAgentApplicationPublishService.save(entity)); return BizAgentApplicationPublishConvert.entityToDto(bizAgentApplicationPublishService.save(entity));
} }
public BizAgentApplicationPublishDto update(BizAgentApplicationPublishDto dto) throws Exception{
Assert.notNull(dto);
BizAgentApplicationPublishEntity entity = BizAgentApplicationPublishConvert.dtoToEntity(dto);
return BizAgentApplicationPublishConvert.entityToDto(bizAgentApplicationPublishService.update(entity));
}
public void deletedById(java.lang.Integer id) throws Exception{ public void deletedById(java.lang.Integer id) throws Exception{
Assert.notNull(id); Assert.notNull(id);
bizAgentApplicationPublishService.deletedById(id); bizAgentApplicationPublishService.deletedById(id);
......
...@@ -14,6 +14,8 @@ import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity; ...@@ -14,6 +14,8 @@ import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity;
import cn.com.poc.agent_application.convert.BizAgentApplicationPublishConvert; import cn.com.poc.agent_application.convert.BizAgentApplicationPublishConvert;
import cn.com.poc.agent_application.repository.BizAgentApplicationPublishRepository; import cn.com.poc.agent_application.repository.BizAgentApplicationPublishRepository;
import cn.com.yict.framemax.data.model.PagingInfo; import cn.com.yict.framemax.data.model.PagingInfo;
import cn.hutool.core.bean.BeanUtil;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -89,15 +91,17 @@ public class BizAgentApplicationPublishServiceImpl extends BaseServiceImpl ...@@ -89,15 +91,17 @@ public class BizAgentApplicationPublishServiceImpl extends BaseServiceImpl
Assert.notNull(entity); Assert.notNull(entity);
Assert.notNull(entity.getId(), "update pk can not be null"); Assert.notNull(entity.getId(), "update pk can not be null");
BizAgentApplicationPublishModel model = this.repository.get(entity.getId()); BizAgentApplicationPublishModel model = this.repository.get(entity.getId());
model.setAgentId(entity.getAgentId()); if (model == null) {
model.setIsDeleted(CommonConstant.IsDeleted.N); throw new I18nMessageException("exception/publication.failed");
List<BizAgentApplicationPublishModel> models = this.repository.findByExample(model); }
if (CollectionUtils.isEmpty(models)) { BizAgentApplicationPublishModel updateModel = BizAgentApplicationPublishConvert.entityToModel(entity);
throw new I18nMessageException("exception/data.does.not.exist"); updateModel.setIsDeleted(CommonConstant.IsDeleted.N);
} updateModel.setCreator(model.getCreator());
model = models.get(0); updateModel.setCreatedTime(model.getCreatedTime());
paramVerificationAndConvert(entity, model); updateModel.setModifier(null);
BizAgentApplicationPublishModel saveModel = this.repository.save(model); updateModel.setModifiedTime(null);
updateModel.setSysVersion(model.getSysVersion());
BizAgentApplicationPublishModel saveModel = this.repository.save(updateModel);
return BizAgentApplicationPublishConvert.modelToEntity(saveModel); return BizAgentApplicationPublishConvert.modelToEntity(saveModel);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment