Browse Source

季节修改、

Newspaper 1 năm trước cách đây
mục cha
commit
64f9f2e8f4

+ 2 - 2
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/user/entity/BizUser.java

@@ -200,8 +200,8 @@ public class BizUser extends CommonEntity implements TransPojo {
     @Trans(type = TransType.SIMPLE, target = BizOrg.class, fields = "name", alias = "org", ref = "orgName")
     private String orgId;
 
-    /** 机构id */
-    @ApiModelProperty(value = "机构id", position = 32)
+    /** 部门id */
+    @ApiModelProperty(value = "部门id", position = 32)
     @TableField(insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
     @Trans(type = TransType.SIMPLE, target = Department.class, fields = "departmentName", alias = "department", ref = "departmentName")
     private String departmentId;

+ 16 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/baseSeason/controller/BaseSeasonController.java

@@ -60,8 +60,8 @@ public class BaseSeasonController {
     @ApiOperation("获取季节详情")
     @CommonLog("获取季节详情")
     @GetMapping("/base/baseSeason/getSeason")
-    public CommonResult<BaseSeason> getSeason() throws ParseException {
-        return CommonResult.data(baseSeasonService.getSeason());
+    public CommonResult<BaseSeason> getSeason(BaseSeasonTypeParam baseSeasonTypeParam) throws ParseException {
+        return CommonResult.data(baseSeasonService.getSeason(baseSeasonTypeParam));
     }
 
 
@@ -79,4 +79,18 @@ public class BaseSeasonController {
         baseSeasonService.edit(baseSeasonEditParam);
         return CommonResult.ok();
     }
+
+    /**
+     * 获取启用季节
+     *
+     * @author newspaper
+     * @date  2023/12/18 11:14
+     */
+    @ApiOperationSupport(order = 3)
+    @ApiOperation("获取启用季节")
+    @CommonLog("获取启用季节")
+    @GetMapping("/base/baseSeason/getEnableSeason")
+    public CommonResult<Integer> getEnableSeason() {
+        return CommonResult.data(baseSeasonService.getEnableSeason());
+    }
 }

+ 0 - 82
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/baseSeason/param/BaseSeasonAddParam.java

@@ -1,82 +0,0 @@
-/*
- * Copyright [2022] [https://www.xiaonuo.vip]
- *
- * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
- *
- * 1.请不要删除和修改根目录下的LICENSE文件。
- * 2.请不要删除和修改Snowy源码头部的版权声明。
- * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
- * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
- * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
- * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
- */
-package vip.xiaonuo.modular.base.baseSeason.param;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Getter;
-import lombok.Setter;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * 季节添加参数
- *
- * @author newspaper
- * @date  2023/12/18 11:14
- **/
-@Getter
-@Setter
-public class BaseSeasonAddParam {
-
-    /** 春季开始时间 */
-    @ApiModelProperty(value = "春季开始时间", required = true, position = 2)
-    @NotNull(message = "springStartTime不能为空")
-    private Date springStartTime;
-
-    /** 春季结束时间 */
-    @ApiModelProperty(value = "春季结束时间", required = true, position = 3)
-    @NotNull(message = "springEndTime不能为空")
-    private Date springEndTime;
-
-    /** 夏季开始时间 */
-    @ApiModelProperty(value = "夏季开始时间", required = true, position = 4)
-    @NotNull(message = "summerStartTime不能为空")
-    private Date summerStartTime;
-
-    /** 夏季结束时间 */
-    @ApiModelProperty(value = "夏季结束时间", required = true, position = 5)
-    @NotNull(message = "summerEndTime不能为空")
-    private Date summerEndTime;
-
-    /** 秋季开始时间 */
-    @ApiModelProperty(value = "秋季开始时间", required = true, position = 6)
-    @NotNull(message = "autumnStartTime不能为空")
-    private Date autumnStartTime;
-
-    /** 秋季结束时间 */
-    @ApiModelProperty(value = "秋季结束时间", required = true, position = 7)
-    @NotNull(message = "autumnEndTime不能为空")
-    private Date autumnEndTime;
-
-    /** 冬季开始时间 */
-    @ApiModelProperty(value = "冬季开始时间", required = true, position = 8)
-    @NotNull(message = "winterStartTime不能为空")
-    private Date winterStartTime;
-
-    /** 冬季结束时间 */
-    @ApiModelProperty(value = "冬季结束时间", required = true, position = 9)
-    @NotNull(message = "winterEndTime不能为空")
-    private Date winterEndTime;
-
-    /** 状态 */
-    @ApiModelProperty(value = "状态", position = 10)
-    private Integer status;
-
-    /** 季节类型 */
-    @ApiModelProperty(value = "季节类型", position = 11)
-    private Integer seasonType;
-
-}

+ 4 - 0
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/baseSeason/param/BaseSeasonTypeParam.java

@@ -29,4 +29,8 @@ import javax.validation.constraints.NotBlank;
 @Setter
 public class BaseSeasonTypeParam {
 
+    /** 季节类型 */
+    @ApiModelProperty(value = "季节类型")
+    @NotBlank(message = "seasonType不能为空")
+    private String seasonType;
 }

+ 3 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/baseSeason/service/BaseSeasonService.java

@@ -44,5 +44,7 @@ public interface BaseSeasonService extends IService<BaseSeason> {
      **/
     BaseSeason queryEntity(String id);
 
-    BaseSeason getSeason() throws ParseException;
+    BaseSeason getSeason(BaseSeasonTypeParam baseSeasonTypeParam) throws ParseException;
+
+    Integer getEnableSeason();
 }

+ 43 - 11
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/baseSeason/service/impl/BaseSeasonServiceImpl.java

@@ -52,7 +52,7 @@ import java.util.List;
 @Service
 public class BaseSeasonServiceImpl extends ServiceImpl<BaseSeasonMapper, BaseSeason> implements BaseSeasonService {
     @Override
-    public BaseSeason getSeason() throws ParseException {
+    public BaseSeason getSeason(BaseSeasonTypeParam baseSeasonTypeParam) throws ParseException {
         SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
         LocalDate currentDate = LocalDate.now();
         // 获取下一年的二月的最后一天
@@ -62,19 +62,39 @@ public class BaseSeasonServiceImpl extends ServiceImpl<BaseSeasonMapper, BaseSea
                 .with(TemporalAdjusters.lastDayOfMonth());  // 获取月份的最后一天
 
         String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
-        BaseSeason baseSeason = this.getOne(new QueryWrapper<BaseSeason>().lambda().eq(BaseSeason::getOrgId, orgId).eq(BaseSeason::getSeasonType, 0));
+        Integer seasonType = Integer.valueOf(baseSeasonTypeParam.getSeasonType());
+        BaseSeason baseSeason = this.getOne(new QueryWrapper<BaseSeason>().lambda().eq(BaseSeason::getOrgId, orgId).eq(BaseSeason::getSeasonType, seasonType));
         if (ObjectUtil.isEmpty(baseSeason)){
             baseSeason = new BaseSeason();
             baseSeason.setOrgId(orgId);
-            baseSeason.setSeasonType(0);
-            baseSeason.setSpringStartTime(sdf.parse("03-01"));
-            baseSeason.setSpringEndTime(sdf.parse("05-31"));
-            baseSeason.setSummerStartTime(sdf.parse("06-01"));
-            baseSeason.setSummerEndTime(sdf.parse("08-31"));
-            baseSeason.setAutumnStartTime(sdf.parse("09-01"));
-            baseSeason.setAutumnEndTime(sdf.parse("11-30"));
-            baseSeason.setWinterStartTime(sdf.parse("12-01"));
-            baseSeason.setWinterEndTime(Date.valueOf(nextYearFebruaryLastDay));
+            baseSeason.setSeasonType(seasonType);
+            switch (seasonType){
+                case 0:
+                    break;
+                case 1:
+                    baseSeason.setSpringStartTime(sdf.parse("03-21"));
+                    baseSeason.setSpringEndTime(sdf.parse("06-21"));
+                    baseSeason.setSummerStartTime(sdf.parse("06-22"));
+                    baseSeason.setSummerEndTime(sdf.parse("09-22"));
+                    baseSeason.setAutumnStartTime(sdf.parse("09-23"));
+                    baseSeason.setAutumnEndTime(sdf.parse("12-21"));
+                    baseSeason.setWinterStartTime(sdf.parse("12-22"));
+                    baseSeason.setWinterEndTime(sdf.parse("03-20"));
+                    break;
+                case 2:
+                    baseSeason.setSpringStartTime(sdf.parse("03-01"));
+                    baseSeason.setSpringEndTime(sdf.parse("05-31"));
+                    baseSeason.setSummerStartTime(sdf.parse("06-01"));
+                    baseSeason.setSummerEndTime(sdf.parse("08-31"));
+                    baseSeason.setAutumnStartTime(sdf.parse("09-01"));
+                    baseSeason.setAutumnEndTime(sdf.parse("11-30"));
+                    baseSeason.setWinterStartTime(sdf.parse("12-01"));
+                    baseSeason.setWinterEndTime(Date.valueOf(nextYearFebruaryLastDay));
+                    break;
+                case 3:
+                    break;
+            }
+
             this.save(baseSeason);
         }
         return baseSeason;
@@ -149,6 +169,7 @@ public class BaseSeasonServiceImpl extends ServiceImpl<BaseSeasonMapper, BaseSea
                     this.update(new UpdateWrapper<BaseSeason>().lambda().set(BaseSeason::getStatus,0)
                             .eq(BaseSeason::getOrgId,orgId).ne(BaseSeason::getId,baseSeason.getId()));
                 }
+                this.updateById(baseSeason);
             }
         }
         CommonDataChangeEventCenter.doUpdateWithData(BaseDataTypeEnum.SEASON.getValue(), JSONUtil.createArray().put(baseSeason));
@@ -163,4 +184,15 @@ public class BaseSeasonServiceImpl extends ServiceImpl<BaseSeasonMapper, BaseSea
         return baseSeason;
     }
 
+    @Override
+    public Integer getEnableSeason() {
+        String orgId = StpLoginUserUtil.getLoginUser().getOrgId();
+        Integer seasonType = new Integer(0);
+        BaseSeason baseSeason = this.getOne(new QueryWrapper<BaseSeason>().lambda().eq(BaseSeason::getStatus, 1).eq(BaseSeason::getOrgId, orgId));
+        if (ObjectUtil.isNotEmpty(baseSeason)){
+            seasonType = baseSeason.getSeasonType();
+        }
+        return seasonType;
+    }
+
 }

+ 3 - 2
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/controller/InventoryUseController.java

@@ -36,6 +36,7 @@ import vip.xiaonuo.modular.base.inventoryUse.service.InventoryUseService;
 import javax.annotation.Resource;
 import javax.validation.Valid;
 import javax.validation.constraints.NotEmpty;
+import java.text.ParseException;
 import java.util.Date;
 import java.util.List;
 
@@ -140,8 +141,8 @@ public class InventoryUseController {
     @PostMapping("/base/inventoryUse/revert")
     public CommonResult<String> revert(@RequestParam MultipartFile returnImgUrl,
                                        @RequestParam String id,
-                                       @RequestParam Date returnTime,
-                                       @RequestParam String remarks) {
+                                       @RequestParam String returnTime,
+                                       @RequestParam String remarks) throws ParseException {
         inventoryUseService.revert(returnImgUrl,id,returnTime,remarks);
         return CommonResult.ok();
     }

+ 13 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/entity/InventoryUse.java

@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 import vip.xiaonuo.common.pojo.CommonEntity;
+import vip.xiaonuo.dev.modular.file.entity.DevFile;
 import vip.xiaonuo.modular.base.baseConfig.entity.BaseConfig;
 import vip.xiaonuo.modular.base.department.entity.Department;
 import vip.xiaonuo.sys.modular.user.entity.SysUser;
@@ -91,13 +92,18 @@ public class InventoryUse extends CommonEntity implements TransPojo {
     @Trans(type = TransType.SIMPLE, target = SysUser.class, fields = "name", alias = "user", ref = "userName")
     private String userId;
 
+    /** 预计归还时间 */
+    @ApiModelProperty(value = "预计归还时间", position = 13)
+    private Date expectReturnTime;
+
     /** 归还时间 */
     @ApiModelProperty(value = "归还时间", position = 13)
     private Date returnTime;
 
     /** 归还图片地址 */
     @ApiModelProperty(value = "归还图片地址", position = 14)
-    private String returnImgUrl;
+    @Trans(type = TransType.SIMPLE, target = DevFile.class, fields = "thumbnail", alias = "img", ref = "returnImgUrl")
+    private String returnImgId;
 
     /** 备注 */
     @ApiModelProperty(value = "备注", position = 15)
@@ -127,4 +133,10 @@ public class InventoryUse extends CommonEntity implements TransPojo {
     @ApiModelProperty(value = "领用人名称", position = 20)
     @TableField(exist = false)
     private String userName;
+
+
+    /** 归还图片地址 */
+    @ApiModelProperty(value = "归还图片地址", position = 21)
+    @TableField(exist = false)
+    private String returnImgUrl;
 }

+ 2 - 1
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/service/InventoryUseService.java

@@ -20,6 +20,7 @@ import vip.xiaonuo.modular.base.inventoryUse.entity.vo.InventoryUseDetailVo;
 import vip.xiaonuo.modular.base.inventoryUse.entity.vo.InventoryUseVo;
 import vip.xiaonuo.modular.base.inventoryUse.param.*;
 
+import java.text.ParseException;
 import java.util.Date;
 import java.util.List;
 
@@ -79,5 +80,5 @@ public interface InventoryUseService extends IService<InventoryUse> {
      **/
     InventoryUse queryEntity(String id);
 
-    void revert(MultipartFile returnImgUrl, String id, Date returnTime, String remarks);
+    void revert(MultipartFile returnImgUrl, String id, String returnTime, String remarks) throws ParseException;
 }

+ 7 - 4
snowy-web-app/src/main/java/vip/xiaonuo/modular/base/inventoryUse/service/impl/InventoryUseServiceImpl.java

@@ -38,6 +38,8 @@ import vip.xiaonuo.modular.base.inventoryUse.param.*;
 import vip.xiaonuo.modular.base.inventoryUse.service.InventoryUseService;
 
 import javax.validation.constraints.NotBlank;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
@@ -112,11 +114,12 @@ public class InventoryUseServiceImpl extends ServiceImpl<InventoryUseMapper, Inv
     }
 
     @Override
-    public void revert(MultipartFile returnImgUrl, String id, Date returnTime, String remarks) {
+    public void revert(MultipartFile returnImgUrl, String id, String returnTime, String remarks) throws ParseException {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         InventoryUse inventoryUse = this.getById(id);
-        String url = devFileService.uploadReturnUrl("SNOWY_SYS_DEFAULT_FILE_ENGINE", returnImgUrl);
-        inventoryUse.setReturnTime(returnTime);
-        inventoryUse.setReturnImgUrl(url);
+        String url = devFileService.uploadReturnId("SNOWY_SYS_DEFAULT_FILE_ENGINE", returnImgUrl);
+        inventoryUse.setReturnTime(dateFormat.parse(returnTime));
+        inventoryUse.setReturnImgId(url);
         inventoryUse.setRemarks(remarks);
         this.updateById(inventoryUse);