forked from gzzfw/backEnd/gz-dyh

dyh-service/dyh-sys/src/main/java/cn/huge/module/sy/controller/client/SyTimeLimitClientController.java
@@ -1,13 +1,16 @@
package cn.huge.module.sy.controller.client;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.module.sy.domain.po.SyTimeLimit;
import cn.huge.module.sy.service.SyTimeLimitService;
import cn.huge.module.sys.dto.SyTimeLimitDTO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -15,6 +18,7 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Map;
/**
@@ -187,19 +191,46 @@
    }
    /**
     * 条件分页查询
     * 获取时限
     * @url {ctx}/api/web/syTimeLimit/getTimeLimit
     * @param limitTable 时限对应表
     * @param limitType 时限类型
     * @return Object
     */
    @GetMapping("/getTimeLimit")
    public Object getTimeLimit(@RequestParam(value = "limitTable") int limitTable, @RequestParam(value = "limitType") int limitType) {
    public Object getTimeLimit(@RequestParam(value = "limitTable") String limitTable, @RequestParam(value = "limitType") String limitType) {
        try {
            QueryWrapper<SyTimeLimit> syTimeLimitQueryWrapper = new QueryWrapper<>();
            syTimeLimitQueryWrapper.eq("limit_table", limitTable).eq("limit_type", limitType);
            SyTimeLimit syTimeLimit = service.getOne(syTimeLimitQueryWrapper);
            return ReturnSucUtils.getRepInfo( "处理成功", syTimeLimit.getTimeTerm());
            int timeTerm = 0;
            if (ObjectUtils.isNotEmpty(syTimeLimit)){
                timeTerm = syTimeLimit.getTimeTerm();
            }
            return ReturnSucUtils.getRepInfo(timeTerm);
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * 获取时限
     * @url {ctx}/api/web/syTimeLimit/getExpireTime
     * @param computeTime 计算时间
     * @param limitType 时限类型
     * @return Object
     */
    @GetMapping("/getExpireTime")
    public Object getExpireTime(@RequestParam(value = "computeTime") Date computeTime, @RequestParam(value = "limitType") String limitType) {
        try {
            QueryWrapper<SyTimeLimit> syTimeLimitQueryWrapper = new QueryWrapper<>();
            syTimeLimitQueryWrapper.eq("limit_type", limitType);
            SyTimeLimit syTimeLimit = service.getOne(syTimeLimitQueryWrapper);
            SyTimeLimitDTO syTimeLimitDTO = new SyTimeLimitDTO();
            if (ObjectUtils.isNotEmpty(syTimeLimit)) {
                BeanUtils.copyProperties(syTimeLimit, syTimeLimitDTO);
            }
            return ReturnSucUtils.getRepInfo(syTimeLimitDTO);
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }