|
@@ -379,16 +379,19 @@ public class PersonInfoApiController {
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name="name",value = "姓名",required = true,paramType = "form"),
|
|
@ApiImplicitParam(name="name",value = "姓名",required = true,paramType = "form"),
|
|
@ApiImplicitParam(name="phone",value = "电话",required = true,paramType = "form"),
|
|
@ApiImplicitParam(name="phone",value = "电话",required = true,paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name="faceImageUrl",value = "照片地址",required = true,paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name="bindDevices",value = "绑定设备(,分隔)",required = true,paramType = "form"),
|
|
@ApiImplicitParam(name="token",value = "令牌",paramType = "form"),
|
|
@ApiImplicitParam(name="token",value = "令牌",paramType = "form"),
|
|
@ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
@ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
})
|
|
})
|
|
- public MessageResult<PersonInfo> add(String name,String phone,String token,@RequestAttribute String subject){
|
|
|
|
|
|
+ public MessageResult<PersonInfo> add(String name,String phone,String faceImageUrl,String bindDevices,String token,@RequestAttribute String subject){
|
|
MessageResult<PersonInfo> messageResult = new MessageResult<>();
|
|
MessageResult<PersonInfo> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
- User user = userService.get(subject);
|
|
|
|
|
|
+ PersonInfo admin = personInfoService.get(Long.valueOf(subject));
|
|
|
|
|
|
- if (user==null){
|
|
|
|
|
|
+ if (StringUtils.isEmpty(admin.getPopedom())
|
|
|
|
+ && admin.getPopedom().indexOf("2")==-1){
|
|
throw new Exception("当前用户不是管理员!");
|
|
throw new Exception("当前用户不是管理员!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -396,12 +399,20 @@ public class PersonInfoApiController {
|
|
personInfo.setName(name);
|
|
personInfo.setName(name);
|
|
personInfo.setPhone(phone);
|
|
personInfo.setPhone(phone);
|
|
personInfo.setFaceEnabled(true);
|
|
personInfo.setFaceEnabled(true);
|
|
- personInfo.setCompanyId(user.getCompanyId());
|
|
|
|
|
|
+ personInfo.setCompanyId(admin.getCompanyId());
|
|
personInfo.setDelFlag(false);
|
|
personInfo.setDelFlag(false);
|
|
- personInfo.setCreateBy(user.getId());
|
|
|
|
|
|
+ personInfo.setCreateBy(String.valueOf(admin.getId()));
|
|
personInfo.setCreateTime(new Date());
|
|
personInfo.setCreateTime(new Date());
|
|
|
|
|
|
- personInfoService.insert(personInfo);
|
|
|
|
|
|
+ int affectCount = personInfoService.insert(personInfo);
|
|
|
|
+
|
|
|
|
+ //todo 关联设备
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(affectCount>0) {
|
|
|
|
+ //todo 加入到导入图片队列中
|
|
|
|
+ rabbitTemplate.convertAndSend("importImageExchange", "importImage", personInfo.getId());
|
|
|
|
+ }
|
|
|
|
|
|
messageResult.setData(personInfo);
|
|
messageResult.setData(personInfo);
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|