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

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

parent 876dd01a
......@@ -140,10 +140,15 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
}
//发布应用
bizAgentApplicationPublishService.deleteByAgentId(bizAgentApplicationInfoEntity.getAgentId());
BizAgentApplicationPublishEntity publishEntity = new BizAgentApplicationPublishEntity();
BeanUtil.copyProperties(bizAgentApplicationInfoEntity, publishEntity);
BizAgentApplicationPublishEntity oldPublishEntity = bizAgentApplicationPublishService.getByAgentId(bizAgentApplicationInfoEntity.getAgentId());
if (oldPublishEntity != null) {
publishEntity.setId(oldPublishEntity.getId());
bizAgentApplicationPublishService.update(publishEntity);
} else {
bizAgentApplicationPublishService.save(publishEntity);
}
//【变量】结构改变,删除会话缓存
List<DialogsIdsQueryByAgentIdQueryItem> items = bizAgentApplicationDialoguesRecordService.queryDialogsIds(bizAgentApplicationInfoEntity.getAgentId());
......
......@@ -62,7 +62,6 @@ public class BizAgentApplicationPublishConvert {
entity.setCreatedTime(model.getCreatedTime());
entity.setModifier(model.getModifier());
entity.setModifiedTime(model.getModifiedTime());
entity.setSysVersion(model.getSysVersion());
return entity;
}
......@@ -101,7 +100,6 @@ public class BizAgentApplicationPublishConvert {
model.setCreatedTime(entity.getCreatedTime());
model.setModifier(entity.getModifier());
model.setModifiedTime(entity.getModifiedTime());
model.setSysVersion(entity.getSysVersion());
return model;
}
......
......@@ -340,16 +340,5 @@ public class BizAgentApplicationPublishEntity {
public void setModifiedTime(java.util.Date 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 {
BizAgentApplicationPublishDto save(@RequestBody BizAgentApplicationPublishDto dto) throws Exception;
BizAgentApplicationPublishDto update(@RequestBody BizAgentApplicationPublishDto dto) 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
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{
Assert.notNull(id);
bizAgentApplicationPublishService.deletedById(id);
......
......@@ -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.repository.BizAgentApplicationPublishRepository;
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.StringUtils;
import org.springframework.stereotype.Service;
......@@ -89,15 +91,17 @@ public class BizAgentApplicationPublishServiceImpl extends BaseServiceImpl
Assert.notNull(entity);
Assert.notNull(entity.getId(), "update pk can not be null");
BizAgentApplicationPublishModel model = this.repository.get(entity.getId());
model.setAgentId(entity.getAgentId());
model.setIsDeleted(CommonConstant.IsDeleted.N);
List<BizAgentApplicationPublishModel> models = this.repository.findByExample(model);
if (CollectionUtils.isEmpty(models)) {
throw new I18nMessageException("exception/data.does.not.exist");
}
model = models.get(0);
paramVerificationAndConvert(entity, model);
BizAgentApplicationPublishModel saveModel = this.repository.save(model);
if (model == null) {
throw new I18nMessageException("exception/publication.failed");
}
BizAgentApplicationPublishModel updateModel = BizAgentApplicationPublishConvert.entityToModel(entity);
updateModel.setIsDeleted(CommonConstant.IsDeleted.N);
updateModel.setCreator(model.getCreator());
updateModel.setCreatedTime(model.getCreatedTime());
updateModel.setModifier(null);
updateModel.setModifiedTime(null);
updateModel.setSysVersion(model.getSysVersion());
BizAgentApplicationPublishModel saveModel = this.repository.save(updateModel);
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