Java Code Examples for org.springframework.format.annotation.DateTimeFormat

The following examples show how to use org.springframework.format.annotation.DateTimeFormat. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: WeBASE-Node-Manager   Source File: ChainController.java    License: Apache License 2.0 6 votes vote down vote up
@GetMapping(value = "/mointorInfo/{frontId}")
public BaseResponse getChainMoinntorInfo(@PathVariable("frontId") Integer frontId,
    @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime beginDate,
    @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime endDate,
    @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime contrastBeginDate,
    @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime contrastEndDate,
    @RequestParam(required = false, defaultValue = "1") int gap,
    @RequestParam(required = false, defaultValue = "1") int groupId)
    throws NodeMgrException {
    Instant startTime = Instant.now();
    BaseResponse response = new BaseResponse(ConstantCode.SUCCESS);
    log.info(
        "start getChainInfo. startTime:{} frontId:{} beginDate:{} endDate:{} "
            + "contrastBeginDate:{} contrastEndDate:{} gap:{} groupId:{}", startTime.toEpochMilli(),
        frontId, beginDate, endDate, contrastBeginDate, contrastEndDate, gap,groupId);
    Object rspObj = chainService
        .getChainMonitorInfo(frontId, beginDate, endDate, contrastBeginDate, contrastEndDate,
            gap,groupId);

    response.setData(rspObj);
    log.info("end getChainInfo. endTime:{} response:{}",
        Duration.between(startTime, Instant.now()).toMillis(), JsonTools.toJSONString(response));

    return response;
}
 
Example 2
Source Project: XS2A-Sandbox   Source File: AccountApiClient.java    License: Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Read transaction list of an account", nickname = "getTransactionList", notes = "Read transaction reports or transaction lists of a given account ddressed by \"account-id\", depending on the steering parameter  \"bookingStatus\" together with balances.  For a given account, additional parameters are e.g. the attributes \"dateFrom\" and \"dateTo\".  The ASPSP might add balance information, if transaction lists without balances are not supported. ", response = TransactionsResponse200Json.class, authorizations = {
        @Authorization(value = "BearerAuthOAuth")
}, tags = {})
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "OK", response = TransactionsResponse200Json.class),
        @ApiResponse(code = 400, message = "Bad Request", response = Error400NGAIS.class),
        @ApiResponse(code = 401, message = "Unauthorized", response = Error401NGAIS.class),
        @ApiResponse(code = 403, message = "Forbidden", response = Error403NGAIS.class),
        @ApiResponse(code = 404, message = "Not found", response = Error404NGAIS.class),
        @ApiResponse(code = 405, message = "Method Not Allowed", response = Error405NGAIS.class),
        @ApiResponse(code = 406, message = "Not Acceptable", response = Error406NGAIS.class),
        @ApiResponse(code = 408, message = "Request Timeout"),
        @ApiResponse(code = 415, message = "Unsupported Media Type"),
        @ApiResponse(code = 429, message = "Too Many Requests", response = Error429NGAIS.class),
        @ApiResponse(code = 500, message = "Internal Server Error"),
        @ApiResponse(code = 503, message = "Service Unavailable")})
@RequestMapping(value = "/v1/accounts/{account-id}/transactions/",
        produces = {"application/json", "application/xml", "application/text", "application/problem+json"},
        method = RequestMethod.GET)
ResponseEntity<TransactionsResponse200Json> _getTransactionList(@ApiParam(value = "This identification is denoting the addressed account.  The account-id is retrieved by using a \"Read Account List\" call.  The account-id is the \"id\" attribute of the account structure.  Its value is constant at least throughout the lifecycle of a given consent. ", required = true) @PathVariable("account-id") String accountId, @NotNull @ApiParam(value = "Permitted codes are    * \"booked\",   * \"pending\" and    * \"both\" \"booked\" shall be supported by the ASPSP. To support the \"pending\" and \"both\" feature is optional for the ASPSP,  Error code if not supported in the online banking frontend ", required = true, allowableValues = "booked, pending, both") @Valid @RequestParam(value = "bookingStatus", required = true) String bookingStatus, @ApiParam(value = "ID of the request, unique to the call, as determined by the initiating party.", required = true) @RequestHeader(value = "X-Request-ID", required = true) UUID xRequestID, @ApiParam(value = "This then contains the consentId of the related AIS consent, which was performed prior to this payment initiation. ", required = true) @RequestHeader(value = "Consent-ID", required = true) String consentID, @ApiParam(value = "Conditional: Starting date (inclusive the date dateFrom) of the transaction list, mandated if no delta access is required.  For booked transactions, the relevant date is the booking date.   For pending transactions, the relevant date is the entry date, which may not be transparent  neither in this API nor other channels of the ASPSP. ") @Valid @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) @RequestParam(value = "dateFrom", required = false) LocalDate dateFrom, @ApiParam(value = "End date (inclusive the data dateTo) of the transaction list, is \"now\" if not given.   Might be ignored if a delta function is used.  For booked transactions, the relevant date is the booking date.   For pending transactions, the relevant date is the entry date, which may not be transparent  neither in this API nor other channels of the ASPSP. ") @Valid @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) @RequestParam(value = "dateTo", required = false) LocalDate dateTo, @ApiParam(value = "This data attribute is indicating that the AISP is in favour to get all transactions after  the transaction with identification entryReferenceFrom alternatively to the above defined period.  This is a implementation of a delta access.  If this data element is contained, the entries \"dateFrom\" and \"dateTo\" might be ignored by the ASPSP  if a delta report is supported.  Optional if supported by API provider. ") @Valid @RequestParam(value = "entryReferenceFrom", required = false) String entryReferenceFrom, @ApiParam(value = "This data attribute is indicating that the AISP is in favour to get all transactions after the last report access for this PSU on the addressed account. This is another implementation of a delta access-report. This delta indicator might be rejected by the ASPSP if this function is not supported. Optional if supported by API provider") @Valid @RequestParam(value = "deltaList", required = false) Boolean deltaList, @ApiParam(value = "If contained, this function reads the list of accessible payment accounts including the booking balance,  if granted by the PSU in the related consent and available by the ASPSP.  This parameter might be ignored by the ASPSP.  ") @Valid @RequestParam(value = "withBalance", required = false) Boolean withBalance, @ApiParam(value = "Is contained if and only if the \"Signature\" element is contained in the header of the request.") @RequestHeader(value = "Digest", required = false) String digest, @ApiParam(value = "A signature of the request by the TPP on application level. This might be mandated by ASPSP. ") @RequestHeader(value = "Signature", required = false) String signature, @ApiParam(value = "The certificate used for signing the request, in base64 encoding.  Must be contained if a signature is contained. ") @RequestHeader(value = "TPP-Signature-Certificate", required = false) byte[] tpPSignatureCertificate, @ApiParam(value = "The forwarded IP Address header field consists of the corresponding HTTP request  IP Address field between PSU and TPP.  It shall be contained if and only if this request was actively initiated by the PSU. ") @RequestHeader(value = "PSU-IP-Address", required = false) String psUIPAddress, @ApiParam(value = "The forwarded IP Port header field consists of the corresponding HTTP request IP Port field between PSU and TPP, if available. ") @RequestHeader(value = "PSU-IP-Port", required = false) String psUIPPort, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept", required = false) String psUAccept, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept-Charset", required = false) String psUAcceptCharset, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept-Encoding", required = false) String psUAcceptEncoding, @ApiParam(value = "The forwarded IP Accept header fields consist of the corresponding HTTP request Accept header fields between PSU and TPP, if available. ") @RequestHeader(value = "PSU-Accept-Language", required = false) String psUAcceptLanguage, @ApiParam(value = "The forwarded Agent header field of the HTTP request between PSU and TPP, if available. ") @RequestHeader(value = "PSU-User-Agent", required = false) String psUUserAgent, @ApiParam(value = "HTTP method used at the PSU ? TPP interface, if available. Valid values are: * GET * POST * PUT * PATCH * DELETE ", allowableValues = "GET, POST, PUT, PATCH, DELETE") @RequestHeader(value = "PSU-Http-Method", required = false) String psUHttpMethod, @ApiParam(value = "UUID (Universally Unique Identifier) for a device, which is used by the PSU, if available. UUID identifies either a device or a device dependant application installation. In case of an installation identification this ID need to be unaltered until removal from device. ") @RequestHeader(value = "PSU-Device-ID", required = false) UUID psUDeviceID, @ApiParam(value = "The forwarded Geo Location of the corresponding http request between PSU and TPP if available. ") @RequestHeader(value = "PSU-Geo-Location", required = false) String psUGeoLocation);
 
Example 3
Source Project: rap2-generator   Source File: Rap2Generator.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * <p class="detail">
 * 功能:判断字段类型是否为时间类型,若字段写了多个注解则优先级为DateTimeFormat(spring)>JSONField(fastjson)>JsonFormat(jackson),异常就返回""
 * </p>
 *
 * @param className :类名
 * @param fieldName :字段名
 * @return boolean
 * @author Kings
 * @date 2019.11.02
 */
private String getDayPattern(String className, String fieldName) {
    try {
        Class<?> parseClass = Class.forName(className);
        DateTimeFormat dateTimeFormat = parseClass.getDeclaredField(fieldName).getAnnotation(DateTimeFormat.class);
        if (dateTimeFormat != null) {
            return dateTimeFormat.pattern();
        }
        JSONField jsonField = parseClass.getDeclaredField(fieldName).getAnnotation(JSONField.class);
        if (jsonField != null) {
            return jsonField.format();
        }
        JsonFormat jsonFormat = parseClass.getDeclaredField(fieldName).getAnnotation(JsonFormat.class);
        if (jsonFormat != null) {
            return jsonFormat.pattern();
        }
        return "";
    } catch (Exception e) {
        return "";
    }
}
 
Example 4
Source Project: rap2-generator   Source File: Rap2WebGenerator.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * <p class="detail">
 * 功能:判断字段类型是否为时间类型,若字段写了多个注解则优先级为DateTimeFormat(spring)>JSONField(fastjson)>JsonFormat(jackson),异常就返回""
 * </p>
 *
 * @param className :类名
 * @param fieldName :字段名
 * @return boolean
 * @author Kings
 * @date 2019.11.02
 */
private String getDayPattern(String javaDirPath,String className, String fieldName) {
    try {
        Class<?> parseClass = getCompileClass(javaDirPath,className);
        DateTimeFormat dateTimeFormat = parseClass.getDeclaredField(fieldName).getAnnotation(DateTimeFormat.class);
        if (dateTimeFormat != null) {
            return dateTimeFormat.pattern();
        }
        JSONField jsonField = parseClass.getDeclaredField(fieldName).getAnnotation(JSONField.class);
        if (jsonField != null) {
            return jsonField.format();
        }
        JsonFormat jsonFormat = parseClass.getDeclaredField(fieldName).getAnnotation(JsonFormat.class);
        if (jsonFormat != null) {
            return jsonFormat.pattern();
        }
        
        return "";
    } catch (Exception e) {
        return "";
    }
}
 
Example 5
Source Project: WeBASE-Front   Source File: PerformanceController.java    License: Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/pagingQuery")
public BasePageResponse getPerformanceByTime(
        @RequestParam(defaultValue = "1") Integer pageNumber,
        @RequestParam(defaultValue = "10") Integer pageSize,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime beginDate,
        @RequestParam(required = false) @DateTimeFormat(iso = DATE_TIME) LocalDateTime endDate)
        throws Exception {
    Instant startTime = Instant.now();
    log.info("pagingQuery start.", startTime.toEpochMilli());

    Page<Performance> page =
            performanceService.pagingQuery(pageNumber, pageSize, beginDate, endDate);

    BasePageResponse response = new BasePageResponse(ConstantCode.RET_SUCCEED);
    response.setTotalCount(page.getTotalElements());
    response.setData(page.getContent());

    log.info("pagingQuery end. useTime:{}",
            Duration.between(startTime, Instant.now()).toMillis());
    return response;
}
 
Example 6
Source Project: WeBASE-Front   Source File: LogParseController.java    License: Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Get NetWork Data")
@GetMapping("/getNetWorkData")
public BasePageResponse getNetWorkData(@RequestParam(defaultValue = "1") Integer groupId,
        @RequestParam(defaultValue = "1") Integer pageNumber,
        @RequestParam(defaultValue = "10") Integer pageSize,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime beginDate,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime endDate) {

    Instant startTime = Instant.now();
    log.info("getNetWorkData start. groupId:{}", groupId,
            startTime.toEpochMilli());

    Page<NetWorkData> page =
            logParseService.getNetWorkData(groupId, pageNumber, pageSize, beginDate, endDate);

    BasePageResponse response = new BasePageResponse(ConstantCode.RET_SUCCEED);
    response.setTotalCount(page.getTotalElements());
    response.setData(page.getContent());

    log.info("getNetWorkData end  useTime:{}",
            Duration.between(startTime, Instant.now()).toMillis());
    return response;
}
 
Example 7
Source Project: WeBASE-Front   Source File: LogParseController.java    License: Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Get Transaction Gas Data")
@GetMapping("/getTxGasData")
public BasePageResponse getTxGasData(@RequestParam(defaultValue = "1") int groupId,
        @RequestParam(defaultValue = "1") Integer pageNumber,
        @RequestParam(defaultValue = "10") Integer pageSize,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime beginDate,
        @RequestParam(required = false) @DateTimeFormat(iso = DATE_TIME) LocalDateTime endDate,
        @RequestParam(required = false) String transHash) {

    Instant startTime = Instant.now();
    log.info("getTxGasData start. groupId:{}", groupId, startTime.toEpochMilli());

    Page<TxGasData> page = logParseService.getTxGasData(groupId, pageNumber, pageSize,
            beginDate, endDate, transHash);

    BasePageResponse response = new BasePageResponse(ConstantCode.RET_SUCCEED);
    response.setTotalCount(page.getTotalElements());
    response.setData(page.getContent());

    log.info("getTxGasData end useTime:{}",
            Duration.between(startTime, Instant.now()).toMillis());
    return response;
}
 
Example 8
Source Project: WeBASE-Front   Source File: MonitorController.java    License: Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping("/pagingQuery")
public BasePageResponse pagingQuery(@RequestParam(defaultValue = "1") int groupId,
        @RequestParam(defaultValue = "1") Integer pageNumber,
        @RequestParam(defaultValue = "10") Integer pageSize,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime beginDate,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime endDate) {
    Instant startTime = Instant.now();
    log.info("pagingQuery start. groupId:{}", groupId, startTime.toEpochMilli());

    Page<Monitor> page =
            monitorService.pagingQuery(groupId, pageNumber, pageSize, beginDate, endDate);

    BasePageResponse response = new BasePageResponse(ConstantCode.RET_SUCCEED);
    response.setTotalCount(page.getTotalElements());
    response.setData(page.getContent());

    log.info("pagingQuery end. useTime:{}",
            Duration.between(startTime, Instant.now()).toMillis());
    return response;
}
 
Example 9
Source Project: frostmourne   Source File: DataQueryController.java    License: MIT License 6 votes vote down vote up
@ResponseBody
@RequestMapping(value = "/elasticsearchData", method = RequestMethod.GET)
public Protocol<ElasticsearchDataResult> elasticsearchData(@RequestParam(value = "_appId", required = true) String _appId,
                                                           @RequestParam(value = "dataName", required = true) String dataName,
                                                           @RequestParam(value = "startTime", required = true)
                                                           @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ") Date startTime,
                                                           @RequestParam(value = "endTime", required = true)
                                                           @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ") Date endTime,
                                                           @RequestParam(value = "esQuery", required = false) String esQuery,
                                                           @RequestParam(value = "scrollId", required = false) String scrollId,
                                                           @RequestParam(value = "sortOrder", required = true) String sortOrder,
                                                           @RequestParam(value = "intervalInSeconds", required = false) Integer intervalInSeconds) {
    if (Strings.isNullOrEmpty(esQuery)) {
        esQuery = "*";
    }
    ElasticsearchDataResult elasticsearchDataResult = queryService.elasticsearchQuery(dataName, startTime, endTime, esQuery, scrollId, sortOrder, intervalInSeconds);
    return new Protocol<>(elasticsearchDataResult);
}
 
Example 10
Source Project: frostmourne   Source File: DataQueryController.java    License: MIT License 6 votes vote down vote up
@RequestMapping(value = "/downloadData", method = RequestMethod.GET)
public void downloadData(HttpServletResponse response, @RequestParam(value = "_appId", required = true) String _appId,
                         @RequestParam(value = "dataName", required = true) String dataName,
                         @RequestParam(value = "startTime", required = true)
                         @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ") Date startTime,
                         @RequestParam(value = "endTime", required = true)
                         @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ") Date endTime,
                         @RequestParam(value = "esQuery", required = true) String esQuery,
                         @RequestParam(value = "scrollId", required = false) String scrollId,
                         @RequestParam(value = "sortOrder", required = true) String sortOrder) throws IOException {
    response.setContentType("application/octet-stream;charset=utf-8");
    String fileName = dataName + "-" + DateTime.now().toString("yyyyMMddHHmmssSSS") + ".csv";
    response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
    response.setHeader("attachment-filename", fileName);
    byte[] bom = {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF};
    response.getOutputStream().write(bom);
    try (OutputStreamWriter outputStreamWriter = new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8);
         CSVWriter csvWriter = new CSVWriter(outputStreamWriter, ',')) {
        queryService.exportToCsv(csvWriter, dataName, new DateTime(startTime), new DateTime(endTime), esQuery, null, sortOrder);
    } finally {
        response.getOutputStream().flush();
        response.getOutputStream().close();
    }
}
 
Example 11
Source Project: frostmourne   Source File: LogController.java    License: MIT License 6 votes vote down vote up
@RequestMapping(value = "/findAlertLog", method = RequestMethod.GET)
public Protocol<PagerContract<AlertLog>> findAlertLog(@RequestParam(value = "_appId", required = true) String _appId,
                                                      @RequestParam(value = "pageIndex", required = true) int pageIndex,
                                                      @RequestParam(value = "pageSize", required = true) int pageSize,
                                                      @RequestParam(value = "startTime", required = true)
                                                      @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ") Date startTime,
                                                      @RequestParam(value = "endTime", required = true)
                                                      @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZZ") Date endTime,
                                                      @RequestParam(value = "executeId", required = false) Long executeId,
                                                      @RequestParam(value = "alarmId", required = false) Long alarmId,
                                                      @RequestParam(value = "way", required = false) String way,
                                                      @RequestParam(value = "sendStatus", required = false) String sendStatus,
                                                      @RequestParam(value = "inSilence", required = false) String inSilence,
                                                      @RequestParam(value = "alertType", required = false) String alertType) {
    String account = AuthTool.currentUser().getAccount();
    PagerContract<AlertLog> pagerContract = logService.findAlertLog(pageIndex, pageSize, startTime, endTime,
            executeId, alarmId, account, way, sendStatus, inSilence, alertType);
    return new Protocol<>(pagerContract);
}
 
Example 12
@Override
public Printer<?> getPrinter(DateTimeFormat annotation, Class<?> fieldType) {
	DateTimeFormatter formatter = getFormatter(annotation, fieldType);

	// Efficient ISO_LOCAL_* variants for printing since they are twice as fast...
	if (formatter == DateTimeFormatter.ISO_DATE) {
		if (isLocal(fieldType)) {
			formatter = DateTimeFormatter.ISO_LOCAL_DATE;
		}
	}
	else if (formatter == DateTimeFormatter.ISO_TIME) {
		if (isLocal(fieldType)) {
			formatter = DateTimeFormatter.ISO_LOCAL_TIME;
		}
	}
	else if (formatter == DateTimeFormatter.ISO_DATE_TIME) {
		if (isLocal(fieldType)) {
			formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
		}
	}

	return new TemporalAccessorPrinter(formatter);
}
 
Example 13
Source Project: open-cloud   Source File: BaseAuthorityController.java    License: MIT License 6 votes vote down vote up
/**
 * 分配用户权限
 *
 * @param userId       用户ID
 * @param expireTime   授权过期时间
 * @param authorityIds 权限ID.多个以,隔开
 * @return
 */
@ApiOperation(value = "分配用户权限", notes = "分配用户权限")
@ApiImplicitParams({
        @ApiImplicitParam(name = "userId", value = "用户ID", defaultValue = "", required = true, paramType = "form"),
        @ApiImplicitParam(name = "expireTime", value = "过期时间.选填", defaultValue = "", required = false, paramType = "form"),
        @ApiImplicitParam(name = "authorityIds", value = "权限ID.多个以,隔开.选填", defaultValue = "", required = false, paramType = "form")
})
@PostMapping("/authority/user/grant")
public ResultBody grantAuthorityUser(
        @RequestParam(value = "userId") Long userId,
        @RequestParam(value = "expireTime", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date expireTime,
        @RequestParam(value = "authorityIds", required = false) String authorityIds
) {
    baseAuthorityService.addAuthorityUser(userId, expireTime, StringUtils.isNotBlank(authorityIds) ? authorityIds.split(",") : new String[]{});
    openRestTemplate.refreshGateway();
    return ResultBody.ok();
}
 
Example 14
Source Project: HIS   Source File: BmsDailySettlementController.java    License: Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据起始、结束时间和收费员id统计日结信息并日结")
@RequestMapping(value = "/dailySettle", method = RequestMethod.GET)
@ResponseBody
public CommonResult dailySettle(@RequestParam("cashierId") Long cashierId,
                                @RequestParam("startDatetime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startDatetime,
                                @RequestParam("endDatetime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endDatetime){
    Long result = bmsDailySettlementService.dailySettle(cashierId, startDatetime, endDatetime);
    if (result != null){
        return CommonResult.success(result);
    }
    else {
        return CommonResult.failed();
    }
}
 
Example 15
Source Project: HIS   Source File: BmsInvoiceController.java    License: Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据时间和收费员Id查询发票信息")
@RequestMapping(value = "/queryInvoiceInfo", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<BmsInvoiceResult>>  queryInvoiceInfo(@RequestParam("cashierId") Long cashierId, @RequestParam("startDatetime")@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startDatetime, @RequestParam("endDatetime")@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endDatetime){
    List<BmsInvoiceResult> bmsInvoiceResultList = bmsInvoiceService.queryInvoiceInfo(cashierId, startDatetime, endDatetime);
    return CommonResult.success(bmsInvoiceResultList);
}
 
Example 16
@Override
public Parser<?> getParser(DateTimeFormat annotation, Class<?> fieldType) {
	if (LocalDate.class == fieldType) {
		return new LocalDateParser(getFormatter(annotation, fieldType));
	}
	else if (LocalTime.class == fieldType) {
		return new LocalTimeParser(getFormatter(annotation, fieldType));
	}
	else if (LocalDateTime.class == fieldType) {
		return new LocalDateTimeParser(getFormatter(annotation, fieldType));
	}
	else {
		return new DateTimeParser(getFormatter(annotation, fieldType));
	}
}
 
Example 17
/**
 * Factory method used to create a {@link DateTimeFormatter}.
 * @param annotation the format annotation for the field
 * @param fieldType the type of field
 * @return a {@link DateTimeFormatter} instance
 * @since 3.2
 */
protected DateTimeFormatter getFormatter(DateTimeFormat annotation, Class<?> fieldType) {
	DateTimeFormatterFactory factory = new DateTimeFormatterFactory();
	String style = resolveEmbeddedValue(annotation.style());
	if (StringUtils.hasLength(style)) {
		factory.setStyle(style);
	}
	factory.setIso(annotation.iso());
	String pattern = resolveEmbeddedValue(annotation.pattern());
	if (StringUtils.hasLength(pattern)) {
		factory.setPattern(pattern);
	}
	return factory.createDateTimeFormatter();
}
 
Example 18
Source Project: HIS   Source File: SmsWorkloadController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 描述:根据时间段统计科室所有人工作量(一个科室所有人)
 * <p>author: ma
 */
@ApiOperation("根据时间段统计科室所有人工作量(一个科室所有人)")
@RequestMapping(value = "/queryDeptPersonalWorkloadList", method = RequestMethod.POST)
@ResponseBody
public CommonResult<List<SmsWorkloadResult>>  queryDeptPersonalWorkloadList(@RequestParam("deptId") Long deptId,
                                                                            @RequestParam("startDatetime")@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startDatetime,
                                                                            @RequestParam("endDatetime")@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endDatetime){
    return CommonResult.success(smsWorkloadService.queryDeptPersonalWorkloadList(deptId,startDatetime,endDatetime));
}
 
Example 19
/**
 * Factory method used to create a {@link DateTimeFormatter}.
 * @param annotation the format annotation for the field
 * @param fieldType the declared type of the field
 * @return a {@link DateTimeFormatter} instance
 */
protected DateTimeFormatter getFormatter(DateTimeFormat annotation, Class<?> fieldType) {
	DateTimeFormatterFactory factory = new DateTimeFormatterFactory();
	String style = resolveEmbeddedValue(annotation.style());
	if (StringUtils.hasLength(style)) {
		factory.setStylePattern(style);
	}
	factory.setIso(annotation.iso());
	String pattern = resolveEmbeddedValue(annotation.pattern());
	if (StringUtils.hasLength(pattern)) {
		factory.setPattern(pattern);
	}
	return factory.createDateTimeFormatter();
}
 
Example 20
Source Project: HIS   Source File: SmsSkdController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 描述:根据多条排班规则生成skd
 * <p>author: ma
 */
@ApiOperation("根据多条排班规则生成skd")
@RequestMapping(value = "/generateSkd", method = RequestMethod.POST)
@ResponseBody
public CommonResult generateSkd(@RequestParam("ruleIds") List<Long> ruleIds, @RequestParam("startDate")@DateTimeFormat(pattern = "yyyy-MM-dd")Date startDate, @RequestParam("endDate") @DateTimeFormat(pattern = "yyyy-MM-dd")Date endDate){
    int count = smsSkdService.generateSkd(ruleIds,startDate,endDate);
    if(count > 0){
        return CommonResult.success(count,"生成成功");
    }
    return CommonResult.failed("生成失败");
}
 
Example 21
protected Formatter<Date> getFormatter(DateTimeFormat annotation, Class<?> fieldType) {
	DateFormatter formatter = new DateFormatter();
	String style = resolveEmbeddedValue(annotation.style());
	if (StringUtils.hasLength(style)) {
		formatter.setStylePattern(style);
	}
	formatter.setIso(annotation.iso());
	String pattern = resolveEmbeddedValue(annotation.pattern());
	if (StringUtils.hasLength(pattern)) {
		formatter.setPattern(pattern);
	}
	return formatter;
}
 
Example 22
Source Project: spring-analysis-note   Source File: JodaTimeFormattingTests.java    License: MIT License 5 votes vote down vote up
@Test
public void testBindLocalTimeWithSpecificFormatter() {
	JodaTimeFormatterRegistrar registrar = new JodaTimeFormatterRegistrar();
	registrar.setTimeFormatter(org.joda.time.format.DateTimeFormat.forPattern("HHmmss"));
	setup(registrar);
	MutablePropertyValues propertyValues = new MutablePropertyValues();
	propertyValues.add("localTime", "130000");
	binder.bind(propertyValues);
	assertEquals(0, binder.getBindingResult().getErrorCount());
	assertEquals("130000", binder.getBindingResult().getFieldValue("localTime"));
}
 
Example 23
Source Project: spring-analysis-note   Source File: JodaTimeFormattingTests.java    License: MIT License 5 votes vote down vote up
@Test
public void testBindDateTimeWithSpecificFormatter() {
	JodaTimeFormatterRegistrar registrar = new JodaTimeFormatterRegistrar();
	registrar.setDateTimeFormatter(org.joda.time.format.DateTimeFormat.forPattern("yyyyMMddHHmmss"));
	setup(registrar);
	MutablePropertyValues propertyValues = new MutablePropertyValues();
	propertyValues.add("dateTime", "20091031130000");
	binder.bind(propertyValues);
	assertEquals(0, binder.getBindingResult().getErrorCount());
	assertEquals("20091031130000", binder.getBindingResult().getFieldValue("dateTime"));
}
 
Example 24
Source Project: spring-analysis-note   Source File: JodaTimeFormattingTests.java    License: MIT License 5 votes vote down vote up
@Test
public void dateToStringWithFormat() {
	JodaTimeFormatterRegistrar registrar = new JodaTimeFormatterRegistrar();
	registrar.setDateTimeFormatter(org.joda.time.format.DateTimeFormat.shortDateTime());
	setup(registrar);
	Date date = new Date();
	Object actual = this.conversionService.convert(date, TypeDescriptor.valueOf(Date.class), TypeDescriptor.valueOf(String.class));
	String expected = JodaTimeContextHolder.getFormatter(org.joda.time.format.DateTimeFormat.shortDateTime(), Locale.US).print(new DateTime(date));
	assertEquals(expected, actual);
}
 
Example 25
Source Project: HIS   Source File: SmsWorkloadController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 描述:根据时间段统计某个科室工作量
 * <p>author: ma
 */
@ApiOperation("根据时间段统计某个科室工作量")
@RequestMapping(value = "/queryDept", method = RequestMethod.POST)
@ResponseBody
public CommonResult<SmsWorkloadResult>  queryDeptWorkload(@RequestParam("deptId") Long deptId,
                                                          @RequestParam("startDatetime")@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")Date startDatetime,
                                                          @RequestParam("endDatetime")@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endDatetime){
    return CommonResult.success(smsWorkloadService.queryDeptWorkloadPeriod(deptId,startDatetime,endDatetime));
}
 
Example 26
Source Project: WeBASE-Front   Source File: MonitorController.java    License: Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "查询链上数据", notes = "查询链上数据")
@ApiImplicitParams({@ApiImplicitParam(name = "beginDate", value = "开始时间"),
        @ApiImplicitParam(name = "endDate", value = "结束时间"),
        @ApiImplicitParam(name = "contrastBeginDate", value = "对比开始时间"),
        @ApiImplicitParam(name = "contrastEndDate", value = "对比结束时间"),
        @ApiImplicitParam(name = "gap", value = "时间间隔", dataType = "int")})
@GetMapping
public List<PerformanceData> getChainMonitor(
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime beginDate,
        @RequestParam(required = false) @DateTimeFormat(iso = DATE_TIME) LocalDateTime endDate,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime contrastBeginDate,
        @RequestParam(required = false) @DateTimeFormat(
                iso = DATE_TIME) LocalDateTime contrastEndDate,
        @RequestParam(required = false, defaultValue = "1") int gap,
        @RequestParam(defaultValue = "1") int groupId) {
    Instant startTime = Instant.now();
    log.info("getChainMonitor start. groupId:[{}]", groupId,
            startTime.toEpochMilli());

    List<PerformanceData> performanceList = monitorService.findContrastDataByTime(groupId,
            beginDate, endDate, contrastBeginDate, contrastEndDate, gap);

    log.info("getChainMonitor end. useTime:{}",
            Duration.between(startTime, Instant.now()).toMillis());
    return performanceList;
}
 
Example 27
Source Project: cf-butler   Source File: UsageController.java    License: Apache License 2.0 5 votes vote down vote up
@GetMapping(value = "/accounting/applications/{orgName}/{startDate}/{endDate}")
public Mono<ResponseEntity<String>> getOrganizationApplicationUsageReport(
    @PathVariable("orgName") String organizationName,
    @DateTimeFormat(iso = ISO.DATE) @PathVariable("startDate") LocalDate startDate,
    @DateTimeFormat(iso = ISO.DATE) @PathVariable("endDate") LocalDate endDate
) {
    return service.getApplicationUsage(organizationName, startDate, endDate)
            .map(r -> ResponseEntity.ok(r))
            .defaultIfEmpty(ResponseEntity.notFound().build());
}
 
Example 28
Source Project: cf-butler   Source File: UsageController.java    License: Apache License 2.0 5 votes vote down vote up
@GetMapping(value = "/accounting/services/{orgName}/{startDate}/{endDate}")
public Mono<ResponseEntity<String>> getOrganizationServiceUsageReport(
    @PathVariable("orgName") String organizationName,
    @DateTimeFormat(iso = ISO.DATE) @PathVariable("startDate") LocalDate startDate,
    @DateTimeFormat(iso = ISO.DATE) @PathVariable("endDate") LocalDate endDate
) {
    return service.getServiceUsage(organizationName, startDate, endDate)
            .map(r -> ResponseEntity.ok(r))
            .defaultIfEmpty(ResponseEntity.notFound().build());
}
 
Example 29
Source Project: cf-butler   Source File: UsageController.java    License: Apache License 2.0 5 votes vote down vote up
@GetMapping(value = "/accounting/tasks/{orgName}/{startDate}/{endDate}")
public Mono<ResponseEntity<String>> getOrganizationTaskUsageReport(
    @PathVariable("orgName") String organizationName,
    @DateTimeFormat(iso = ISO.DATE) @PathVariable("startDate") LocalDate startDate,
    @DateTimeFormat(iso = ISO.DATE) @PathVariable("endDate") LocalDate endDate
) {
    return service.getTaskUsage(organizationName, startDate, endDate)
            .map(r -> ResponseEntity.ok(r))
            .defaultIfEmpty(ResponseEntity.notFound().build());
}
 
Example 30
Source Project: spring-security-samples   Source File: LeaveRequestController.java    License: MIT License 5 votes vote down vote up
@PostMapping("/request/{employee}")
public ResponseEntity<LeaveRequestDTO> request(
		@PathVariable String employee,
		@DateTimeFormat(iso = ISO.DATE) @RequestParam LocalDate from,
		@DateTimeFormat(iso = ISO.DATE) @RequestParam LocalDate to) {
	LeaveRequest leaveRequest = service.request(employee, from, to);
	return accepted().body(new LeaveRequestDTO(leaveRequest));
}