|
@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 电梯二维码扫码Controller
|
|
|
*/
|
|
@@ -110,7 +112,13 @@ public class ScanRecordController {
|
|
|
* @return 操作结果
|
|
|
*/
|
|
|
@PostMapping("record/add")
|
|
|
- public RestResponse add(@RequestBody ScanRecord scanRecord) {
|
|
|
- return RestResponse.success(scanRecordService.save(scanRecord));
|
|
|
+ public RestResponse<?> add(@RequestBody ScanRecord scanRecord) {
|
|
|
+ List<ScanRecord> list = scanRecordService.list(Wrappers.<ScanRecord>query()
|
|
|
+ .eq(scanRecord.getOpenId() != null, "open_id", scanRecord.getOpenId())
|
|
|
+ .eq(scanRecord.getLiftId() != null, "lift_id", scanRecord.getLiftId()));
|
|
|
+ if (list.isEmpty()) {
|
|
|
+ return RestResponse.success(scanRecordService.save(scanRecord));
|
|
|
+ }
|
|
|
+ return RestResponse.fail("该电梯扫码记录已存在");
|
|
|
}
|
|
|
}
|