|
@@ -11,6 +11,7 @@ import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.his.domain.*;
|
|
|
import com.fs.his.dto.FsInquiryOrderPatientDTO;
|
|
|
import com.fs.his.dto.FsStoreOrderAddressDTO;
|
|
|
+import com.fs.his.dto.PackageOrderDTO;
|
|
|
import com.fs.his.param.*;
|
|
|
import com.fs.his.service.*;
|
|
|
import com.fs.his.vo.*;
|
|
@@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ThreadLocalRandom;
|
|
|
|
|
|
|
|
|
@Api("套餐订单接口")
|
|
@@ -198,4 +200,38 @@ public class PackageOrderController extends AppBaseController {
|
|
|
return R.ok().put("count",count);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("/根据套餐id查询最新的20条订单")
|
|
|
+ @GetMapping("/getNewOrderByPackageId")
|
|
|
+ public R getNewOrderByPackageId(@RequestParam("packageId") Long packageId){
|
|
|
+ List<PackageOrderDTO> newOrderByPackageId = packageOrderService.getNewOrder();
|
|
|
+
|
|
|
+ // 当前时间 和 10分钟前
|
|
|
+ long nowMillis = System.currentTimeMillis();
|
|
|
+ long tenMinutesAgoMillis = nowMillis - 10 * 60 * 1000;
|
|
|
+
|
|
|
+ for (PackageOrderDTO dto : newOrderByPackageId) {
|
|
|
+ // 在10分钟内随机一个时间戳
|
|
|
+ long randomMillis = ThreadLocalRandom.current().nextLong(tenMinutesAgoMillis, nowMillis);
|
|
|
+ dto.setPayTime(new Date(randomMillis));
|
|
|
+ //用户名脱敏
|
|
|
+ // 脱敏 fsUserName 字段(保留首尾)
|
|
|
+ String fsUserName = dto.getFsUserName();
|
|
|
+ if (fsUserName != null && fsUserName.length() > 2) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append(fsUserName.charAt(0)); // 第一个字符
|
|
|
+ for (int i = 1; i < fsUserName.length() - 1; i++) {
|
|
|
+ sb.append("*"); // 中间全部 *
|
|
|
+ }
|
|
|
+ sb.append(fsUserName.charAt(fsUserName.length() - 1)); // 最后一个字符
|
|
|
+ dto.setFsUserName(sb.toString());
|
|
|
+ }
|
|
|
+ // 如果只有 2 个字符,不需要加星
|
|
|
+ else if (fsUserName != null && fsUserName.length() == 2) {
|
|
|
+ dto.setFsUserName(fsUserName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.ok().put("data", newOrderByPackageId);
|
|
|
+ }
|
|
|
+
|
|
|
}
|