From 3a6a80347b80ebed90d2f869ffb190c914448d30 Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Fri, 12 Apr 2024 11:45:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=A5=96=E9=A1=B9=E8=AF=84=E5=88=86?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/manager/ScoreInfoManager.java | 54 +++++++++++++++++++ .../reward/ScoreInfoController.java | 48 +++++++++++++++++ .../system/domain/dto/ApplyInfoListDTO.java | 5 ++ .../system/domain/dto/ScoreInfoSaveDTO.java | 36 +++++++++++++ 4 files changed, 143 insertions(+) create mode 100644 hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java create mode 100644 hyp-admin/src/main/java/com/hyp/web/controller/reward/ScoreInfoController.java create mode 100644 hyp-system/src/main/java/com/hyp/system/domain/dto/ScoreInfoSaveDTO.java diff --git a/hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java new file mode 100644 index 0000000..dc0f64e --- /dev/null +++ b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ScoreInfoManager.java @@ -0,0 +1,54 @@ +package com.hyp.web.controller.manager; + +import cn.hutool.core.convert.Convert; +import com.hyp.common.core.domain.model.LoginUser; +import com.hyp.common.utils.SecurityUtils; +import com.hyp.common.utils.StringUtils; +import com.hyp.system.domain.RewScoreInfo; +import com.hyp.system.domain.dto.ScoreInfoSaveDTO; +import com.hyp.system.service.RewScoreInfoService; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; + +/** + * packageName com.hyp.web.controller.manager + * + * @author wangxy + * @version JDK 8 + * @className ScoreInfoManager + * @date 2024/4/12 + * @description 评分 + */ +@Component +public class ScoreInfoManager { + + + @Resource + private RewScoreInfoService scoreInfoService; + + /** + * + * 保存 + * @param scoreInfo + * @return boolean + */ + @Transactional(rollbackFor = Exception.class) + public boolean saveOrUpdate(ScoreInfoSaveDTO scoreInfo){ + LoginUser loginUser = SecurityUtils.getLoginUser(); + RewScoreInfo rewScoreInfo = Convert.convert(RewScoreInfo.class, scoreInfo); + rewScoreInfo.setCreateId(loginUser.getUserId()); + if(StringUtils.isNotEmpty(scoreInfo.getId())){ + rewScoreInfo.setUpdateTime(new Date()); + rewScoreInfo.setUpdateBy(loginUser.getUsername()); + }else{ + rewScoreInfo.setCreateTime(new Date()); + rewScoreInfo.setCreateBy(loginUser.getUsername()); + } + return scoreInfoService.saveOrUpdate(rewScoreInfo); + } + + +} diff --git a/hyp-admin/src/main/java/com/hyp/web/controller/reward/ScoreInfoController.java b/hyp-admin/src/main/java/com/hyp/web/controller/reward/ScoreInfoController.java new file mode 100644 index 0000000..1fd3a51 --- /dev/null +++ b/hyp-admin/src/main/java/com/hyp/web/controller/reward/ScoreInfoController.java @@ -0,0 +1,48 @@ +package com.hyp.web.controller.reward; + +import com.hyp.common.annotation.Log; +import com.hyp.common.core.controller.BaseController; +import com.hyp.common.core.domain.AjaxResult; +import com.hyp.common.enums.BusinessType; +import com.hyp.system.domain.dto.ScoreInfoSaveDTO; +import com.hyp.web.controller.manager.ScoreInfoManager; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * packageName com.hyp.web.controller.reward + * + * @author wangxy + * @version JDK 8 + * @className RewScoreInfoController + * @date 2024/4/12 + * @description 评分 + */ +@Api("评分") +@RestController +@RequestMapping("/reward/score") +public class ScoreInfoController extends BaseController { + + @Resource + private ScoreInfoManager scoreInfoManager; + + @ApiOperation("评分保存") + @Log(title = "评分保存", businessType = BusinessType.INSERT) + @PostMapping("/save") + public AjaxResult save(@Validated @RequestBody ScoreInfoSaveDTO scoreInfo) { + return toAjax(scoreInfoManager.saveOrUpdate(scoreInfo)); + } + + + + + + +} diff --git a/hyp-system/src/main/java/com/hyp/system/domain/dto/ApplyInfoListDTO.java b/hyp-system/src/main/java/com/hyp/system/domain/dto/ApplyInfoListDTO.java index c0ad0f7..74d8237 100644 --- a/hyp-system/src/main/java/com/hyp/system/domain/dto/ApplyInfoListDTO.java +++ b/hyp-system/src/main/java/com/hyp/system/domain/dto/ApplyInfoListDTO.java @@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.hyp.common.core.domain.BaseEntity; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + /** * 奖项申请流程表 @@ -25,11 +28,13 @@ public class ApplyInfoListDTO extends BaseEntity { /** * 奖项类型 */ + @NotBlank(message = "奖项类型不能为空") private String applyType; /** * 申请状态(0:待提交 1:待审核,2,评分,3退回) */ + @NotNull(message = "申请状态不能为空") private Integer applyStatus; /** diff --git a/hyp-system/src/main/java/com/hyp/system/domain/dto/ScoreInfoSaveDTO.java b/hyp-system/src/main/java/com/hyp/system/domain/dto/ScoreInfoSaveDTO.java new file mode 100644 index 0000000..cf02a92 --- /dev/null +++ b/hyp-system/src/main/java/com/hyp/system/domain/dto/ScoreInfoSaveDTO.java @@ -0,0 +1,36 @@ +package com.hyp.system.domain.dto; + + +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 评分表 + * @author wangxy + * @TableName rew_score_info + */ +@Data +public class ScoreInfoSaveDTO implements Serializable { + /** + * 主键 + */ + private String id; + + /** + * 评分 + */ + private String score; + + /** + * 申请id + */ + @NotBlank(message = "申请id不能为空") + private String applyId; + + + @TableField(exist = false) + private static final long serialVersionUID = 1L; +} \ No newline at end of file