Commit fc56df65 authored by LiuLin's avatar LiuLin

fix(ymt):登记使用证生成

parent 6ff62da9
package com.yeejoin.amos.boot.module.ymt.api.common;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.Date;
public class DateUtils {
public static Date calculateEndOfYear(Date currentDate) {
LocalDateTime localDateTime = toLocalDateTime(currentDate);
LocalDateTime endOfYear = localDateTime.with(LocalDateTime.of(localDateTime.getYear(), 12, 31, 23, 59, 59, 999999999));
return toDate(endOfYear);
}
public static Date calculateEndOfMonth(Date currentDate) {
LocalDateTime localDateTime = toLocalDateTime(currentDate);
LocalDateTime endOfMonth = localDateTime.with(localDateTime.withDayOfMonth(localDateTime.getMonth().maxLength())
.withHour(23)
.withMinute(59)
.withSecond(59)
.withNano(999999999));
return toDate(endOfMonth);
}
public static Date calculateEndOfDay(Date currentDate) {
LocalDateTime localDateTime = toLocalDateTime(currentDate);
LocalDateTime endOfDay = localDateTime.with(LocalDateTime.of(localDateTime.toLocalDate(), LocalTime.MAX));
return toDate(endOfDay);
}
private static LocalDateTime toLocalDateTime(Date date) {
return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
}
private static Date toDate(LocalDateTime localDateTime) {
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}
}
//package com.yeejoin.amos.boot.module.ymt.api.controller;
//
//import com.yeejoin.amos.boot.biz.common.controller.BaseController;
//import com.yeejoin.amos.boot.module.ymt.api.service.ICreateCodeService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//import org.typroject.tyboot.core.foundation.enumeration.UserType;
//import org.typroject.tyboot.core.restful.doc.TycloudOperation;
//import org.typroject.tyboot.core.restful.utils.ResponseHelper;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//import java.util.List;
//
///**
// *
// * 生成顺序码
// * @author LiuLin
// * @date 2023-12-14
// */
//@RestController
//@Api(tags = "生成顺序码")
//@RequestMapping(value = "/code")
//public class CreateCodeController extends BaseController {
//
// @Autowired
// private ICreateCodeService createCodeService;
//
// /**
// * 申请单编号生成
// * @param type type
// * @param batchSize batchSize
// * @return List
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @PostMapping(value = "/ANCode")
// @ApiOperation(httpMethod = "POST", value = "申请单编号生成", notes = "申请单编号生成")
// public ResponseModel<List<String>> createANCode(@RequestParam("type") String type,
// @RequestParam("batchSize") int batchSize) {
// return ResponseHelper.buildResponse(createCodeService.createApplicationFormCode(type,batchSize));
// }
//
// /**
// * 生成设备注册编码
// * @param key key
// * @return String
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @PostMapping(value = "/DRCode")
// @ApiOperation(httpMethod = "POST", value = "生成设备注册编码", notes = "生成设备注册编码")
// public ResponseModel<String> createDRCode(@RequestParam("key") String key) {
// return ResponseHelper.buildResponse(createCodeService.createDeviceRegistrationCode(key));
// }
//
// /**
// * 使用登记证生成
// * @param key key
// * @return String
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @PostMapping(value = "/URCode")
// @ApiOperation(httpMethod = "POST", value = "使用登记证生成", notes = "使用登记证生成")
// public ResponseModel<String> createURCode(@RequestParam("key") String key) {
// return ResponseHelper.buildResponse(createCodeService.createUseRegistrationCode(key));
// }
//}
...@@ -2,6 +2,11 @@ package com.yeejoin.amos.boot.module.ymt.api.service; ...@@ -2,6 +2,11 @@ package com.yeejoin.amos.boot.module.ymt.api.service;
import java.util.List; import java.util.List;
/**
* 生成码服务类
* @author LiuLin
* @date 2023-12-14
*/
public interface ICreateCodeService { public interface ICreateCodeService {
/** /**
...@@ -20,4 +25,11 @@ public interface ICreateCodeService { ...@@ -20,4 +25,11 @@ public interface ICreateCodeService {
*/ */
String createDeviceRegistrationCode(String key); String createDeviceRegistrationCode(String key);
/**
* 生成使用登记证编号(13位,起11陕C00001(23))
* @param key key
* @return 顺序编号
*/
String createUseRegistrationCode(String key);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment