|
|
@@ -6,8 +6,8 @@ import com.zd.common.core.log.BusinessType;
|
|
|
import com.zd.common.core.security.TokenService;
|
|
|
import com.zd.common.core.utils.ExcelUtil;
|
|
|
import com.zd.common.core.web.controller.BaseController;
|
|
|
-import com.zd.laboratory.domain.LabWhitelist;
|
|
|
import com.zd.laboratory.domain.XxpCardInfo;
|
|
|
+import com.zd.laboratory.service.ILabSecurityApplyService;
|
|
|
import com.zd.laboratory.service.IXxpCardInfoService;
|
|
|
import com.zd.model.domain.ResultData;
|
|
|
import com.zd.model.domain.per.PerFun;
|
|
|
@@ -32,10 +32,11 @@ import java.util.Map;
|
|
|
@RestController
|
|
|
@Api(tags = "【电子信息牌】")
|
|
|
@RequestMapping("/XxpCardInfo")
|
|
|
-public class LabXxpCardInfoController extends BaseController
|
|
|
-{
|
|
|
+public class LabXxpCardInfoController extends BaseController {
|
|
|
@Autowired
|
|
|
private IXxpCardInfoService xxpCardInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ILabSecurityApplyService iLabSecurityApplyService;
|
|
|
|
|
|
@Autowired
|
|
|
private TokenService tokenService;
|
|
|
@@ -46,9 +47,8 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_CARDINFO + PerFun.LIST)
|
|
|
@GetMapping("/list")
|
|
|
@ApiOperation(value = "查询电子信息牌列表")
|
|
|
- public TableDataInfo<XxpCardInfo> list(XxpCardInfo xxpCardInfo)
|
|
|
- {
|
|
|
- startPage("create_time","descending");
|
|
|
+ public TableDataInfo<XxpCardInfo> list(XxpCardInfo xxpCardInfo) {
|
|
|
+ startPage("create_time", "descending");
|
|
|
List<XxpCardInfo> list = xxpCardInfoService.selectXxpCardInfoList(xxpCardInfo);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
@@ -58,8 +58,7 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
*/
|
|
|
@GetMapping("/getlist")
|
|
|
@ApiOperation(value = "查询电子信息牌列表-无权限")
|
|
|
- public TableDataInfo<XxpCardInfo> getlist(XxpCardInfo xxpCardInfo)
|
|
|
- {
|
|
|
+ public TableDataInfo<XxpCardInfo> getlist(XxpCardInfo xxpCardInfo) {
|
|
|
startPage();
|
|
|
List<XxpCardInfo> list = xxpCardInfoService.selectXxpCardInfoList(xxpCardInfo);
|
|
|
return getDataTable(list);
|
|
|
@@ -72,8 +71,7 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_CARDINFO + PerFun.EXPORT)
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, XxpCardInfo xxpCardInfo) throws IOException
|
|
|
- {
|
|
|
+ public void export(HttpServletResponse response, XxpCardInfo xxpCardInfo) throws IOException {
|
|
|
List<XxpCardInfo> list = xxpCardInfoService.selectXxpCardInfoList(xxpCardInfo);
|
|
|
ExcelUtil<XxpCardInfo> util = new ExcelUtil<XxpCardInfo>(XxpCardInfo.class);
|
|
|
util.exportExcel(response, list, "电子信息牌数据");
|
|
|
@@ -85,8 +83,7 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@ApiOperation(value = "获取电子信息牌详细")
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_CARDINFO + PerFun.QUERY)
|
|
|
@GetMapping(value = "/{id}")
|
|
|
- public ResultData<XxpCardInfo> getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public ResultData<XxpCardInfo> getInfo(@PathVariable("id") Long id) {
|
|
|
return ResultData.success(xxpCardInfoService.selectXxpCardInfoById(id));
|
|
|
}
|
|
|
|
|
|
@@ -98,8 +95,7 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_CARDINFO + PerFun.ADD)
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public ResultData add(@RequestBody XxpCardInfo xxpCardInfo)
|
|
|
- {
|
|
|
+ public ResultData add(@RequestBody XxpCardInfo xxpCardInfo) {
|
|
|
return ResultData.result(xxpCardInfoService.insertXxpCardInfo(xxpCardInfo));
|
|
|
}
|
|
|
|
|
|
@@ -109,8 +105,7 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@ApiOperation(value = "新增电子信息牌-无权限")
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.INSERT)
|
|
|
@PostMapping("/addInfo")
|
|
|
- public ResultData addInfo(@RequestBody XxpCardInfo xxpCardInfo)
|
|
|
- {
|
|
|
+ public ResultData addInfo(@RequestBody XxpCardInfo xxpCardInfo) {
|
|
|
return ResultData.result(xxpCardInfoService.insertXxpCardInfo(xxpCardInfo));
|
|
|
}
|
|
|
|
|
|
@@ -121,9 +116,8 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_CARDINFO + PerFun.EDIT)
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public ResultData edit(@RequestBody XxpCardInfo xxpCardInfo)
|
|
|
- {
|
|
|
- return ResultData.result(xxpCardInfoService.updateXxpCardInfo(xxpCardInfo));
|
|
|
+ public ResultData edit(@RequestBody XxpCardInfo xxpCardInfo) {
|
|
|
+ return ResultData.result(xxpCardInfoService.updateXxpCardInfo(xxpCardInfo));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -132,9 +126,8 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@ApiOperation(value = "修改电子信息牌-无权限")
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/edit")
|
|
|
- public ResultData editCard(@RequestBody XxpCardInfo xxpCardInfo)
|
|
|
- {
|
|
|
- return ResultData.result(xxpCardInfoService.updateXxpCardInfo(xxpCardInfo));
|
|
|
+ public ResultData editCard(@RequestBody XxpCardInfo xxpCardInfo) {
|
|
|
+ return ResultData.result(xxpCardInfoService.updateXxpCardInfo(xxpCardInfo));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -144,13 +137,13 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_CARDINFO + PerFun.REMOVE)
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
- public ResultData remove(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
+ public ResultData remove(@PathVariable Long[] ids) {
|
|
|
return ResultData.result(xxpCardInfoService.deleteXxpCardInfoByIds(ids));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据id删除
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -158,38 +151,60 @@ public class LabXxpCardInfoController extends BaseController
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_CARDINFO + PerFun.REMOVE)
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.DELETE)
|
|
|
@PostMapping("/{id}")
|
|
|
- public ResultData remove(@PathVariable Long id)
|
|
|
- {
|
|
|
+ public ResultData remove(@PathVariable Long id) {
|
|
|
return ResultData.result(xxpCardInfoService.deleteXxpCardInfoById(id));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据id删除-无权限
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
@ApiOperation(value = "根据id删除-无权限")
|
|
|
@Log(title = "电子信息牌", businessType = BusinessType.DELETE)
|
|
|
@PostMapping("/del/{id}")
|
|
|
- public ResultData del(@PathVariable Long id)
|
|
|
- {
|
|
|
+ public ResultData del(@PathVariable Long id) {
|
|
|
return ResultData.result(xxpCardInfoService.deleteXxpCardInfoById(id));
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据卡号获取电子信息牌信息
|
|
|
+ *
|
|
|
* @param cardNum
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/XxpCardInfoByCard/{num}")
|
|
|
- public ResultData XxpCardInfoByCard(@PathVariable("num") String cardNum)
|
|
|
- {
|
|
|
+ public ResultData XxpCardInfoByCard(@PathVariable("num") String cardNum) {
|
|
|
List<Map<String, Object>> list = xxpCardInfoService.selectXxpCardInfoByCard(cardNum);
|
|
|
- if(list.size()>0){
|
|
|
+ if (list.size() > 0) {
|
|
|
return ResultData.success(list.get(0));
|
|
|
}
|
|
|
return ResultData.success();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 验证密码是否正确
|
|
|
+ *
|
|
|
+ * @param cardNum 电子班牌号码
|
|
|
+ * @param pwd 用户密码
|
|
|
+ * @param subjectId 实验室id
|
|
|
+ * @param userId 用户id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/pwdValidate")
|
|
|
+ public ResultData pwdValidate(String cardNum, String pwd,Long subjectId, Long userId) {
|
|
|
+ List<Map<String,Object>> mapList=iLabSecurityApplyService.selectCountLabSecurityUserId(subjectId,userId);
|
|
|
+ if(mapList.size()==0){
|
|
|
+ return ResultData.fail("未获得实验室准入资格;");
|
|
|
+ }
|
|
|
+ int count = xxpCardInfoService.selectPwdCountByPwd(cardNum, pwd);
|
|
|
+ if (count == 0) {
|
|
|
+ return ResultData.fail("密码输入错误,请重新输入;");
|
|
|
+ }
|
|
|
+ return ResultData.success(mapList.get(0));
|
|
|
+ }
|
|
|
+
|
|
|
}
|