|
@@ -0,0 +1,73 @@
|
|
|
+package com.platform.rest.controller.sb;
|
|
|
+
|
|
|
+import com.platform.common.bean.AbstractPageResultBean;
|
|
|
+import com.platform.common.model.OauthUser;
|
|
|
+import com.platform.common.model.UserInfo;
|
|
|
+import com.platform.common.util.BeanConverterUtil;
|
|
|
+import com.platform.common.util.IdGeneratorUtils;
|
|
|
+import com.platform.common.util.R;
|
|
|
+import com.platform.common.util.SecurityUtils;
|
|
|
+import com.platform.common.validation.group.AddGroup;
|
|
|
+import com.platform.common.validation.group.UpdateGroup;
|
|
|
+import com.platform.dao.dto.sb.BatchSbMeasureLog;
|
|
|
+import com.platform.dao.dto.sb.SbMeasureLogDTO;
|
|
|
+import com.platform.dao.entity.sb.SbMeasureLog;
|
|
|
+import com.platform.dao.entity.sb.SbUpdateLog;
|
|
|
+import com.platform.dao.mapper.sb.SbUpdateLogMapper;
|
|
|
+import com.platform.dao.util.ExcelUtil;
|
|
|
+import com.platform.dao.vo.export.sb.ExportSbMeasureLogVO;
|
|
|
+import com.platform.dao.vo.query.sb.SbMeasureLogVO;
|
|
|
+import com.platform.rest.log.annotation.SysLog;
|
|
|
+import com.platform.service.sb.SbMeasureLogService;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description 设备计量记录 控制器
|
|
|
+ * @Author liuyu
|
|
|
+ * @Date 2020-05-28 17:23:30
|
|
|
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/sb/update-logs")
|
|
|
+public class SbUpdateLogController {
|
|
|
+
|
|
|
+
|
|
|
+ private final SbUpdateLogMapper sbUpdateLogMapper;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增记录
|
|
|
+ *
|
|
|
+ * @param checkStandardDTO 设备计量记录DTO
|
|
|
+ * @return R
|
|
|
+ */
|
|
|
+ @SysLog("新增设备计量记录")
|
|
|
+ @PostMapping
|
|
|
+ public R save(@Validated({AddGroup.class}) @RequestBody SbUpdateLog sbUpdateLog) {
|
|
|
+ setCreateUserInfo(sbUpdateLog);
|
|
|
+ sbUpdateLog.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ return new R<>(sbUpdateLogMapper.insert(sbUpdateLog));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setCreateUserInfo(SbUpdateLog model) {
|
|
|
+ model.setCreatedTime(LocalDateTime.now());
|
|
|
+ model.setUpdateTime(LocalDateTime.now());
|
|
|
+ OauthUser user = SecurityUtils.getUser();
|
|
|
+ if (user != null) {
|
|
|
+ UserInfo userInfo = user.getUserInfo();
|
|
|
+ model.setCreatedUserId(userInfo.getUserId());
|
|
|
+ model.setCreatedUserName(userInfo.getRealName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|