Parcourir la source

调整时间类型

ljx il y a 4 ans
Parent
commit
481f97e44a

+ 12 - 4
src/main/java/com/imed/costaccount/service/impl/CostCostingGroupServiceImpl.java

@@ -62,16 +62,24 @@ public class CostCostingGroupServiceImpl extends ServiceImpl<CostCostingGroupMap
      * @param pageSize           每页数据大小
      * @param responsibilityCode 责任中心代码
      * @param accountCode        会计中心代码
-     * @param date               日期 yyyy-MM-dd
+     * @param date               日期 yyyy-MM
      * @param hospId             医院id
      * @return 分摊前查询列表
      */
     @Override
     public PageUtils queryStartAllocation(Integer current, Integer pageSize, String responsibilityCode, String accountCode, String date, Long hospId) {
         Integer startIndex = (current - 1) * pageSize;
-        DateTime dateTime = DateUtil.parseDate(date);
-        Integer year = DateUtil.year(dateTime);
-        Integer month = DateUtil.month(dateTime) + 1;
+        int year = 0;
+        int month = 0;
+        if (StrUtil.isNotBlank(date)) {
+            Date dateTime = DateUtils.StringToDate(date, DateStyleEnum.YYYY_MM);
+            year = DateUtil.year(dateTime);
+            month = DateUtil.month(dateTime) + 1;
+        }
+//        DateTime dateTime = DateUtil.parseDate(date);
+//
+//        Integer year = DateUtil.year(dateTime);
+//        Integer month = DateUtil.month(dateTime) + 1;
         List<CostingGroupStartVO> list = baseMapper.queryStartAllocation(startIndex, pageSize, responsibilityCode, accountCode, year, month, hospId);
         int count = baseMapper.queryStartAllocationCount(responsibilityCode, accountCode, year, month, hospId);
         BigDecimal totalAmount = baseMapper.queryStartAllocationTotalAmount(responsibilityCode, accountCode, year, month, hospId);

+ 1 - 1
src/main/java/com/imed/costaccount/service/impl/CostOtherPaymentsDataServiceImpl.java

@@ -119,8 +119,8 @@ public class CostOtherPaymentsDataServiceImpl extends ServiceImpl<CostOtherPayme
         String dateTime = costOtherPaymentsDataEditDto.getDateTime();
         int year = 0;
         int month = 0;
-        Date date = DateUtils.StringToDate(dateTime, DateStyleEnum.YYYY_MM);
         if (StrUtil.isNotBlank(dateTime)) {
+            Date date = DateUtils.StringToDate(dateTime, DateStyleEnum.YYYY_MM);
             year = DateUtil.year(date);
             month = DateUtil.month(date) + 1;
         }

+ 3 - 3
src/main/java/com/imed/costaccount/web/CostCostingGroupController.java

@@ -37,7 +37,7 @@ public class CostCostingGroupController extends AbstractController {
             @ApiImplicitParam(name = "pageSize", value = "当前页大小", required = true),
             @ApiImplicitParam(name = "responsibilityCode", value = "责任中心代码", required = false),
             @ApiImplicitParam(name = "accountCode", value = "会计中心代码"),
-            @ApiImplicitParam(name = "date", value = "年月yyyy-MM-dd")}
+            @ApiImplicitParam(name = "date", value = "年月yyyy-MM")}
     )
     public Result queryStartAllocation(@RequestParam(value = "current", defaultValue = "1") Integer current,
                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@@ -45,8 +45,8 @@ public class CostCostingGroupController extends AbstractController {
                                        @RequestParam(value = "accountCode", required = false) String accountCode,
                                        @RequestParam(value = "date") String date) {
         // 简单校验时间格式 这里要求的是yyyy-MM-dd
-        if (date.length() != 10) {
-            throw new CostException("时间格式不正确,这里要求yyyy-MM-dd 格式");
+        if (date.length() != 7) {
+            throw new CostException("时间格式不正确,这里要求yyyy-MM 格式");
         }
         PageUtils pageUtils = costCostingGroupService.queryStartAllocation(current, pageSize, responsibilityCode, accountCode, date, getHospId());
         return Result.ok(pageUtils);