package cn.com.taiji.core.entity.comm; | package cn.com.taiji.core.entity.comm; | ||||
import cn.com.taiji.common.entity.StringPropertyUUIDEntity; | import cn.com.taiji.common.entity.StringPropertyUUIDEntity; | ||||
import cn.com.taiji.core.entity.AbstractStringPropertyUUIDEntity; | |||||
import cn.com.taiji.core.entity.dict.EnableStatus; | import cn.com.taiji.core.entity.dict.EnableStatus; | ||||
import lombok.Getter; | import lombok.Getter; | ||||
import lombok.Setter; | import lombok.Setter; | ||||
import org.hibernate.annotations.Where; | |||||
import javax.persistence.*; | import javax.persistence.*; | ||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
@Getter | @Getter | ||||
@Entity | @Entity | ||||
@Table(name = "COMM_APP_VERSION") | @Table(name = "COMM_APP_VERSION") | ||||
@Where(clause = "DELETED = 0") | |||||
public class CommonAppVersion extends StringPropertyUUIDEntity { | public class CommonAppVersion extends StringPropertyUUIDEntity { | ||||
@Column(name = "RELEASE_TIME") | @Column(name = "RELEASE_TIME") |
import cn.com.taiji.core.entity.dict.operation.TriggerType; | import cn.com.taiji.core.entity.dict.operation.TriggerType; | ||||
import lombok.Getter; | import lombok.Getter; | ||||
import lombok.Setter; | import lombok.Setter; | ||||
import org.hibernate.annotations.Where; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import javax.persistence.*; | import javax.persistence.*; | ||||
@Getter | @Getter | ||||
@Setter | @Setter | ||||
@Table(name = "MANAGEW_NOTICE_FLASH") | @Table(name = "MANAGEW_NOTICE_FLASH") | ||||
@Where(clause = "DELETED = 0") | |||||
public class NoticeFlash extends AbstractStringPropertyUUIDEntity { | public class NoticeFlash extends AbstractStringPropertyUUIDEntity { | ||||
@Column(name = "TITLE") | @Column(name = "TITLE") |
@Override | @Override | ||||
public HqlBuilder toSelectHql() { | public HqlBuilder toSelectHql() { | ||||
HqlBuilder hql = new HqlBuilder("from " + CommonAppVersion.class.getName() + " where 1=1 and deleted = 0"); | |||||
HqlBuilder hql = new HqlBuilder("from " + CommonAppVersion.class.getName() + " where 1=1"); | |||||
hql.append(" and version like :version ", like(version)); | hql.append(" and version like :version ", like(version)); | ||||
hql.append(" and status = :status ", status); | hql.append(" and status = :status ", status); | ||||
hql.append(" and releaseTime >= :startTime ", startTime); | hql.append(" and releaseTime >= :startTime ", startTime); |
import lombok.Setter; | import lombok.Setter; | ||||
import javax.validation.constraints.NotBlank; | import javax.validation.constraints.NotBlank; | ||||
import javax.validation.constraints.NotNull; | |||||
@Setter | @Setter | ||||
@Getter | @Getter | ||||
private String id; | private String id; | ||||
@ApiModelProperty(value = "状态") | @ApiModelProperty(value = "状态") | ||||
@NotBlank(message = "状态不能为空") | |||||
@NotNull(message = "状态不能为空") | |||||
private EnableStatus status; | private EnableStatus status; | ||||
if (appVersion == null){ | if (appVersion == null){ | ||||
throw new ManagerException("未获取到该版本数据"); | throw new ManagerException("未获取到该版本数据"); | ||||
} | } | ||||
CommonAppVersion version = appVersionRepo.findByVersion(dto.getVersion()); | |||||
if (version != null){ | |||||
throw new ManagerException("当前版本已存在"); | |||||
if (appVersion.getVersion() != dto.getVersion()){ | |||||
CommonAppVersion version = appVersionRepo.findByVersion(dto.getVersion()); | |||||
if (version != null){ | |||||
throw new ManagerException("当前版本已存在"); | |||||
} | |||||
} | } | ||||
BeanTools.copyProperties(dto, appVersion); | BeanTools.copyProperties(dto, appVersion); | ||||
appVersion.setUpdateTime(LocalDateTime.now()); | appVersion.setUpdateTime(LocalDateTime.now()); | ||||
if (appVersion.getStatus() == EnableStatus.ENABLE){ | if (appVersion.getStatus() == EnableStatus.ENABLE){ | ||||
throw new ManagerException("该版本启用状态,不能删除"); | throw new ManagerException("该版本启用状态,不能删除"); | ||||
} | } | ||||
appVersion.setDeleted(false); | |||||
appVersion.setDeleted(true); | |||||
appVersionRepo.persist(appVersion); | appVersionRepo.persist(appVersion); | ||||
//日志 | //日志 | ||||
persistOperateLog(OperateType.APP_VERSION_DELETE, appVersion.getId(), dto.getOrderSource(), findOpenIdByToken(dto.getAccessToken()), "APP版本删除"); | persistOperateLog(OperateType.APP_VERSION_DELETE, appVersion.getId(), dto.getOrderSource(), findOpenIdByToken(dto.getAccessToken()), "APP版本删除"); |