diff --git a/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java index cb48639..7d7728a 100644 --- a/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java +++ b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java @@ -3,23 +3,25 @@ package com.hyp.web.controller.manager; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import com.hyp.common.core.domain.model.LoginUser; -import com.hyp.common.enums.ApplyTypeEnum; import com.hyp.common.exception.ServiceException; import com.hyp.common.utils.SecurityUtils; 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.ApplyInfoListSaveDTO; import com.hyp.system.domain.vo.ApplyInfoListVO; import com.hyp.system.service.ISysDictDataService; import com.hyp.system.service.RewApplyInfoListService; +import com.hyp.system.service.RewFileRelationService; import com.hyp.system.service.RewScoreInfoService; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Date; import java.util.List; +import java.util.Objects; /** * packageName com.hyp.web.controller.manager @@ -42,6 +44,9 @@ public class ApplyInfoListManager { @Resource private ISysDictDataService dictDataService; + @Resource + private RewFileRelationService relationService; + /** * * 奖项类型 @@ -52,13 +57,10 @@ public class ApplyInfoListManager { private static final String REW_APPLY_TYPE = "rew_apply_type"; - - public List selectApplyInfoList(ApplyInfoListDTO applyInfoListDTO){ return applyInfoListService.selectApplyInfoList(applyInfoListDTO); } - /** * * 生成applyId @@ -90,6 +92,39 @@ public class ApplyInfoListManager { applyInfoListService.save(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); + } + + } diff --git a/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java b/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java index 1e46c64..561cf4a 100644 --- a/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java +++ b/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java @@ -1,14 +1,18 @@ 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.core.page.TableDataInfo; +import com.hyp.common.enums.BusinessType; import com.hyp.system.domain.dto.ApplyInfoListDTO; +import com.hyp.system.domain.dto.ApplyInfoListSaveDTO; import com.hyp.system.domain.vo.ApplyInfoListVO; import com.hyp.web.controller.manager.ApplyInfoListManager; -import com.hyp.web.controller.manager.SysNoticeManager; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -29,13 +33,10 @@ import java.util.List; public class ApplyController extends BaseController { - @Resource - private SysNoticeManager sysNoticeManager; - @Resource private ApplyInfoListManager applyInfoListManager; - + @ApiOperation("查询") @PreAuthorize("@ss.hasPermi('reward:apply:list')") @GetMapping("/list") public TableDataInfo list(ApplyInfoListDTO applyInfoListDTO) { @@ -44,17 +45,31 @@ public class ApplyController extends BaseController { return getDataTable(list); } - - /** - * 根据奖项类型生成applyId - */ + @ApiOperation("根据奖项类型生成applyId") @PreAuthorize("@ss.hasPermi('reward:apply:add')") + @Log(title = "申请保存", businessType = BusinessType.INSERT) @GetMapping(value = "/getApplyId") public AjaxResult getApplyId(@RequestParam String 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)); + } + diff --git a/hyp-system/src/main/java/com/hyp/system/domain/dto/ApplyInfoListSaveDTO.java b/hyp-system/src/main/java/com/hyp/system/domain/dto/ApplyInfoListSaveDTO.java new file mode 100644 index 0000000..6bddaa6 --- /dev/null +++ b/hyp-system/src/main/java/com/hyp/system/domain/dto/ApplyInfoListSaveDTO.java @@ -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:待提交 1:待审核,2,评分,3退回) + */ + @NotNull(message = "申请状态不能为空") + private Integer applyStatus; + + /** + * 是否获得过奖 + */ + @NotNull(message = "是否获得过奖不能为空") + private Integer isReward; + + + + + + + +} diff --git a/hyp-system/src/main/java/com/hyp/system/domain/vo/ApplyInfoListVO.java b/hyp-system/src/main/java/com/hyp/system/domain/vo/ApplyInfoListVO.java index 4627fa9..7271782 100644 --- a/hyp-system/src/main/java/com/hyp/system/domain/vo/ApplyInfoListVO.java +++ b/hyp-system/src/main/java/com/hyp/system/domain/vo/ApplyInfoListVO.java @@ -69,4 +69,7 @@ public class ApplyInfoListVO extends BaseEntity { + + + } \ No newline at end of file