|
@@ -1,5 +1,7 @@
|
|
|
package com.fjhx.stock.controller;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -19,10 +21,7 @@ import com.fjhx.stock.service.StockBackService;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -267,5 +266,27 @@ public class StockBackController {
|
|
|
return R.success(result);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/setStatisticsDate")
|
|
|
+ public R setStatisticsDate() {
|
|
|
+ List<StockBack> list = stockBackService.list(
|
|
|
+ Wrappers.<StockBack>lambdaQuery().select(StockBack::getId, StockBack::getOperationTime));
|
|
|
+ for (StockBack stockBack : list) {
|
|
|
+ Date date = stockBack.getOperationTime();
|
|
|
+
|
|
|
+ if (date == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Convert.toInt(DateUtil.format(date, "H")) < 10) {
|
|
|
+ stockBack.setStatisticsDate(DateUtil.offsetDay(date, -1));
|
|
|
+ } else {
|
|
|
+ stockBack.setStatisticsDate(date);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ stockBackService.updateBatchById(list);
|
|
|
+ return R.success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|