fix:奖项类型枚举提交

dev
wangxy 12 months ago
parent 8ece7d658c
commit 052fa1655c

@ -3,23 +3,25 @@ package com.hyp.web.controller.manager;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import com.hyp.common.core.domain.model.LoginUser; import com.hyp.common.core.domain.model.LoginUser;
import com.hyp.common.enums.ApplyTypeEnum;
import com.hyp.common.exception.ServiceException; import com.hyp.common.exception.ServiceException;
import com.hyp.common.utils.SecurityUtils; import com.hyp.common.utils.SecurityUtils;
import com.hyp.system.domain.RewApplyInfoList; import com.hyp.system.domain.RewApplyInfoList;
import com.hyp.system.domain.RewFileRelation;
import com.hyp.system.domain.dto.ApplyInfoListDTO; import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.dto.ApplyInfoListSaveDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO; import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.system.service.ISysDictDataService; import com.hyp.system.service.ISysDictDataService;
import com.hyp.system.service.RewApplyInfoListService; import com.hyp.system.service.RewApplyInfoListService;
import com.hyp.system.service.RewFileRelationService;
import com.hyp.system.service.RewScoreInfoService; import com.hyp.system.service.RewScoreInfoService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
/** /**
* packageName com.hyp.web.controller.manager * packageName com.hyp.web.controller.manager
@ -42,6 +44,9 @@ public class ApplyInfoListManager {
@Resource @Resource
private ISysDictDataService dictDataService; private ISysDictDataService dictDataService;
@Resource
private RewFileRelationService relationService;
/** /**
* *
* *
@ -52,13 +57,10 @@ public class ApplyInfoListManager {
private static final String REW_APPLY_TYPE = "rew_apply_type"; private static final String REW_APPLY_TYPE = "rew_apply_type";
public List<ApplyInfoListVO> selectApplyInfoList(ApplyInfoListDTO applyInfoListDTO){ public List<ApplyInfoListVO> selectApplyInfoList(ApplyInfoListDTO applyInfoListDTO){
return applyInfoListService.selectApplyInfoList(applyInfoListDTO); return applyInfoListService.selectApplyInfoList(applyInfoListDTO);
} }
/** /**
* *
* applyId * applyId
@ -90,6 +92,39 @@ public class ApplyInfoListManager {
applyInfoListService.save(applyInfoList); applyInfoListService.save(applyInfoList);
return Convert.convert(ApplyInfoListVO.class, applyInfoList); return Convert.convert(ApplyInfoListVO.class, applyInfoList);
} }
/**
*
*
* @param applyInfoListSaveDTO
* @return boolean
*/
@Transactional(rollbackFor = Exception.class)
public boolean submit(ApplyInfoListSaveDTO applyInfoListSaveDTO){
RewApplyInfoList applyInfoList = applyInfoListService.getById(applyInfoListSaveDTO.getApplyId());
if(Objects.nonNull(applyInfoList)){
applyInfoList.setApplyStatus(applyInfoListSaveDTO.getApplyStatus());
applyInfoList.setAppTime(new Date());
applyInfoList.setIsReward(applyInfoListSaveDTO.getIsReward());
}
return applyInfoListService.saveOrUpdate(applyInfoList);
}
/**
*
*
* @param applyId
* @return boolean
*/
public boolean deleteById(String applyId){
relationService.lambdaUpdate()
.eq(RewFileRelation::getApplyId, applyId)
.remove();
return applyInfoListService.removeById(applyId);
}
} }

@ -1,14 +1,18 @@
package com.hyp.web.controller.reward; package com.hyp.web.controller.reward;
import com.hyp.common.annotation.Log;
import com.hyp.common.core.controller.BaseController; import com.hyp.common.core.controller.BaseController;
import com.hyp.common.core.domain.AjaxResult; import com.hyp.common.core.domain.AjaxResult;
import com.hyp.common.core.page.TableDataInfo; import com.hyp.common.core.page.TableDataInfo;
import com.hyp.common.enums.BusinessType;
import com.hyp.system.domain.dto.ApplyInfoListDTO; import com.hyp.system.domain.dto.ApplyInfoListDTO;
import com.hyp.system.domain.dto.ApplyInfoListSaveDTO;
import com.hyp.system.domain.vo.ApplyInfoListVO; import com.hyp.system.domain.vo.ApplyInfoListVO;
import com.hyp.web.controller.manager.ApplyInfoListManager; import com.hyp.web.controller.manager.ApplyInfoListManager;
import com.hyp.web.controller.manager.SysNoticeManager;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -29,13 +33,10 @@ import java.util.List;
public class ApplyController extends BaseController { public class ApplyController extends BaseController {
@Resource
private SysNoticeManager sysNoticeManager;
@Resource @Resource
private ApplyInfoListManager applyInfoListManager; private ApplyInfoListManager applyInfoListManager;
@ApiOperation("查询")
@PreAuthorize("@ss.hasPermi('reward:apply:list')") @PreAuthorize("@ss.hasPermi('reward:apply:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ApplyInfoListDTO applyInfoListDTO) { public TableDataInfo list(ApplyInfoListDTO applyInfoListDTO) {
@ -44,17 +45,31 @@ public class ApplyController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
@ApiOperation("根据奖项类型生成applyId")
/**
* applyId
*/
@PreAuthorize("@ss.hasPermi('reward:apply:add')") @PreAuthorize("@ss.hasPermi('reward:apply:add')")
@Log(title = "申请保存", businessType = BusinessType.INSERT)
@GetMapping(value = "/getApplyId") @GetMapping(value = "/getApplyId")
public AjaxResult getApplyId(@RequestParam String applyType) public AjaxResult getApplyId(@RequestParam String applyType)
{ {
return success(applyInfoListManager.getApplyId(applyType)); return success(applyInfoListManager.getApplyId(applyType));
} }
@ApiOperation("提交申请")
@Log(title = "提交申请", businessType = BusinessType.UPDATE)
@PostMapping("/submit")
public AjaxResult submit(@Validated @RequestBody ApplyInfoListSaveDTO applyInfoSaveDTO)
{
return toAjax(applyInfoListManager.submit(applyInfoSaveDTO));
}
@ApiOperation("删除申请")
@Log(title = "删除申请", businessType = BusinessType.DELETE)
@DeleteMapping("/delete/{applyId}")
public AjaxResult delete(@PathVariable String applyId)
{
return toAjax(applyInfoListManager.deleteById(applyId));
}

@ -0,0 +1,46 @@
package com.hyp.system.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* packageName com.hyp.system.domain.dto
*
* @author wangxy
* @version JDK 8
* @className ApplyInfoListSaveDTO
* @date 2024/4/11
* @description
*/
@Data
public class ApplyInfoListSaveDTO implements Serializable {
/**
* id
*/
@NotBlank(message = "申请id不能为空")
private String applyId;
/**
* 0 123退
*/
@NotNull(message = "申请状态不能为空")
private Integer applyStatus;
/**
*
*/
@NotNull(message = "是否获得过奖不能为空")
private Integer isReward;
}

@ -69,4 +69,7 @@ public class ApplyInfoListVO extends BaseEntity {
} }
Loading…
Cancel
Save