Explorar o código

增加字段。

zhengqiang %!s(int64=5) %!d(string=hai) anos
pai
achega
354143e902

+ 122 - 132
common/src/main/java/com/jpsoft/smart/modules/base/entity/PersonInfo.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
+
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,143 +12,132 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 
 /**
-  描述:base_person_info的实体类
+ * 描述:base_person_info的实体类
  */
 @Data
 @ApiModel(value = "base_person_info的实体类")
 public class PersonInfo {
-	/**
-	 *编号
-	 */
-	@ApiModelProperty(value = "编号")
-	private Long id;
-	/**
-	 *企业编号
-	 */
-        @ApiModelProperty(value = "企业编号")
-	private String companyId;
-	/**
-	 *企业名称
-	 */
-	@ApiModelProperty(value = "企业名称")
-	private String companyName;
-	/**
-	 *姓名
-	 */
-        @ApiModelProperty(value = "姓名")
-	private String name;
-	/**
-	 *手机号
-	 */
-	@ApiModelProperty(value = "手机号")
-	private String phone;
-	/**
-	 *身份证号
-	 */
-	@ApiModelProperty(value = "身份证号")
-	private String idCard;
-	/**
-	 *微信openId
-	 */
-	@ApiModelProperty(value = "微信openId")
-	private String openId;
-	/**
-	 *人脸
-	 */
-        @ApiModelProperty(value = "人脸")
-	private Boolean faceEnabled;
-	/**
-	 *刷卡
-	 */
-        @ApiModelProperty(value = "刷卡")
-	private Boolean cardEnabled;
-	/**
-	 *手机
-	 */
-        @ApiModelProperty(value = "手机")
-	private Boolean appEnabled;
-	/**
-	 *密码
-	 */
-        @ApiModelProperty(value = "密码")
-	private Boolean passwordEnabled;
-	/**
-	 *访客
-	 */
-        @ApiModelProperty(value = "访客")
-	private Boolean guestEnabled;
-	/**
-	 *位置1
-	 */
-        @ApiModelProperty(value = "位置1")
-	private String position1;
-	/**
-	 *位置2
-	 */
-        @ApiModelProperty(value = "位置2")
-	private String position2;
-	/**
-	 *位置3
-	 */
-        @ApiModelProperty(value = "位置3")
-	private String position3;
-	/**
-	 *位置4
-	 */
-        @ApiModelProperty(value = "位置4")
-	private String position4;
-	/**
-	 *位置5
-	 */
-        @ApiModelProperty(value = "位置5")
-	private String position5;
-	/**
-	 *是否删除
-	 */
-        @ApiModelProperty(value = "是否删除")
-	private Boolean delFlag;
-	/**
-	 *创建人
-	 */
-        @ApiModelProperty(value = "创建人")
-	private String createBy;
-	/**
-	 *创建时间
-	 */
-    	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "创建时间")
-	private Date createTime;
-	/**
-	 *更新人
-	 */
-        @ApiModelProperty(value = "更新人")
-	private String updateBy;
-	/**
-	 *更新时间
-	 */
-    	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "更新时间")
-	private Date updateTime;
-	/**
-	 *设置企业名称
-	 */
-	public String getCompanyName() {
-		return companyName;
-	}
+    /**
+     * 编号
+     */
+    @ApiModelProperty(value = "编号")
+    private Long id;
+    /**
+     * 企业编号
+     */
+    @ApiModelProperty(value = "企业编号")
+    private String companyId;
+    /**
+     * 企业名称
+     */
+    @ApiModelProperty(value = "企业名称")
+    private String companyName;
+    /**
+     * 姓名
+     */
+    @ApiModelProperty(value = "姓名")
+    private String name;
+    /**
+     * 手机号
+     */
+    @ApiModelProperty(value = "手机号")
+    private String phone;
+    /**
+     * 身份证号
+     */
+    @ApiModelProperty(value = "身份证号")
+    private String idCard;
+    /**
+     * 微信openId
+     */
+    @ApiModelProperty(value = "微信openId")
+    private String openId;
+    /**
+     * 人脸
+     */
+    @ApiModelProperty(value = "人脸")
+    private Boolean faceEnabled;
+
+    @ApiModelProperty(value = "是否已将人脸信息传给终端")
+    private Boolean faceBound;
+
+    /**
+     * 刷卡
+     */
+    @ApiModelProperty(value = "刷卡")
+    private Boolean cardEnabled;
+    /**
+     * 手机
+     */
+    @ApiModelProperty(value = "手机")
+    private Boolean appEnabled;
+    /**
+     * 密码
+     */
+    @ApiModelProperty(value = "密码")
+    private Boolean passwordEnabled;
+    /**
+     * 访客
+     */
+    @ApiModelProperty(value = "访客")
+    private Boolean guestEnabled;
+    /**
+     * 位置1
+     */
+    @ApiModelProperty(value = "位置1")
+    private String position1;
+    /**
+     * 位置2
+     */
+    @ApiModelProperty(value = "位置2")
+    private String position2;
+    /**
+     * 位置3
+     */
+    @ApiModelProperty(value = "位置3")
+    private String position3;
+    /**
+     * 位置4
+     */
+    @ApiModelProperty(value = "位置4")
+    private String position4;
+    /**
+     * 位置5
+     */
+    @ApiModelProperty(value = "位置5")
+    private String position5;
+    /**
+     * 是否删除
+     */
+    @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
 
-	public void setCompanyName(String companyName) {
-		this.companyName = companyName;
-	}
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    /**
+     * 更新时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
 
-	@ApiModelProperty(value = "人脸相片地址")
-	private String faceImageUrl;
-	public String getFaceImageUrl() {
-		return faceImageUrl;
-	}
+    @ApiModelProperty(value = "人脸相片地址")
+    private String faceImageUrl;
 
-	public void setFaceImageUrl(String faceImageUrl) {
-		this.faceImageUrl = faceImageUrl;
-	}
 }

+ 6 - 1
common/src/main/resources/mapper/base/PersonInfo.xml

@@ -12,6 +12,7 @@
         <result property="idCard" column="id_card"/>
         <result property="openId" column="open_id"/>
         <result property="faceEnabled" column="face_enabled"/>
+        <result property="faceBound" column="face_bound"/>
         <result property="cardEnabled" column="card_enabled"/>
         <result property="appEnabled" column="app_enabled"/>
         <result property="passwordEnabled" column="password_enabled"/>
@@ -36,7 +37,7 @@
         -->
         <![CDATA[
 		insert into base_person_info
-	    (company_id,name_,phone_,id_card,open_id,face_enabled,card_enabled,
+	    (company_id,name_,phone_,id_card,open_id,face_enabled,face_bound,card_enabled,
 	    app_enabled,password_enabled,guest_enabled,position1_,position2_,
 	    position3_,position4_,position5_,face_image_url,del_flag,create_by,create_time,update_by,update_time)
 		values
@@ -47,6 +48,7 @@
             ,#{idCard,jdbcType=VARCHAR}
             ,#{openId,jdbcType= VARCHAR }
             ,#{faceEnabled,jdbcType= NUMERIC }
+            ,#{faceBound,jdbcType= NUMERIC }
             ,#{cardEnabled,jdbcType= NUMERIC }
             ,#{appEnabled,jdbcType= NUMERIC }
             ,#{passwordEnabled,jdbcType= NUMERIC }
@@ -89,6 +91,9 @@
             <if test="faceEnabled!=null">
                 face_enabled=#{faceEnabled,jdbcType= NUMERIC },
             </if>
+            <if test="faceBound!=null">
+                face_bound=#{faceBound,jdbcType= NUMERIC },
+            </if>
             <if test="cardEnabled!=null">
                 card_enabled=#{cardEnabled,jdbcType= NUMERIC },
             </if>

+ 38 - 9
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/PersonInfoApiController.java

@@ -7,6 +7,8 @@ import com.jpsoft.smart.modules.base.service.PersonInfoService;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
 import com.jpsoft.smart.modules.common.utils.OSSUtil;
 import com.jpsoft.smart.modules.common.utils.SMSUtil;
+import com.jpsoft.smart.modules.lapi.service.ILapiService;
+import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
@@ -23,10 +25,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 @RestController
@@ -40,6 +39,9 @@ public class PersonInfoApiController {
     @Autowired
     private PersonInfoService personInfoService;
 
+    @Autowired
+    private ILapiService lapiService;
+
     @Autowired
     private ValueOperations<String, Object> valueOperations;
 
@@ -56,7 +58,7 @@ public class PersonInfoApiController {
             PersonInfo personInfo = personInfoService.findByNameAndPhone(name, phone);
 
             if (personInfo==null){
-                throw new Exception("当前用户信息未登记,请先联系单位管理员!");
+                throw new Exception("您的信息暂未登记,请先联系管理人员!");
             }
 
             if (personInfo.getFaceEnabled()==null || !personInfo.getFaceEnabled()){
@@ -238,18 +240,45 @@ public class PersonInfoApiController {
                 throw new Exception("人员信息不存在!");
             }
 
+            //todo 同步终端
+            List<LapiMsgResult> msgResultList = lapiService.addPerson(personId);
+
+            StringBuilder sb = new StringBuilder();
+
+            boolean success = true;
+
+            for(int i=0;i<msgResultList.size();i++) {
+                LapiMsgResult lapiMsgResult = msgResultList.get(i);
+
+                if (lapiMsgResult.isSuccess()){
+                    sb.append(lapiMsgResult.getAliasName() + "绑定人脸信息成功!");
+                }
+                else{
+                    sb.append(lapiMsgResult.getAliasName() + "绑定人脸信息失败!" + lapiMsgResult.getMsg());
+                }
+
+                if (i!=msgResultList.size()-1){
+                    sb.append(",");
+                }
+                else{
+                    sb.append("。");
+                }
+
+                success &= lapiMsgResult.isSuccess();
+            }
+
             personInfo.setOpenId(openId);
             personInfo.setFaceImageUrl(faceImageUrl);
+            personInfo.setFaceBound(success);
 
             personInfo.setUpdateTime(new Date());
 
             personInfoService.update(personInfo);
 
-            //todo 同步终端
-
-
             messageResult.setData(personInfo);
-            messageResult.setResult(true);
+            messageResult.setResult(success);
+            messageResult.setMessage(sb.toString());
+
             messageResult.setCode(200);
         } catch (Exception e) {
             logger.error(e.getMessage(),e);