@@ -12,7 +12,9 @@ import cn.com.taiji.iaw.manager.AbstractCommManager; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.Comparator; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Auther: humh | |||
@@ -39,8 +41,8 @@ public class NoticeFlashManagerImpl extends AbstractCommManager implements Notic | |||
public NoticeFlashQuerySlideShowResponseDTO querySlideShow(NoticeFlashQuerySlideShowRequestDTO dto) { | |||
NoticeFlashPageRequest pageRequest = new NoticeFlashPageRequest(); | |||
pageRequest.setFlashType(FlashType.SLIDESHOW); | |||
List<NoticeFlash> list = repo.list(pageRequest); | |||
return new NoticeFlashQuerySlideShowResponseDTO(list); | |||
List<NoticeFlash> seqList = repo.list(pageRequest).stream().sorted(Comparator.comparingInt(NoticeFlash::getSequence)).collect(Collectors.toList()); | |||
return new NoticeFlashQuerySlideShowResponseDTO(seqList); | |||
} | |||
} |
@@ -27,19 +27,19 @@ import javax.validation.constraints.NotNull; | |||
public class NoticeFlashAddRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "标题") | |||
@NotBlank | |||
@NotBlank(message = "标题不能为空") | |||
private String title; | |||
@ApiModelProperty(value = "图片地址") | |||
@NotBlank | |||
@NotBlank(message = "图片地址不能为空") | |||
private String imgUrl; | |||
@ApiModelProperty(value = "快讯类型") | |||
@NotNull | |||
@NotNull(message = "快讯类型不能为空") | |||
private FlashType flashType; | |||
@ApiModelProperty(value = "触发类型") | |||
@NotNull | |||
@NotNull(message = "触发类型不能为空") | |||
private TriggerType triggerType; | |||
@ApiModelProperty(value = "超链接") | |||
@@ -52,22 +52,27 @@ public class NoticeFlashAddRequestDTO extends AbstractStaffBizRequestDTO { | |||
private String routeUrl; | |||
@ApiModelProperty(value = "文本类型") | |||
@NotBlank | |||
@NotBlank(message = "文本类型不能为空") | |||
private String textType; | |||
@ApiModelProperty(value = "文本内容") | |||
private String text; | |||
@ApiModelProperty(value = "排序") | |||
@NotNull | |||
private Integer sequence; | |||
@ApiModelProperty(value = "状态") | |||
@NotNull | |||
@NotNull(message = "状态不能为空") | |||
private IsEnable status; | |||
public void valid() throws ManagerException { | |||
if (FlashType.SLIDESHOW.equals(flashType)) { | |||
if (sequence == null) { | |||
throw new ManagerException(flashType.getValue()+"快讯类型的排序必填!"); | |||
} | |||
} | |||
if (TriggerType.THIRD_PARTY_LINK.equals(triggerType)){ | |||
if (StringUtils.isBlank(hyperLink)){ | |||
throw new ManagerException(triggerType.getValue()+"触发类型的超链接必填!"); |
@@ -21,7 +21,7 @@ import javax.validation.constraints.NotBlank; | |||
public class NoticeFlashDeleteRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "id") | |||
@NotBlank | |||
@NotBlank(message = "id不能为空") | |||
private String id; | |||
} |
@@ -23,11 +23,11 @@ import javax.validation.constraints.NotNull; | |||
public class NoticeFlashStatusRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "id") | |||
@NotBlank | |||
@NotBlank(message = "id不能为空") | |||
private String id; | |||
@ApiModelProperty(value = "状态") | |||
@NotNull | |||
@NotNull(message = "状态不能为空") | |||
private IsEnable status; | |||
} |
@@ -31,19 +31,19 @@ public class NoticeFlashUpdateRequestDTO extends AbstractStaffBizRequestDTO { | |||
private String id; | |||
@ApiModelProperty(value = "标题") | |||
@NotBlank | |||
@NotBlank(message = "标题不能为空") | |||
private String title; | |||
@ApiModelProperty(value = "图片地址") | |||
@NotBlank | |||
@NotBlank(message = "图片地址不能为空") | |||
private String imgUrl; | |||
@ApiModelProperty(value = "快讯类型") | |||
@NotNull | |||
@NotNull(message = "快讯类型不能为空") | |||
private FlashType flashType; | |||
@ApiModelProperty(value = "触发类型") | |||
@NotNull | |||
@NotNull(message = "触发类型不能为空") | |||
private TriggerType triggerType; | |||
@ApiModelProperty(value = "超链接") | |||
@@ -56,21 +56,27 @@ public class NoticeFlashUpdateRequestDTO extends AbstractStaffBizRequestDTO { | |||
private String routeUrl; | |||
@ApiModelProperty(value = "文本类型") | |||
@NotBlank(message = "文本类型不能为空") | |||
private String textType; | |||
@ApiModelProperty(value = "文本内容") | |||
private String text; | |||
@ApiModelProperty(value = "排序") | |||
@NotNull | |||
private Integer sequence; | |||
@ApiModelProperty(value = "状态") | |||
@NotNull | |||
@NotNull(message = "状态不能为空") | |||
private IsEnable status; | |||
public void valid() throws ManagerException { | |||
if (FlashType.SLIDESHOW.equals(flashType)) { | |||
if (sequence == null) { | |||
throw new ManagerException(flashType.getValue()+"快讯类型的排序必填!"); | |||
} | |||
} | |||
if (TriggerType.THIRD_PARTY_LINK.equals(triggerType)){ | |||
if (StringUtils.isBlank(hyperLink)){ | |||
throw new ManagerException(triggerType.getValue()+"触发类型的超链接必填!"); |
@@ -29,19 +29,19 @@ import javax.validation.constraints.NotNull; | |||
public class NoticePromptTextAddRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "标题") | |||
@NotBlank | |||
@NotBlank(message = "标题不能为空") | |||
private String title; | |||
@ApiModelProperty(value = "文本类型") | |||
@NotBlank | |||
@NotBlank(message = "文本类型不能为空") | |||
private String textType; | |||
@ApiModelProperty(value = "文本内容") | |||
@NotBlank | |||
@NotBlank(message = "文本内容不能为空") | |||
private String text; | |||
@ApiModelProperty(value = "业务类型") | |||
@NotBlank | |||
@NotNull(message = "业务类型不能为空") | |||
private BusinessType businessType; | |||
@@ -22,7 +22,7 @@ import javax.validation.constraints.NotBlank; | |||
public class NoticePromptTextDeleteRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "id") | |||
@NotBlank | |||
@NotBlank(message = "id不能为空") | |||
private String id; | |||
@@ -8,6 +8,7 @@ import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Auther: humh | |||
@@ -22,23 +23,23 @@ import javax.validation.constraints.NotBlank; | |||
public class NoticePromptTextUpdateRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "id") | |||
@NotBlank | |||
@NotBlank(message = "id不能为空") | |||
private String id; | |||
@ApiModelProperty(value = "标题") | |||
@NotBlank | |||
@NotBlank(message = "标题不能为空") | |||
private String title; | |||
@ApiModelProperty(value = "文本类型") | |||
@NotBlank | |||
@NotBlank(message = "文本类型不能为空") | |||
private String textType; | |||
@ApiModelProperty(value = "文本内容") | |||
@NotBlank | |||
@NotBlank(message = "文本内容不能为空") | |||
private String text; | |||
@ApiModelProperty(value = "业务类型") | |||
@NotBlank | |||
@NotNull(message = "业务类型不能为空") | |||
private BusinessType businessType; | |||
@@ -1,7 +1,6 @@ | |||
package cn.com.taiji.managew.dto.operation.satisfactiono; | |||
import cn.com.taiji.common.valid.ViolationValidator; | |||
import cn.com.taiji.core.dto.AbstractBizRequestDTO; | |||
import cn.com.taiji.core.dto.AbstractStaffBizRequestDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Getter; | |||
@@ -21,7 +20,7 @@ import javax.validation.constraints.NotBlank; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
public class SatisfactionInfoRequestDTO extends AbstractBizRequestDTO { | |||
public class SatisfactionInfoRequestDTO extends AbstractStaffBizRequestDTO { | |||
@ApiModelProperty(value = "id",required = false) | |||
@NotBlank(message = "id不能为空") |
@@ -12,6 +12,7 @@ import cn.com.taiji.managew.dto.operation.flash.*; | |||
import cn.com.taiji.managew.manager.AbstractManagewManager; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
@@ -35,6 +36,7 @@ public class NoticeFlashManagerImpl extends AbstractManagewManager implements No | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public NoticeFlashAddResponseDTO add(NoticeFlashAddRequestDTO req) throws ManagerException { | |||
//校验 | |||
req.valid(); | |||
@@ -48,6 +50,7 @@ public class NoticeFlashManagerImpl extends AbstractManagewManager implements No | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public NoticeFlashUpdateResponseDTO update(NoticeFlashUpdateRequestDTO req) throws ManagerException { | |||
//校验 | |||
req.valid(); | |||
@@ -60,6 +63,7 @@ public class NoticeFlashManagerImpl extends AbstractManagewManager implements No | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public NoticeFlashStatusResponseDTO statusUpdate(NoticeFlashStatusRequestDTO req) throws ServiceHandleException { | |||
NoticeFlash flash = repo.findById(req.getId()).orElse(null); | |||
flash.setStatus(req.getStatus()); | |||
@@ -70,6 +74,7 @@ public class NoticeFlashManagerImpl extends AbstractManagewManager implements No | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public NoticeFlashDeleteResponseDTO delete(NoticeFlashDeleteRequestDTO req) throws ServiceHandleException { | |||
NoticeFlash flash = repo.findById(req.getId()).orElse(null); | |||
flash.setUpdateTime(LocalDateTime.now()); |
@@ -11,6 +11,7 @@ import cn.com.taiji.managew.manager.AbstractManagewManager; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
@@ -36,6 +37,7 @@ public class NoticePromptTextManagerImpl extends AbstractManagewManager implemen | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public NoticePromptTextAddResponseDTO add(NoticePromptTextAddRequestDTO req) throws ServiceHandleException { | |||
NoticePromptText promptText = copyProperties(req, new NoticePromptText()); | |||
LocalDateTime now = LocalDateTime.now(); | |||
@@ -47,6 +49,7 @@ public class NoticePromptTextManagerImpl extends AbstractManagewManager implemen | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public NoticePromptTextUpdateResponseDTO update(NoticePromptTextUpdateRequestDTO req) throws ServiceHandleException { | |||
NoticePromptText promptText = repo.findById(req.getId()).orElse(null); | |||
BeanUtils.copyProperties(req, promptText); | |||
@@ -57,6 +60,7 @@ public class NoticePromptTextManagerImpl extends AbstractManagewManager implemen | |||
} | |||
@Override | |||
@Transactional(rollbackFor = Exception.class) | |||
public NoticePromptTextDeleteResponseDTO delete(NoticePromptTextDeleteRequestDTO req) throws ServiceHandleException { | |||
NoticePromptText promptText = repo.findById(req.getId()).orElse(null); | |||
promptText.setUpdateTime(LocalDateTime.now()); |