fix:奖项评分提交

dev
wangxy 12 months ago
parent e38f89f066
commit 3a6a80347b

@ -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);
}
}

@ -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));
}
}

@ -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 123退
*/
@NotNull(message = "申请状态不能为空")
private Integer applyStatus;
/**

@ -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;
}
Loading…
Cancel
Save