|
|
@@ -18,6 +18,7 @@ import com.xjrsoft.module.organization.entity.UserDeptRelation;
|
|
|
import com.xjrsoft.module.personnel.dto.AddCarMessageApplyDto;
|
|
|
import com.xjrsoft.module.personnel.dto.CarMessageApplyPageDto;
|
|
|
import com.xjrsoft.module.personnel.dto.UpdateCarMessageApplyDto;
|
|
|
+import com.xjrsoft.module.personnel.dto.UpdateCarMessageApplyEndTimeDto;
|
|
|
import com.xjrsoft.module.personnel.entity.CarMessageApply;
|
|
|
import com.xjrsoft.module.personnel.service.ICarMessageApplyService;
|
|
|
import com.xjrsoft.module.personnel.vo.CarMessageApplyPageVo;
|
|
|
@@ -37,6 +38,10 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.time.Instant;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.ZonedDateTime;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -115,7 +120,7 @@ public class CarMessageApplyController {
|
|
|
public RT<Boolean> add(@Valid @RequestBody AddCarMessageApplyDto dto){
|
|
|
CarMessageApply carMessageApply = BeanUtil.toBean(dto, CarMessageApply.class);
|
|
|
boolean isSuccess = carMessageApplyService.save(carMessageApply);
|
|
|
- return RT.ok(isSuccess);
|
|
|
+ return RT.ok(isSuccess);
|
|
|
}
|
|
|
|
|
|
@PutMapping
|
|
|
@@ -147,4 +152,24 @@ public class CarMessageApplyController {
|
|
|
return R.ok(true);
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/update-end-time-batch")
|
|
|
+ @ApiOperation(value = "批量修改有效期")
|
|
|
+ @SaCheckPermission("carmessageapply:add")
|
|
|
+ public RT<Boolean> add(@Valid @RequestBody UpdateCarMessageApplyEndTimeDto dto){
|
|
|
+
|
|
|
+ List<CarMessageApply> list = carMessageApplyService.listByIds(dto.getIds());
|
|
|
+ for (CarMessageApply carMessageApply : list) {
|
|
|
+ ZonedDateTime zonedDateTime = dto.getEndTime().atStartOfDay(ZoneId.systemDefault());
|
|
|
+
|
|
|
+ // 将 ZonedDateTime 转换为 Instant
|
|
|
+ Instant instant = zonedDateTime.toInstant();
|
|
|
+
|
|
|
+ // 将 Instant 转换为 Date
|
|
|
+ Date date = Date.from(instant);
|
|
|
+ carMessageApply.setEndTime(date);
|
|
|
+ }
|
|
|
+ boolean updated = carMessageApplyService.updateBatchById(list);
|
|
|
+ return RT.ok(updated);
|
|
|
+ }
|
|
|
+
|
|
|
}
|