org.springframework.format.annotation.DateTimeFormat Java Examples

The following examples show how to use org.springframework.format.annotation.DateTimeFormat. 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 File: DataQueryController.java    From frostmourne with MIT License 7 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 #2
Source File: DataQueryController.java    From frostmourne with 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 #3
Source File: LogController.java    From frostmourne with 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 #4
Source File: MonitorController.java    From WeBASE-Front with 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 #5
Source File: LogParseController.java    From WeBASE-Front with 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 #6
Source File: LogParseController.java    From WeBASE-Front with 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 File: PerformanceController.java    From WeBASE-Front with 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 #8
Source File: Jsr310DateTimeFormatAnnotationFormatterFactory.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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 #9
Source File: ChainController.java    From WeBASE-Node-Manager with 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 #10
Source File: AccountApiClient.java    From XS2A-Sandbox with 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 #11
Source File: Rap2WebGenerator.java    From rap2-generator with 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 #12
Source File: Rap2Generator.java    From rap2-generator with 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 #13
Source File: BaseAuthorityController.java    From open-cloud with 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 File: BmsDailySettlementController.java    From HIS with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据起始、结束时间和收费员Id列出日结历史")
@RequestMapping(value = "/listDailySettleListRecord", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<BmsSettleListItemResult>>  listDailySettleListRecord(@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<BmsSettleListItemResult> bmsSettleListItemResultList = bmsDailySettlementService.listDailySettleListRecord(cashierId, startDatetime, endDatetime);
    return CommonResult.success(bmsSettleListItemResultList);
}
 
Example #15
Source File: BmsDailySettlementController.java    From HIS with 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 #16
Source File: JodaTimeFormattingTests.java    From java-technology-stack with 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 #17
Source File: BmsFeeController.java    From HIS with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "查询挂号人")
@RequestMapping(value = "/listRegisteredPatient", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<BmsRegistrationPatientResult>> listRegisteredPatient(@RequestParam(required=false,name = "medicalRecordNo") String  medicalRecordNo,
                                                                                    @RequestParam(required=false,name="queryDate")@DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate,
                                                                                    @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){


    Page page = PageHelper.startPage(pageNum, pageSize);
    List<BmsRegistrationPatientResult> list = bmsFeeService.listRegisteredPatient(medicalRecordNo,queryDate);
    Long pageTotal=page.getTotal();
    return CommonResult.success(CommonPage.restPage(list,pageTotal));
}
 
Example #18
Source File: SmsWorkloadController.java    From HIS with Apache License 2.0 5 votes vote down vote up
/**
 * 描述:根据时间段查询某个人工作量
 * <p>author: ma
 */
@ApiOperation("根据时间段查询某个人工作量")
@RequestMapping(value = "/queryPersonal", method = RequestMethod.POST)
@ResponseBody
public CommonResult<SmsWorkloadResult> queryPersonalWorkload(@RequestParam("staffId") Long staffId,
                                                             @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.queryPersonalWorkloadPeriod(staffId,startDatetime,endDatetime));
}
 
Example #19
Source File: BmsDailySettlementController.java    From HIS with 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 #20
Source File: BmsFeeController.java    From HIS with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "查询挂号人")
@RequestMapping(value = "/listRegisteredPatient", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<BmsRegistrationPatientResult>> listRegisteredPatient(@RequestParam(required=false,name = "medicalRecordNo") String  medicalRecordNo,
                                                                              @RequestParam(required=false,name="queryDate")@DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate,
                                                                              @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){


    Page page = PageHelper.startPage(pageNum, pageSize);
    List<BmsRegistrationPatientResult> list = bmsFeeService.listRegisteredPatient(medicalRecordNo,queryDate);
    Long pageTotal=page.getTotal();
    return CommonResult.success(CommonPage.restPage(list,pageTotal));
}
 
Example #21
Source File: LeaveRequestController.java    From spring-security-samples with 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));
}
 
Example #22
Source File: JodaTimeFormattingTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testBindLocalDateWithSpecificFormatter() {
	JodaTimeFormatterRegistrar registrar = new JodaTimeFormatterRegistrar();
	registrar.setDateFormatter(org.joda.time.format.DateTimeFormat.forPattern("yyyyMMdd"));
	setup(registrar);
	MutablePropertyValues propertyValues = new MutablePropertyValues();
	propertyValues.add("localDate", "20091031");
	binder.bind(propertyValues);
	assertEquals(0, binder.getBindingResult().getErrorCount());
	assertEquals("20091031", binder.getBindingResult().getFieldValue("localDate"));
}
 
Example #23
Source File: JodaTimeFormattingTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testJodaTimePatternsForStyle() {
	System.out.println(org.joda.time.format.DateTimeFormat.patternForStyle("SS", LocaleContextHolder.getLocale()));
	System.out.println(org.joda.time.format.DateTimeFormat.patternForStyle("MM", LocaleContextHolder.getLocale()));
	System.out.println(org.joda.time.format.DateTimeFormat.patternForStyle("LL", LocaleContextHolder.getLocale()));
	System.out.println(org.joda.time.format.DateTimeFormat.patternForStyle("FF", LocaleContextHolder.getLocale()));
}
 
Example #24
Source File: BmsFeeController.java    From HIS with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "查询挂号人")
@RequestMapping(value = "/listRegisteredPatient", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<BmsRegistrationPatientResult>> listRegisteredPatient(@RequestParam(required=false,name = "medicalRecordNo") String  medicalRecordNo,
                                                                              @RequestParam(required=false,name="queryDate")@DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate,
                                                                              @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){


    Page page = PageHelper.startPage(pageNum, pageSize);
    List<BmsRegistrationPatientResult> list = bmsFeeService.listRegisteredPatient(medicalRecordNo,queryDate);
    Long pageTotal=page.getTotal();
    return CommonResult.success(CommonPage.restPage(list,pageTotal));
}
 
Example #25
Source File: SmsWorkloadController.java    From HIS with Apache License 2.0 5 votes vote down vote up
/**
 * 描述:根据时间段查询某个人工作量
 * <p>author: ma
 */
@ApiOperation("根据时间段查询某个人工作量")
@RequestMapping(value = "/queryPersonal", method = RequestMethod.POST)
@ResponseBody
public CommonResult<SmsWorkloadResult> queryPersonalWorkload(@RequestParam("staffId") Long staffId,
                                                             @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.queryPersonalWorkloadPeriod(staffId,startDatetime,endDatetime));
}
 
Example #26
Source File: BmsFeeDistributionController.java    From HIS with Apache License 2.0 5 votes vote down vote up
@HystrixCommand(fallbackMethod = "listRegisteredPatientFallbackInfo")
@ApiOperation(value = "查询挂号人")
@RequestMapping(value = "/listRegisteredPatient", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<BmsRegistrationPatientResult>> listRegisteredPatient(@RequestParam(required=false,name = "medicalRecordNo") String  medicalRecordNo,
                                                                                    @RequestParam(required=false,name="queryDate")@DateTimeFormat(pattern = "yyyy-MM-dd") Date queryDate,
                                                                                    @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum){
   return apiPcBmsFeeDistributionService.listRegisteredPatient(medicalRecordNo,queryDate,pageSize,pageNum);
}
 
Example #27
Source File: BmsDailySettlementController.java    From HIS with 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 #28
Source File: LeaveRequestController.java    From spring-security-samples with 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));
}
 
Example #29
Source File: SmsWorkloadController.java    From HIS with Apache License 2.0 5 votes vote down vote up
/**
 * 描述:根据时间段统计所有科室工作量
 * <p>author: ma
 */
@ApiOperation("根据时间段统计所有科室工作量")
@RequestMapping(value = "/queryDeptWorkloadList", method = RequestMethod.POST)
@ResponseBody
public CommonResult<List<SmsWorkloadResult>> queryDeptWorkloadList(@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.queryDeptWorkloadList(startDatetime,endDatetime));
}
 
Example #30
Source File: SmsWorkloadController.java    From HIS with 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));
}