Browse Source

Merge remote-tracking branch 'origin/master' into xinghong-dev

xiaogang 5 years ago
parent
commit
06da958c8f
41 changed files with 1467 additions and 91 deletions
  1. 1 1
      java110-bean/src/main/java/com/java110/dto/app/AppDto.java
  2. 124 0
      java110-bean/src/main/java/com/java110/dto/staffAppAuth/StaffAppAuthDto.java
  3. 81 0
      java110-bean/src/main/java/com/java110/po/staffAppAuth/StaffAppAuthPo.java
  4. 3 0
      java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
  5. 9 0
      java110-db/src/main/resources/mapper/common/MachineAttrServiceDaoImplMapper.xml
  6. 119 0
      java110-db/src/main/resources/mapper/user/StaffAppAuthServiceDaoImplMapper.xml
  7. 18 15
      java110-generator/src/main/resources/newBack/template_1.json
  8. 15 49
      java110-generator/src/main/resources/web/template_1.json
  9. 12 0
      java110-interface/src/main/java/com/java110/intf/common/IMachineAttrInnerServiceSMO.java
  10. 1 1
      java110-interface/src/main/java/com/java110/intf/job/IBusinessDatabusInnerServiceSMO.java
  11. 53 0
      java110-interface/src/main/java/com/java110/intf/user/IStaffAppAuthInnerServiceSMO.java
  12. 1 0
      java110-utils/src/main/java/com/java110/utils/constant/WechatConstant.java
  13. 1 1
      service-common/src/main/java/com/java110/common/api/MachineApi.java
  14. 1 0
      service-common/src/main/java/com/java110/common/dao/IMachineAttrServiceDao.java
  15. 6 0
      service-common/src/main/java/com/java110/common/dao/impl/MachineAttrServiceDaoImpl.java
  16. 6 0
      service-common/src/main/java/com/java110/common/smo/impl/MachineAttrInnerServiceSMOImpl.java
  17. 3 1
      service-front/src/main/java/com/java110/front/configuration/ServiceConfiguration.java
  18. 86 0
      service-front/src/main/java/com/java110/front/controller/wechat/StaffWechatAuthController.java
  19. 38 0
      service-front/src/main/java/com/java110/front/smo/staff/IStaffAuthSMO.java
  20. 217 0
      service-front/src/main/java/com/java110/front/smo/staff/impl/StaffAuthSMOImpl.java
  21. 8 10
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoDeleteMachineTransactionIotAdapt.java
  22. 3 3
      service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoModifyMachineTransactionIotAdapt.java
  23. 29 0
      service-job/src/main/java/com/java110/job/adapt/ximoIot/asyn/impl/XimoMachineAsynImpl.java
  24. 1 1
      service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/DeleteBusinessDatabusBMOImpl.java
  25. 1 1
      service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/GetBusinessDatabusBMOImpl.java
  26. 1 1
      service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/SaveBusinessDatabusBMOImpl.java
  27. 1 1
      service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/UpdateBusinessDatabusBMOImpl.java
  28. 1 1
      service-job/src/main/java/com/java110/job/smo/impl/BusinessDatabusInnerServiceSMOImpl.java
  29. 2 5
      service-job/src/main/java/com/java110/job/smo/impl/DataBusInnerServiceSMOImpl.java
  30. 133 0
      service-user/src/main/java/com/java110/user/api/StaffApi.java
  31. 17 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/IDeleteStaffAppAuthBMO.java
  32. 19 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/IGetStaffAppAuthBMO.java
  33. 19 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/ISaveStaffAppAuthBMO.java
  34. 19 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/IUpdateStaffAppAuthBMO.java
  35. 34 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/DeleteStaffAppAuthBMOImpl.java
  36. 56 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/GetStaffAppAuthBMOImpl.java
  37. 38 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/SaveStaffAppAuthBMOImpl.java
  38. 48 0
      service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/UpdateStaffAppAuthBMOImpl.java
  39. 61 0
      service-user/src/main/java/com/java110/user/dao/IStaffAppAuthServiceDao.java
  40. 98 0
      service-user/src/main/java/com/java110/user/dao/impl/StaffAppAuthServiceDaoImpl.java
  41. 83 0
      service-user/src/main/java/com/java110/user/smo/impl/StaffAppAuthInnerServiceSMOImpl.java

+ 1 - 1
java110-bean/src/main/java/com/java110/dto/app/AppDto.java

@@ -17,7 +17,7 @@ public class AppDto extends PageDto implements Serializable {
 
     //web端APP_ID
     public static final String WEB_APP_ID = "8000418004";
-    public static final String WECHAT_OWNER_APP_ID = "992020061452450002";
+    public static final String WECHAT_OWNER_APP_ID = "992020061452450002"; //业主公众号
     public static final String WECHAT_MINA_OWNER_APP_ID = "992019111758490006";
     public static final String OWNER_WECHAT_PAY = "992020011134400001"; // 微信支付
     public static final String OWNER_APP_PAY = "992020061440050003"; // app微信支付

+ 124 - 0
java110-bean/src/main/java/com/java110/dto/staffAppAuth/StaffAppAuthDto.java

@@ -0,0 +1,124 @@
+package com.java110.dto.staffAppAuth;
+
+import com.java110.dto.PageDto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 员工微信认证数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class StaffAppAuthDto extends PageDto implements Serializable {
+
+    private String auId;
+    private String appType;
+    private String openId;
+    private String state;
+    private String stateName;
+    private String storeId;
+    private String openName;
+    private String staffId;
+    private String staffName;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getAuId() {
+        return auId;
+    }
+
+    public void setAuId(String auId) {
+        this.auId = auId;
+    }
+
+    public String getAppType() {
+        return appType;
+    }
+
+    public void setAppType(String appType) {
+        this.appType = appType;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getOpenName() {
+        return openName;
+    }
+
+
+
+    public String getStaffId() {
+        return staffId;
+    }
+
+    public void setStaffId(String staffId) {
+        this.staffId = staffId;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+
+    public void setOpenName(String openName) {
+        this.openName = openName;
+    }
+
+    public String getStaffName() {
+        return staffName;
+    }
+
+    public void setStaffName(String staffName) {
+        this.staffName = staffName;
+    }
+
+    public String getStateName() {
+        return stateName;
+    }
+
+    public void setStateName(String stateName) {
+        this.stateName = stateName;
+    }
+}

+ 81 - 0
java110-bean/src/main/java/com/java110/po/staffAppAuth/StaffAppAuthPo.java

@@ -0,0 +1,81 @@
+package com.java110.po.staffAppAuth;
+
+import java.io.Serializable;
+
+public class StaffAppAuthPo implements Serializable {
+
+    private String auId;
+    private String appType;
+    private String openId;
+    private String statusCd = "0";
+    private String state;
+    private String storeId;
+    private String openName;
+    private String staffId;
+
+    public String getAuId() {
+        return auId;
+    }
+
+    public void setAuId(String auId) {
+        this.auId = auId;
+    }
+
+    public String getAppType() {
+        return appType;
+    }
+
+    public void setAppType(String appType) {
+        this.appType = appType;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(String storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getOpenName() {
+        return openName;
+    }
+
+    public void setOpenName(String openName) {
+        this.openName = openName;
+    }
+
+    public String getStaffId() {
+        return staffId;
+    }
+
+    public void setStaffId(String staffId) {
+        this.staffId = staffId;
+    }
+
+
+}

+ 3 - 0
java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java

@@ -175,6 +175,7 @@ public class GenerateCodeFactory {
     public static final String CODE_PREFIX_errId = "10";
     public static final String CODE_PREFIX_IfdId = "11";
     public static final String CODE_PREFIX_databusId = "12";
+    public static final String CODE_PREFIX_auId = "13";
 
 
     /**
@@ -892,4 +893,6 @@ public class GenerateCodeFactory {
         }
         return result;
     }
+
+
 }

+ 9 - 0
java110-db/src/main/resources/mapper/common/MachineAttrServiceDaoImplMapper.xml

@@ -14,6 +14,15 @@
     </insert>
 
 
+    <insert id="saveMachineAttrs" parameterType="Map">
+        insert into machine_attrs(
+        machine_id,attr_id,spec_cd,community_id,b_id,value
+        ) values (
+        #{machineId},#{attrId},#{specCd},#{communityId},'-1',#{value}
+        )
+    </insert>
+
+
     <!-- 查询设备属性信息(Business) add by wuxw 2018-07-03 -->
     <select id="getBusinessMachineAttrInfo" parameterType="Map" resultType="Map">
         select t.machine_id,t.machine_id machineId,t.attr_id,t.attr_id attrId,t.operate,t.spec_cd,t.spec_cd

+ 119 - 0
java110-db/src/main/resources/mapper/user/StaffAppAuthServiceDaoImplMapper.xml

@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="staffAppAuthServiceDaoImpl">
+
+
+    <!-- 保存员工微信认证信息 add by wuxw 2018-07-03 -->
+    <insert id="saveStaffAppAuthInfo" parameterType="Map">
+        insert into staff_app_auth(
+        au_id,app_type,open_id,state,store_id,open_name,staff_id
+        ) values (
+        #{auId},#{appType},#{openId},#{state},#{storeId},#{openName},#{staffId}
+        )
+    </insert>
+
+
+    <!-- 查询员工微信认证信息 add by wuxw 2018-07-03 -->
+    <select id="getStaffAppAuthInfo" parameterType="Map" resultType="Map">
+        select t.au_id,t.au_id auId,t.app_type,t.app_type appType,t.open_id,t.open_id openId,t.status_cd,t.status_cd
+        statusCd,t.state,t.store_id,t.store_id storeId,t.open_name,t.open_name openName,t.staff_id,t.staff_id staffId,
+        t.create_time createTime
+        from staff_app_auth t
+        where 1 =1
+        <if test="auId !=null and auId != ''">
+            and t.au_id= #{auId}
+        </if>
+        <if test="appType !=null and appType != ''">
+            and t.app_type= #{appType}
+        </if>
+        <if test="openId !=null and openId != ''">
+            and t.open_id= #{openId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="openName !=null and openName != ''">
+            and t.open_name= #{openName}
+        </if>
+        <if test="staffId !=null and staffId != ''">
+            and t.staff_id= #{staffId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+
+    </select>
+
+
+    <!-- 修改员工微信认证信息 add by wuxw 2018-07-03 -->
+    <update id="updateStaffAppAuthInfo" parameterType="Map">
+        update staff_app_auth t set t.status_cd = #{statusCd}
+
+        <if test="openId !=null and openId != ''">
+            , t.open_id= #{openId}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="openName !=null and openName != ''">
+            , t.open_name= #{openName}
+        </if>
+        where 1=1
+        <if test="auId !=null and auId != ''">
+            and t.au_id= #{auId}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="staffId !=null and staffId != ''">
+            and t.staff_id= #{staffId}
+        </if>
+        <if test="appType !=null and appType != ''">
+            and t.app_type= #{appType}
+        </if>
+
+    </update>
+
+    <!-- 查询员工微信认证数量 add by wuxw 2018-07-03 -->
+    <select id="queryStaffAppAuthsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from staff_app_auth t
+        where 1 =1
+        <if test="auId !=null and auId != ''">
+            and t.au_id= #{auId}
+        </if>
+        <if test="appType !=null and appType != ''">
+            and t.app_type= #{appType}
+        </if>
+        <if test="openId !=null and openId != ''">
+            and t.open_id= #{openId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
+        <if test="openName !=null and openName != ''">
+            and t.open_name= #{openName}
+        </if>
+        <if test="staffId !=null and staffId != ''">
+            and t.staff_id= #{staffId}
+        </if>
+
+
+    </select>
+
+</mapper>

+ 18 - 15
java110-generator/src/main/resources/newBack/template_1.json

@@ -1,27 +1,30 @@
 {
   "autoMove": true,
-  "id": "databusId",
-  "name": "businessDatabus",
-  "desc": "业务数据同步",
-  "shareParam": "databusId",
-  "shareColumn": "databus_id",
-  "shareName": "job",
-  "tableName": "c_business_databus",
+  "id": "auId",
+  "name": "staffAppAuth",
+  "desc": "员工微信认证",
+  "shareParam": "storeId",
+  "shareColumn": "store_id",
+  "shareName": "user",
+  "tableName": "staff_app_auth",
   "param": {
-    "databusId": "databus_id",
-    "businessTypeCd": "business_type_cd",
-    "beanName": "bean_name",
-    "seq": "seq",
+    "auId": "au_id",
+    "staffId": "staff_id",
+    "storeId": "store_id",
+    "appType": "app_type",
+    "openId": "open_id",
+    "state": "state",
+    "openName": "open_name",
     "statusCd": "status_cd"
   },
   "required": [
     {
-      "code": "businessTypeCd",
-      "msg": "业务类型不能为空"
+      "code": "staffId",
+      "msg": "员工不能为空"
     },
     {
-      "code": "beanName",
-      "msg": "适配器不能为空"
+      "code": "appType",
+      "msg": "应用类型不能为空"
     }
   ]
 }

+ 15 - 49
java110-generator/src/main/resources/web/template_1.json

@@ -1,66 +1,32 @@
 {
-  "templateName": "databus",
-  "directories": "dev",
-  "templateCode": "businessDatabus",
-  "templateKey": "databusId",
-  "templateKeyName": "Databus ID",
-  "searchCode": "databusId",
-  "searchName": "Databus ID",
+  "templateName": "staffAppAuth",
+  "directories": "property",
+  "templateCode": "staffAppAuth",
+  "templateKey": "auId",
+  "templateKeyName": "认证ID",
+  "searchCode": "auId",
+  "searchName": "认证ID",
   "conditions": [
     {
       "name": "业务类型",
       "inputType": "input",
       "code": "businessTypeCd",
       "whereCondition": "equal"
-    },
-    {
-      "name": "适配器",
-      "inputType": "input",
-      "code": "beanName",
-      "whereCondition": "equal"
-    },
-    {
-      "name": "ID",
-      "inputType": "input",
-      "code": "databusId",
-      "whereCondition": "equal"
     }
   ],
   "columns": [
     {
-      "code": "businessTypeCd",
-      "cnCode": "业务类型",
-      "desc": "必填,请输入业务类型",
-      "required": true,
-      "hasDefaultValue": false,
-      "inputType": "input",
-      "limit": "num",
-      "limitParam": "",
-      "limitErrInfo": "业务类型格式错误",
-      "show": true
-    },
-    {
-      "code": "beanName",
-      "cnCode": "适配器",
-      "desc": "必填,请输入适配器",
+      "code": "appType",
+      "cnCode": "认证方式",
+      "desc": "必填,请选择认证方式",
       "required": true,
       "hasDefaultValue": false,
-      "inputType": "input",
+      "inputType": "select",
+      "selectValue": "WECHAT",
+      "selectValueName": "微信",
       "limit": "maxLength",
-      "limitParam": "256",
-      "limitErrInfo": "适配器名称太长",
-      "show": true
-    },
-    {
-      "code": "seq",
-      "cnCode": "顺序",
-      "desc": "必填,请输入顺序",
-      "required": true,
-      "hasDefaultValue": false,
-      "inputType": "input",
-      "limit": "num",
-      "limitParam": "",
-      "limitErrInfo": "顺序格式错误",
+      "limitParam": "12",
+      "limitErrInfo": "认证方式错误",
       "show": true
     }
   ]

+ 12 - 0
java110-interface/src/main/java/com/java110/intf/common/IMachineAttrInnerServiceSMO.java

@@ -2,6 +2,7 @@ package com.java110.intf.common;
 
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.machine.MachineAttrDto;
+import com.java110.po.machine.MachineAttrPo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -38,4 +39,15 @@ public interface IMachineAttrInnerServiceSMO {
      */
     @RequestMapping(value = "/queryMachineAttrsCount", method = RequestMethod.POST)
     int queryMachineAttrsCount(@RequestBody MachineAttrDto machineAttrDto);
+
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     * @param machineAttrPo 数据对象分享
+     * @return MachineAttrDto 对象数据
+     */
+    @RequestMapping(value = "/saveMachineAttrs", method = RequestMethod.POST)
+    int saveMachineAttrs(@RequestBody MachineAttrPo machineAttrPo);
+
 }

+ 1 - 1
java110-interface/src/main/java/com/java110/intf/job/IBusinessDatabusInnerServiceSMO.java

@@ -1,4 +1,4 @@
-package com.java110.intf;
+package com.java110.intf.job;
 
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.businessDatabus.BusinessDatabusDto;

+ 53 - 0
java110-interface/src/main/java/com/java110/intf/user/IStaffAppAuthInnerServiceSMO.java

@@ -0,0 +1,53 @@
+package com.java110.intf.user;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.staffAppAuth.StaffAppAuthDto;
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * @ClassName IStaffAppAuthInnerServiceSMO
+ * @Description 员工微信认证接口类
+ * @Author wuxw
+ * @Date 2019/4/24 9:04
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@FeignClient(name = "user-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/staffAppAuthApi")
+public interface IStaffAppAuthInnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveStaffAppAuth", method = RequestMethod.POST)
+    public int saveStaffAppAuth(@RequestBody StaffAppAuthPo staffAppAuthPo);
+
+    @RequestMapping(value = "/updateStaffAppAuth", method = RequestMethod.POST)
+    public int updateStaffAppAuth(@RequestBody  StaffAppAuthPo staffAppAuthPo);
+
+    @RequestMapping(value = "/deleteStaffAppAuth", method = RequestMethod.POST)
+    public int deleteStaffAppAuth(@RequestBody  StaffAppAuthPo staffAppAuthPo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param staffAppAuthDto 数据对象分享
+     * @return StaffAppAuthDto 对象数据
+     */
+    @RequestMapping(value = "/queryStaffAppAuths", method = RequestMethod.POST)
+    List<StaffAppAuthDto> queryStaffAppAuths(@RequestBody StaffAppAuthDto staffAppAuthDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param staffAppAuthDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryStaffAppAuthsCount", method = RequestMethod.POST)
+    int queryStaffAppAuthsCount(@RequestBody StaffAppAuthDto staffAppAuthDto);
+}

+ 1 - 0
java110-utils/src/main/java/com/java110/utils/constant/WechatConstant.java

@@ -45,6 +45,7 @@ public class WechatConstant {
     public static final String GET_ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=SECRET";
 
     public static final String APP_GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
+    public static final String APP_GET_USER_INFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
 
     public static final String OPEN_AUTH = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URL&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";
 

+ 1 - 1
service-common/src/main/java/com/java110/common/api/MachineApi.java

@@ -33,7 +33,7 @@ public class MachineApi {
      * @path /app/machine/openDoor
      */
     @RequestMapping(value = "/openDoor", method = RequestMethod.POST)
-    public ResponseEntity<String> saveAttrValue(@RequestBody JSONObject reqJson) {
+    public ResponseEntity<String> openDoor(@RequestBody JSONObject reqJson) {
 
         Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息");
         Assert.hasKeyAndValue(reqJson, "machineCode", "请求报文中未包含设备信息");

+ 1 - 0
service-common/src/main/java/com/java110/common/dao/IMachineAttrServiceDao.java

@@ -73,4 +73,5 @@ public interface IMachineAttrServiceDao {
      */
     int queryMachineAttrsCount(Map info);
 
+    int saveMachineAttrs(Map beanCovertMap);
 }

+ 6 - 0
service-common/src/main/java/com/java110/common/dao/impl/MachineAttrServiceDaoImpl.java

@@ -130,5 +130,11 @@ public class MachineAttrServiceDaoImpl extends BaseServiceDao implements IMachin
         return Integer.parseInt(businessMachineAttrInfos.get(0).get("count").toString());
     }
 
+    @Override
+    public int saveMachineAttrs(Map info) {
+        int saveFlag = sqlSessionTemplate.update("machineAttrServiceDaoImpl.saveMachineAttrs", info);
+        return saveFlag;
+    }
+
 
 }

+ 6 - 0
service-common/src/main/java/com/java110/common/smo/impl/MachineAttrInnerServiceSMOImpl.java

@@ -7,6 +7,7 @@ import com.java110.intf.common.IMachineAttrInnerServiceSMO;
 import com.java110.intf.user.IUserInnerServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.machine.MachineAttrDto;
+import com.java110.po.machine.MachineAttrPo;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -52,6 +53,11 @@ public class MachineAttrInnerServiceSMOImpl extends BaseServiceSMO implements IM
         return machineAttrServiceDaoImpl.queryMachineAttrsCount(BeanConvertUtil.beanCovertMap(machineAttrDto));
     }
 
+    @Override
+    public int saveMachineAttrs(@RequestBody MachineAttrPo machineAttrPo) {
+        return machineAttrServiceDaoImpl.saveMachineAttrs(BeanConvertUtil.beanCovertMap(machineAttrPo));
+    }
+
     public IMachineAttrServiceDao getMachineAttrServiceDaoImpl() {
         return machineAttrServiceDaoImpl;
     }

+ 3 - 1
service-front/src/main/java/com/java110/front/configuration/ServiceConfiguration.java

@@ -45,7 +45,9 @@ public class ServiceConfiguration {
         exclusions.append("/app/refreshToken,");//微信公众号对接接口
         exclusions.append("/app/renting/queryRentingPool,");//微信公众号对接接口
         exclusions.append("/app/activitiesType/queryActivitiesType,");//查询大类
-        exclusions.append("/app/product/queryProductLabel");//查询大类
+        exclusions.append("/app/product/queryProductLabel,");//查询大类
+        exclusions.append("/app/loginStaffWechatAuth,");//查询大类
+        exclusions.append("/app/staffAuth");//查询大类
 
         final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
         registrationBean.setFilter(new JwtFilter());

+ 86 - 0
service-front/src/main/java/com/java110/front/controller/wechat/StaffWechatAuthController.java

@@ -0,0 +1,86 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.front.controller.wechat;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.controller.BaseController;
+import com.java110.core.context.IPageData;
+import com.java110.core.context.PageData;
+import com.java110.front.smo.staff.IStaffAuthSMO;
+import com.java110.utils.constant.CommonConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Map;
+
+/**
+ * 微信小程序登录处理类
+ */
+@RestController
+@RequestMapping(path = "/app")
+public class StaffWechatAuthController extends BaseController {
+    private final static Logger logger = LoggerFactory.getLogger(StaffWechatAuthController.class);
+
+    @Autowired
+    private IStaffAuthSMO staffAuthSMOImpl;
+
+
+    /**
+     * 微信登录接口
+     * /app/loginStaffWechatAuth
+     *
+     * @param request
+     */
+    @RequestMapping(path = "/loginStaffWechatAuth")
+    public ResponseEntity<String> loginStaffWechatAuth(HttpServletRequest request) {
+
+        Map<String, String> params = getParameterStringMap(request);
+        String appId = params.get("appId");
+        IPageData pd = PageData.newInstance().builder("", "", "", JSONObject.toJSONString(params),
+                "login", "", "", "", appId
+        );
+        ResponseEntity responseEntity = staffAuthSMOImpl.getPageAccessToken(pd, request);
+        request.setAttribute(CommonConstant.CONTEXT_PAGE_DATA, pd);
+        return responseEntity;
+    }
+
+    /**
+     * 微信公众号号鉴权
+     * /app/staffAuth
+     *
+     * @param request
+     */
+    @RequestMapping(path = "/staffAuth")
+    public ResponseEntity<String> staffAuth(@RequestParam(value = "communityId") String communityId,
+                                            @RequestParam(value = "staffId") String staffId,
+                                            @RequestParam(value = "storeId") String storeId,
+                                            @RequestParam(value = "appId") String appId,
+                                            HttpServletRequest request,
+                                            HttpServletResponse response) {
+        IPageData pd = PageData.newInstance().builder("", "", "", "",
+                "login", "", "", "", appId);
+        return staffAuthSMOImpl.refreshToken(pd, communityId, staffId, storeId, request, response);
+
+    }
+
+}

+ 38 - 0
service-front/src/main/java/com/java110/front/smo/staff/IStaffAuthSMO.java

@@ -0,0 +1,38 @@
+package com.java110.front.smo.staff;
+
+import com.java110.core.context.IPageData;
+import com.java110.utils.exception.SMOException;
+import org.springframework.http.ResponseEntity;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 组织管理管理服务接口类
+ * <p>
+ * add by wuxw 2019-06-29
+ */
+public interface IStaffAuthSMO {
+
+
+
+    /**
+     * 获取access_token
+     *
+     * @param pd
+     * @return
+     * @throws SMOException
+     */
+    ResponseEntity<String> getPageAccessToken(IPageData pd,HttpServletRequest request) throws SMOException;
+
+
+    /**
+     * 微信刷新token
+     *
+     * @param pd
+     * @return
+     * @throws SMOException
+     */
+    ResponseEntity<String> refreshToken(IPageData pd,String communityId,String staffId,String storeId,
+                                        HttpServletRequest request, HttpServletResponse response) throws SMOException;
+}

+ 217 - 0
service-front/src/main/java/com/java110/front/smo/staff/impl/StaffAuthSMOImpl.java

@@ -0,0 +1,217 @@
+package com.java110.front.smo.staff.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.base.smo.front.AbstractFrontServiceSMO;
+import com.java110.core.context.IPageData;
+import com.java110.core.context.PageData;
+import com.java110.core.factory.WechatFactory;
+import com.java110.dto.owner.OwnerAppUserDto;
+import com.java110.dto.smallWeChat.SmallWeChatDto;
+import com.java110.front.properties.WechatAuthProperties;
+import com.java110.front.smo.staff.IStaffAuthSMO;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.constant.ServiceConstant;
+import com.java110.utils.constant.WechatConstant;
+import com.java110.utils.exception.SMOException;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
+import java.util.List;
+
+/**
+ * wx登录
+ */
+@Service("staffAuthSMOImpl")
+public class StaffAuthSMOImpl extends AbstractFrontServiceSMO implements IStaffAuthSMO {
+
+    private final static Logger logger = LoggerFactory.getLogger(StaffAuthSMOImpl.class);
+
+    private final static int expireTime = 7200;
+
+    private final static int LOGIN_PAGE = 1;
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Autowired
+    private RestTemplate outRestTemplate;
+
+    @Autowired
+    private WechatAuthProperties wechatAuthProperties;
+
+    @Override
+    public ResponseEntity<String> getPageAccessToken(IPageData pd, HttpServletRequest request) throws SMOException {
+        JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
+        String authCode = paramIn.getString("code");
+        String staffId = paramIn.getString("staffId");
+        String storeId = paramIn.getString("storeId");
+        String wId = paramIn.getString("wId");
+        SmallWeChatDto smallWeChatDto = null;
+        if (!StringUtil.isEmpty(wId)) {
+            paramIn.put("appId", WechatFactory.getAppId(wId));
+            smallWeChatDto = getSmallWechat(pd, paramIn);
+        }
+        if (smallWeChatDto == null) { //从配置文件中获取 小程序配置信息
+            smallWeChatDto = new SmallWeChatDto();
+            smallWeChatDto.setAppId(wechatAuthProperties.getWechatAppId());
+            smallWeChatDto.setAppSecret(wechatAuthProperties.getWechatAppSecret());
+            smallWeChatDto.setMchId(wechatAuthProperties.getMchId());
+            smallWeChatDto.setPayPassword(wechatAuthProperties.getKey());
+        }
+
+        String url = WechatConstant.APP_GET_ACCESS_TOKEN_URL.replace("APPID", smallWeChatDto.getAppId())
+                .replace("SECRET", smallWeChatDto.getAppSecret())
+                .replace("CODE", authCode);
+
+        ResponseEntity<String> paramOut = outRestTemplate.getForEntity(url, String.class);
+
+        logger.debug("调用微信换去openId ", paramOut);
+        if (paramOut.getStatusCode() != HttpStatus.OK) {
+            return ResultVo.redirectPage("/");
+
+        }
+
+        JSONObject paramObj = JSONObject.parseObject(paramOut.getBody());
+        //获取 openId
+        String openId = paramObj.getString("openid");
+        url = WechatConstant.APP_GET_USER_INFO_URL
+                .replace("ACCESS_TOKEN", paramObj.getString("access_token"))
+                .replace("OPENID", openId);
+
+        paramOut = outRestTemplate.getForEntity(url, String.class);
+
+        logger.debug("调用微信换去openId ", paramOut);
+        if (paramOut.getStatusCode() != HttpStatus.OK) {
+            return ResultVo.redirectPage("/");
+        }
+        paramObj = JSONObject.parseObject(paramOut.getBody());
+        JSONObject paramAuth = new JSONObject();
+        paramAuth.put("openId", openId);
+        paramAuth.put("staffId", staffId);
+        paramAuth.put("storeId", storeId);
+        paramAuth.put("appType", "WECHAT");
+        paramAuth.put("state", "2002");
+        paramAuth.put("openName", paramObj.getString("nickname"));
+
+        ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, paramAuth.toJSONString(),
+                ServiceConstant.SERVICE_API_URL + "/api/staff/updateStaffAppAuth", HttpMethod.POST);
+        url = MappingCache.getValue("OWNER_WECHAT_URL");
+        return ResultVo.redirectPage(url);
+
+    }
+
+    /**
+     * 刷新token
+     *
+     * @param pd
+     * @param request
+     * @param response
+     * @return
+     * @throws SMOException
+     */
+    @Override
+    public ResponseEntity<String> refreshToken(IPageData pd, String communityId, String staffId, String storeId,
+                                               HttpServletRequest request, HttpServletResponse response) throws SMOException {
+        SmallWeChatDto smallWeChatDto = null;
+        JSONObject paramIn = new JSONObject();
+        paramIn.put("communityId", communityId);
+        smallWeChatDto = getSmallWechat(pd, paramIn);
+        if (smallWeChatDto == null) { //从配置文件中获取 小程序配置信息
+            smallWeChatDto = new SmallWeChatDto();
+            smallWeChatDto.setAppId(wechatAuthProperties.getWechatAppId());
+            smallWeChatDto.setAppSecret(wechatAuthProperties.getWechatAppSecret());
+            smallWeChatDto.setMchId(wechatAuthProperties.getMchId());
+            smallWeChatDto.setPayPassword(wechatAuthProperties.getKey());
+        }
+
+        String openUrl = "";
+        String url = MappingCache.getValue("OWNER_WECHAT_URL");
+        try {
+            openUrl = WechatConstant.OPEN_AUTH
+                    .replace("APPID", smallWeChatDto.getAppId())
+                    //.replace("SCOPE", "snsapi_base")
+                    .replace("SCOPE", "snsapi_userinfo")
+                    .replace(
+                            "REDIRECT_URL",
+                            URLEncoder
+                                    .encode(
+                                            (url
+                                                    + "/app/loginStaffWechatAuth?appId=992020061452450002&staffId="
+                                                    + staffId + "&storeId=" + storeId + "&wId=" + WechatFactory.getWId(smallWeChatDto.getAppId())),
+                                            "UTF-8")).replace("STATE", "1");
+            response.sendRedirect(openUrl);
+        } catch (Exception e) {
+            logger.error("微信公众号鉴权 redirectUrl 错误 " + url, e);
+            throw new SMOException(ResponseConstant.RESULT_CODE_ERROR, e.getLocalizedMessage());
+        }
+
+        JSONObject urlObj = new JSONObject();
+        urlObj.put("openUrl", openUrl);
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_MACHINE_OK, ResultVo.MSG_OK, urlObj);
+    }
+
+    /**
+     * 判断 绑定表里是否存在当前 端 绑定信息
+     *
+     * @param ownerAppUserDtos
+     * @param appType
+     * @return
+     */
+    private OwnerAppUserDto judgeCurrentOwnerBind(List<OwnerAppUserDto> ownerAppUserDtos, String appType) {
+
+        for (OwnerAppUserDto ownerAppUserDto : ownerAppUserDtos) {
+            if (appType.equals(ownerAppUserDto.getAppType())) {
+                return ownerAppUserDto;
+            }
+        }
+        return null;
+    }
+
+    private SmallWeChatDto getSmallWechat(IPageData pd, JSONObject paramIn) {
+
+        ResponseEntity responseEntity = null;
+
+        pd = PageData.newInstance().builder(pd.getUserId(), "", "", pd.getReqData(),
+                "", "", "", "",
+                pd.getAppId());
+        responseEntity = this.callCenterService(restTemplate, pd, "",
+                ServiceConstant.SERVICE_API_URL + "/api/smallWeChat.listSmallWeChats?communityId="
+                        + paramIn.getString("communityId") + "&page=1&row=1", HttpMethod.GET);
+
+        if (responseEntity.getStatusCode() != HttpStatus.OK) {
+            return null;
+        }
+        JSONObject smallWechatObj = JSONObject.parseObject(responseEntity.getBody().toString());
+        JSONArray smallWeChats = smallWechatObj.getJSONArray("smallWeChats");
+
+        if (smallWeChats == null || smallWeChats.size() < 1) {
+            return null;
+        }
+
+        return BeanConvertUtil.covertBean(smallWeChats.get(0), SmallWeChatDto.class);
+    }
+
+    public RestTemplate getRestTemplate() {
+        return restTemplate;
+    }
+
+    public void setRestTemplate(RestTemplate restTemplate) {
+        this.restTemplate = restTemplate;
+    }
+
+}

+ 8 - 10
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoDeleteMachineTransactionIotAdapt.java

@@ -21,10 +21,8 @@ import com.java110.dto.machine.MachineDto;
 import com.java110.entity.order.Business;
 import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.IDatabusAdapt;
 import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
 import com.java110.po.machine.MachinePo;
-import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -39,7 +37,7 @@ import java.util.List;
  * @desc add by 吴学文 18:58
  */
 @Component(value = "ximoDeleteMachineTransactionIotAdapt")
-public class XimoDeleteMachineTransactionIotAdapt  extends DatabusAdaptImpl {
+public class XimoDeleteMachineTransactionIotAdapt extends DatabusAdaptImpl {
 
     @Autowired
     private IXimoMachineAsyn ximoMachineAsynImpl;
@@ -68,7 +66,7 @@ public class XimoDeleteMachineTransactionIotAdapt  extends DatabusAdaptImpl {
             if (bObj instanceof JSONObject) {
                 businessMachines = new JSONArray();
                 businessMachines.add(bObj);
-            }  else if (bObj instanceof List) {
+            } else if (bObj instanceof List) {
                 businessMachines = JSONArray.parseArray(JSONObject.toJSONString(bObj));
             } else {
                 businessMachines = (JSONArray) bObj;
@@ -86,15 +84,15 @@ public class XimoDeleteMachineTransactionIotAdapt  extends DatabusAdaptImpl {
         MachinePo machinePo = BeanConvertUtil.covertBean(businessMachine, MachinePo.class);
         MachineDto machineDto = new MachineDto();
         machineDto.setMachineId(machinePo.getMachineId());
-        List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto);
-
-        Assert.listOnlyOne(machineDtos, "未找到设备");
+//        List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto);
+//
+//        Assert.listOnlyOne(machineDtos, "未找到设备");
 
         MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
 
-        postParameters.add("extCommunityUuid", machineDtos.get(0));
-        //postParameters.add("devSn", machinePo.getMachineCode());
-        postParameters.add("uuids", machinePo.getMachineId());
+        postParameters.add("extCommunityUuid", machinePo.getCommunityId());
+        postParameters.add("devSns", machinePo.getMachineCode());
+        //postParameters.add("uuids", machinePo.getMachineId());
         ximoMachineAsynImpl.deleteSend(postParameters);
     }
 }

+ 3 - 3
service-job/src/main/java/com/java110/job/adapt/ximoIot/XimoModifyMachineTransactionIotAdapt.java

@@ -91,9 +91,9 @@ public class XimoModifyMachineTransactionIotAdapt extends DatabusAdaptImpl {
 
         MultiValueMap<String, Object> postParameters = new LinkedMultiValueMap<>();
 
-        postParameters.add("extCommunityUuid", machineDtos.get(0));
-        //postParameters.add("devSn", machinePo.getMachineCode());
-        postParameters.add("uuid", machinePo.getMachineId());
+        postParameters.add("extCommunityUuid", machineDtos.get(0).getCommunityId());
+        postParameters.add("devSn", machinePo.getMachineCode());
+        //postParameters.add("uuid", machinePo.getMachineId());
         postParameters.add("name", machinePo.getMachineName());
         postParameters.add("positionType", "0");
         postParameters.add("positionUuid", machinePo.getCommunityId());

+ 29 - 0
service-job/src/main/java/com/java110/job/adapt/ximoIot/asyn/impl/XimoMachineAsynImpl.java

@@ -17,9 +17,14 @@ package com.java110.job.adapt.ximoIot.asyn.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.client.RestTemplate;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.machine.MachineDto;
+import com.java110.intf.common.IMachineAttrInnerServiceSMO;
+import com.java110.intf.common.IMachineInnerServiceSMO;
 import com.java110.job.adapt.ximoIot.GetToken;
 import com.java110.job.adapt.ximoIot.XimoIotConstant;
 import com.java110.job.adapt.ximoIot.asyn.IXimoMachineAsyn;
+import com.java110.po.machine.MachineAttrPo;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,6 +47,12 @@ public class XimoMachineAsynImpl implements IXimoMachineAsyn {
     @Autowired
     private RestTemplate formRestTemplate;
 
+    @Autowired
+    private IMachineInnerServiceSMO machineInnerServiceSMOImpl;
+
+    @Autowired
+    private IMachineAttrInnerServiceSMO machineAttrInnerServiceSMOImpl;
+
     @Override
     @Async
     public void send(MultiValueMap<String, Object> postParameters, List<MultiValueMap<String, Object>> ownerDtos) {
@@ -63,6 +74,24 @@ public class XimoMachineAsynImpl implements IXimoMachineAsyn {
             return;
         }
 
+        JSONObject data = tokenObj.getJSONObject("data");
+        String devMac = data.getString("devMac");
+        String appEkey = data.getString("appEkey");
+
+        MachineDto machinePo = new MachineDto();
+        machinePo.setMachineId(data.getString("uuid"));
+        machinePo.setState("1700");
+        machinePo.setMachineMac(devMac);
+        machineInnerServiceSMOImpl.updateMachineState(machinePo);
+
+        MachineAttrPo machineAttrPo = new MachineAttrPo();
+        machineAttrPo.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId));
+        machineAttrPo.setCommunityId(postParameters.get("extCommunityUuid").get(0).toString());
+        machineAttrPo.setSpecCd("7127015495");
+        machineAttrPo.setMachineId(data.getString("uuid"));
+        machineAttrPo.setValue(appEkey);
+        machineAttrInnerServiceSMOImpl.saveMachineAttrs(machineAttrPo);
+
         for (MultiValueMap<String, Object> owner : ownerDtos) {
             sendOwner(owner);
         }

+ 1 - 1
service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/DeleteBusinessDatabusBMOImpl.java

@@ -1,7 +1,7 @@
 package com.java110.job.bmo.businessDatabus.impl;
 
 import com.java110.core.annotation.Java110Transactional;
-import com.java110.intf.IBusinessDatabusInnerServiceSMO;
+import com.java110.intf.job.IBusinessDatabusInnerServiceSMO;
 import com.java110.job.bmo.businessDatabus.IDeleteBusinessDatabusBMO;
 import com.java110.po.businessDatabus.BusinessDatabusPo;
 import com.java110.vo.ResultVo;

+ 1 - 1
service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/GetBusinessDatabusBMOImpl.java

@@ -1,7 +1,7 @@
 package com.java110.job.bmo.businessDatabus.impl;
 
 import com.java110.dto.businessDatabus.BusinessDatabusDto;
-import com.java110.intf.IBusinessDatabusInnerServiceSMO;
+import com.java110.intf.job.IBusinessDatabusInnerServiceSMO;
 import com.java110.job.bmo.businessDatabus.IGetBusinessDatabusBMO;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/SaveBusinessDatabusBMOImpl.java

@@ -2,7 +2,7 @@ package com.java110.job.bmo.businessDatabus.impl;
 
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.intf.IBusinessDatabusInnerServiceSMO;
+import com.java110.intf.job.IBusinessDatabusInnerServiceSMO;
 import com.java110.job.bmo.businessDatabus.ISaveBusinessDatabusBMO;
 import com.java110.po.businessDatabus.BusinessDatabusPo;
 import com.java110.vo.ResultVo;

+ 1 - 1
service-job/src/main/java/com/java110/job/bmo/businessDatabus/impl/UpdateBusinessDatabusBMOImpl.java

@@ -1,7 +1,7 @@
 package com.java110.job.bmo.businessDatabus.impl;
 
 import com.java110.core.annotation.Java110Transactional;
-import com.java110.intf.IBusinessDatabusInnerServiceSMO;
+import com.java110.intf.job.IBusinessDatabusInnerServiceSMO;
 import com.java110.job.bmo.businessDatabus.IUpdateBusinessDatabusBMO;
 import com.java110.po.businessDatabus.BusinessDatabusPo;
 import com.java110.vo.ResultVo;

+ 1 - 1
service-job/src/main/java/com/java110/job/smo/impl/BusinessDatabusInnerServiceSMOImpl.java

@@ -4,7 +4,7 @@ package com.java110.job.smo.impl;
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.businessDatabus.BusinessDatabusDto;
-import com.java110.intf.IBusinessDatabusInnerServiceSMO;
+import com.java110.intf.job.IBusinessDatabusInnerServiceSMO;
 import com.java110.job.dao.IBusinessDatabusServiceDao;
 import com.java110.po.businessDatabus.BusinessDatabusPo;
 import com.java110.utils.util.BeanConvertUtil;

+ 2 - 5
service-job/src/main/java/com/java110/job/smo/impl/DataBusInnerServiceSMOImpl.java

@@ -12,7 +12,6 @@ import com.java110.utils.factory.ApplicationContextFactory;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -33,9 +32,6 @@ public class DataBusInnerServiceSMOImpl extends BaseServiceSMO implements IDataB
     public static final String DEFAULT_OPEN_DOOR_PROTOCOL = "ximoOpenDoorAdapt";//吸墨门禁
 
 
-   // @Autowired
-    private IDatabusAdapt databusAdaptImpl;
-
     @Override
     public boolean exchange(@RequestBody List<Business> businesses) {
         List<BusinessDatabusDto> databusDtos = DatabusCache.getDatabuss();
@@ -47,7 +43,7 @@ public class DataBusInnerServiceSMOImpl extends BaseServiceSMO implements IDataB
 
     @Override
     public ResultVo openDoor(@RequestBody JSONObject reqJson) {
-        databusAdaptImpl = ApplicationContextFactory.getBean(DEFAULT_OPEN_DOOR_PROTOCOL, IDatabusAdapt.class);
+        IDatabusAdapt databusAdaptImpl = ApplicationContextFactory.getBean(DEFAULT_OPEN_DOOR_PROTOCOL, IDatabusAdapt.class);
         return databusAdaptImpl.openDoor(reqJson);
 
     }
@@ -60,6 +56,7 @@ public class DataBusInnerServiceSMOImpl extends BaseServiceSMO implements IDataB
      * @param databusDtos databus
      */
     private void doExchange(Business business, List<Business> businesses, List<BusinessDatabusDto> databusDtos) {
+        IDatabusAdapt databusAdaptImpl = null;
         for (BusinessDatabusDto databusDto : databusDtos) {
             try {
                 if (business.getBusinessTypeCd().equals(databusDto.getBusinessTypeCd())) {

+ 133 - 0
service-user/src/main/java/com/java110/user/api/StaffApi.java

@@ -0,0 +1,133 @@
+package com.java110.user.api;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.dto.app.AppDto;
+import com.java110.dto.staffAppAuth.StaffAppAuthDto;
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import com.java110.user.bmo.staffAppAuth.IDeleteStaffAppAuthBMO;
+import com.java110.user.bmo.staffAppAuth.IGetStaffAppAuthBMO;
+import com.java110.user.bmo.staffAppAuth.ISaveStaffAppAuthBMO;
+import com.java110.user.bmo.staffAppAuth.IUpdateStaffAppAuthBMO;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping(value = "/staff")
+public class StaffApi {
+
+    @Autowired
+    private ISaveStaffAppAuthBMO saveStaffAppAuthBMOImpl;
+    @Autowired
+    private IUpdateStaffAppAuthBMO updateStaffAppAuthBMOImpl;
+    @Autowired
+    private IDeleteStaffAppAuthBMO deleteStaffAppAuthBMOImpl;
+
+    @Autowired
+    private IGetStaffAppAuthBMO getStaffAppAuthBMOImpl;
+
+    /**
+     * 微信保存消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /staff/saveStaffAppAuth
+     * @path /app/staff/saveStaffAppAuth
+     */
+    @RequestMapping(value = "/saveStaffAppAuth", method = RequestMethod.POST)
+    public ResponseEntity<String> saveStaffAppAuth(@RequestBody JSONObject reqJson) {
+
+        Assert.hasKeyAndValue(reqJson, "staffId", "请求报文中未包含staffId");
+        Assert.hasKeyAndValue(reqJson, "appType", "请求报文中未包含appType");
+
+
+        StaffAppAuthPo staffAppAuthPo = BeanConvertUtil.covertBean(reqJson, StaffAppAuthPo.class);
+        return saveStaffAppAuthBMOImpl.save(staffAppAuthPo);
+    }
+
+    /**
+     * 微信修改消息模板
+     *
+     * @param param
+     * @return
+     * @serviceCode /staff/updateStaffAppAuth
+     * @path /app/staff/updateStaffAppAuth
+     * <p>
+     * {"openId":"oxeFbwJzDG8t87dVDcmrlRoPsTfM","appType":"WECHAT","state":"2002","storeId":"402019032924930007","staffId":"30518940136629616640"}
+     */
+    @RequestMapping(value = "/updateStaffAppAuth", method = RequestMethod.POST)
+    public ResponseEntity<String> updateStaffAppAuth(@RequestBody String param) {
+        JSONObject reqJson = JSONObject.parseObject(param);
+        Assert.hasKeyAndValue(reqJson, "staffId", "请求报文中未包含staffId");
+        Assert.hasKeyAndValue(reqJson, "appType", "请求报文中未包含appType");
+        Assert.hasKeyAndValue(reqJson, "openId", "请求报文中未包含openId");
+        Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含state");
+
+        StaffAppAuthPo staffAppAuthPo = BeanConvertUtil.covertBean(reqJson, StaffAppAuthPo.class);
+        return updateStaffAppAuthBMOImpl.update(staffAppAuthPo);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param reqJson
+     * @return
+     * @serviceCode /staff/deleteStaffAppAuth
+     * @path /app/staff/deleteStaffAppAuth
+     */
+    @RequestMapping(value = "/deleteStaffAppAuth", method = RequestMethod.POST)
+    public ResponseEntity<String> deleteStaffAppAuth(@RequestBody JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
+
+        Assert.hasKeyAndValue(reqJson, "auId", "auId不能为空");
+
+
+        StaffAppAuthPo staffAppAuthPo = BeanConvertUtil.covertBean(reqJson, StaffAppAuthPo.class);
+        return deleteStaffAppAuthBMOImpl.delete(staffAppAuthPo);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param storeId 小区ID
+     * @return
+     * @serviceCode /staff/queryStaffAppAuth
+     * @path /app/staff/queryStaffAppAuth
+     */
+    @RequestMapping(value = "/queryStaffAppAuth", method = RequestMethod.GET)
+    public ResponseEntity<String> queryStaffAppAuth(@RequestHeader(value = "store-id") String storeId,
+                                                    @RequestHeader(value = "user-id") String userId,
+                                                    @RequestParam(value = "page") int page,
+                                                    @RequestParam(value = "row") int row) {
+        StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto();
+        staffAppAuthDto.setPage(page);
+        staffAppAuthDto.setRow(row);
+        staffAppAuthDto.setStoreId(storeId);
+        staffAppAuthDto.setStaffId(userId);
+        return getStaffAppAuthBMOImpl.get(staffAppAuthDto);
+    }
+
+    /**
+     * 微信删除消息模板
+     *
+     * @param storeId 小区ID
+     * @return
+     * @serviceCode /staff/generatorQrCode
+     * @path /app/staff/generatorQrCode
+     */
+    @RequestMapping(value = "/generatorQrCode", method = RequestMethod.GET)
+    public ResponseEntity<String> generatorQrCode(@RequestHeader(value = "store-id") String storeId,
+                                                  @RequestHeader(value = "user-id") String userId,
+                                                  @RequestParam(value = "communityId") String communityId) {
+
+        String ownerUrl = MappingCache.getValue("OWNER_WECHAT_URL")
+                + "/app/staffAuth?storeId=" + storeId + "&staffId=" + userId
+                + "&communityId=" + communityId + "&appId=" + AppDto.WECHAT_OWNER_APP_ID;
+        return ResultVo.createResponseEntity(ownerUrl);
+    }
+}

+ 17 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/IDeleteStaffAppAuthBMO.java

@@ -0,0 +1,17 @@
+package com.java110.user.bmo.staffAppAuth;
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import org.springframework.http.ResponseEntity;
+
+public interface IDeleteStaffAppAuthBMO {
+
+
+    /**
+     * 修改员工微信认证
+     * add by wuxw
+     * @param staffAppAuthPo
+     * @return
+     */
+    ResponseEntity<String> delete(StaffAppAuthPo staffAppAuthPo);
+
+
+}

+ 19 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/IGetStaffAppAuthBMO.java

@@ -0,0 +1,19 @@
+package com.java110.user.bmo.staffAppAuth;
+
+import com.java110.dto.staffAppAuth.StaffAppAuthDto;
+import org.springframework.http.ResponseEntity;
+
+public interface IGetStaffAppAuthBMO {
+
+
+    /**
+     * 查询员工微信认证
+     * add by wuxw
+     *
+     * @param staffAppAuthDto
+     * @return
+     */
+    ResponseEntity<String> get(StaffAppAuthDto staffAppAuthDto);
+
+
+}

+ 19 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/ISaveStaffAppAuthBMO.java

@@ -0,0 +1,19 @@
+package com.java110.user.bmo.staffAppAuth;
+
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import org.springframework.http.ResponseEntity;
+
+public interface ISaveStaffAppAuthBMO {
+
+
+    /**
+     * 添加员工微信认证
+     * add by wuxw
+     *
+     * @param staffAppAuthPo
+     * @return
+     */
+    ResponseEntity<String> save(StaffAppAuthPo staffAppAuthPo);
+
+
+}

+ 19 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/IUpdateStaffAppAuthBMO.java

@@ -0,0 +1,19 @@
+package com.java110.user.bmo.staffAppAuth;
+
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import org.springframework.http.ResponseEntity;
+
+public interface IUpdateStaffAppAuthBMO {
+
+
+    /**
+     * 修改员工微信认证
+     * add by wuxw
+     *
+     * @param staffAppAuthPo
+     * @return
+     */
+    ResponseEntity<String> update(StaffAppAuthPo staffAppAuthPo);
+
+
+}

+ 34 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/DeleteStaffAppAuthBMOImpl.java

@@ -0,0 +1,34 @@
+package com.java110.user.bmo.staffAppAuth.impl;
+
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.intf.user.IStaffAppAuthInnerServiceSMO;
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import com.java110.user.bmo.staffAppAuth.IDeleteStaffAppAuthBMO;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("deleteStaffAppAuthBMOImpl")
+public class DeleteStaffAppAuthBMOImpl implements IDeleteStaffAppAuthBMO {
+
+    @Autowired
+    private IStaffAppAuthInnerServiceSMO staffAppAuthInnerServiceSMOImpl;
+
+    /**
+     * @param staffAppAuthPo 数据
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> delete(StaffAppAuthPo staffAppAuthPo) {
+
+        int flag = staffAppAuthInnerServiceSMOImpl.deleteStaffAppAuth(staffAppAuthPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 56 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/GetStaffAppAuthBMOImpl.java

@@ -0,0 +1,56 @@
+package com.java110.user.bmo.staffAppAuth.impl;
+
+import com.java110.dto.staffAppAuth.StaffAppAuthDto;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.user.IStaffAppAuthInnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.user.bmo.staffAppAuth.IGetStaffAppAuthBMO;
+import com.java110.utils.util.Assert;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service("getStaffAppAuthBMOImpl")
+public class GetStaffAppAuthBMOImpl implements IGetStaffAppAuthBMO {
+
+    @Autowired
+    private IStaffAppAuthInnerServiceSMO staffAppAuthInnerServiceSMOImpl;
+
+    @Autowired
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+    /**
+     * @param staffAppAuthDto
+     * @return 订单服务能够接受的报文
+     */
+    public ResponseEntity<String> get(StaffAppAuthDto staffAppAuthDto) {
+        UserDto userDto = new UserDto();
+        userDto.setUserId(staffAppAuthDto.getStaffId());
+        List<UserDto> userDtos = userInnerServiceSMOImpl.getUsers(userDto);
+
+        Assert.listOnlyOne(userDtos, "用户不存在");
+        staffAppAuthDto.setStaffName(userDtos.get(0).getName());
+
+        List<StaffAppAuthDto> staffAppAuthDtos = staffAppAuthInnerServiceSMOImpl.queryStaffAppAuths(staffAppAuthDto);
+
+        if (staffAppAuthDtos == null || staffAppAuthDtos.size() < 1) {
+            staffAppAuthDto.setStateName("未认证");
+            staffAppAuthDto.setState("1001");
+            staffAppAuthDto.setOpenId("-");
+            staffAppAuthDto.setAppType("-");
+            staffAppAuthDto.setOpenName("-");
+        } else {
+            staffAppAuthDto.setStateName("已认证");
+            staffAppAuthDto.setState("2002");
+            staffAppAuthDto.setOpenId(staffAppAuthDtos.get(0).getOpenId());
+            staffAppAuthDto.setAppType(staffAppAuthDtos.get(0).getAppType());
+            staffAppAuthDto.setOpenName(staffAppAuthDtos.get(0).getOpenName());
+            staffAppAuthDto.setCreateTime(staffAppAuthDtos.get(0).getCreateTime());
+        }
+        return ResultVo.createResponseEntity(staffAppAuthDto);
+    }
+
+}

+ 38 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/SaveStaffAppAuthBMOImpl.java

@@ -0,0 +1,38 @@
+package com.java110.user.bmo.staffAppAuth.impl;
+
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.intf.user.IStaffAppAuthInnerServiceSMO;
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import com.java110.user.bmo.staffAppAuth.ISaveStaffAppAuthBMO;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("saveStaffAppAuthBMOImpl")
+public class SaveStaffAppAuthBMOImpl implements ISaveStaffAppAuthBMO {
+
+    @Autowired
+    private IStaffAppAuthInnerServiceSMO staffAppAuthInnerServiceSMOImpl;
+
+    /**
+     * 添加小区信息
+     *
+     * @param staffAppAuthPo
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> save(StaffAppAuthPo staffAppAuthPo) {
+
+        staffAppAuthPo.setAuId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_auId));
+        int flag = staffAppAuthInnerServiceSMOImpl.saveStaffAppAuth(staffAppAuthPo);
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 48 - 0
service-user/src/main/java/com/java110/user/bmo/staffAppAuth/impl/UpdateStaffAppAuthBMOImpl.java

@@ -0,0 +1,48 @@
+package com.java110.user.bmo.staffAppAuth.impl;
+
+import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.staffAppAuth.StaffAppAuthDto;
+import com.java110.intf.user.IStaffAppAuthInnerServiceSMO;
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import com.java110.user.bmo.staffAppAuth.IUpdateStaffAppAuthBMO;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service("updateStaffAppAuthBMOImpl")
+public class UpdateStaffAppAuthBMOImpl implements IUpdateStaffAppAuthBMO {
+
+    @Autowired
+    private IStaffAppAuthInnerServiceSMO staffAppAuthInnerServiceSMOImpl;
+
+    /**
+     * @param staffAppAuthPo
+     * @return 订单服务能够接受的报文
+     */
+    @Java110Transactional
+    public ResponseEntity<String> update(StaffAppAuthPo staffAppAuthPo) {
+
+        StaffAppAuthDto staffAppAuthDto = new StaffAppAuthDto();
+        staffAppAuthDto.setAppType(staffAppAuthPo.getAppType());
+        staffAppAuthDto.setStaffId(staffAppAuthPo.getStaffId());
+        staffAppAuthDto.setStoreId(staffAppAuthPo.getStoreId());
+        staffAppAuthDto.setOpenName(staffAppAuthPo.getOpenName());
+        int count = staffAppAuthInnerServiceSMOImpl.queryStaffAppAuthsCount(staffAppAuthDto);
+        int flag = 0;
+        if (count > 0) {
+            flag = staffAppAuthInnerServiceSMOImpl.updateStaffAppAuth(staffAppAuthPo);
+        } else {
+            staffAppAuthPo.setAuId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_auId));
+            flag = staffAppAuthInnerServiceSMOImpl.saveStaffAppAuth(staffAppAuthPo);
+        }
+
+        if (flag > 0) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+    }
+
+}

+ 61 - 0
service-user/src/main/java/com/java110/user/dao/IStaffAppAuthServiceDao.java

@@ -0,0 +1,61 @@
+package com.java110.user.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 员工微信认证组件内部之间使用,没有给外围系统提供服务能力
+ * 员工微信认证服务接口类,要求全部以字符串传输,方便微服务化
+ * 新建客户,修改客户,删除客户,查询客户等功能
+ *
+ * Created by wuxw on 2016/12/27.
+ */
+public interface IStaffAppAuthServiceDao {
+
+
+    /**
+     * 保存 员工微信认证信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    void saveStaffAppAuthInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询员工微信认证信息(instance过程)
+     * 根据bId 查询员工微信认证信息
+     * @param info bId 信息
+     * @return 员工微信认证信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getStaffAppAuthInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改员工微信认证信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    void updateStaffAppAuthInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询员工微信认证总数
+     *
+     * @param info 员工微信认证信息
+     * @return 员工微信认证数量
+     */
+    int queryStaffAppAuthsCount(Map info);
+
+}

+ 98 - 0
service-user/src/main/java/com/java110/user/dao/impl/StaffAppAuthServiceDaoImpl.java

@@ -0,0 +1,98 @@
+package com.java110.user.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.user.dao.IStaffAppAuthServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 员工微信认证服务 与数据库交互
+ * Created by wuxw on 2017/4/5.
+ */
+@Service("staffAppAuthServiceDaoImpl")
+//@Transactional
+public class StaffAppAuthServiceDaoImpl extends BaseServiceDao implements IStaffAppAuthServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(StaffAppAuthServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存员工微信认证信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void saveStaffAppAuthInfo(Map info) throws DAOException {
+        logger.debug("保存员工微信认证信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("staffAppAuthServiceDaoImpl.saveStaffAppAuthInfo",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存员工微信认证信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+
+    /**
+     * 查询员工微信认证信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getStaffAppAuthInfo(Map info) throws DAOException {
+        logger.debug("查询员工微信认证信息 入参 info : {}",info);
+
+        List<Map> businessStaffAppAuthInfos = sqlSessionTemplate.selectList("staffAppAuthServiceDaoImpl.getStaffAppAuthInfo",info);
+
+        return businessStaffAppAuthInfos;
+    }
+
+
+    /**
+     * 修改员工微信认证信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public void updateStaffAppAuthInfo(Map info) throws DAOException {
+        logger.debug("修改员工微信认证信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("staffAppAuthServiceDaoImpl.updateStaffAppAuthInfo",info);
+
+        if(saveFlag < 1){
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改员工微信认证信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        }
+    }
+
+     /**
+     * 查询员工微信认证数量
+     * @param info 员工微信认证信息
+     * @return 员工微信认证数量
+     */
+    @Override
+    public int queryStaffAppAuthsCount(Map info) {
+        logger.debug("查询员工微信认证数据 入参 info : {}",info);
+
+        List<Map> businessStaffAppAuthInfos = sqlSessionTemplate.selectList("staffAppAuthServiceDaoImpl.queryStaffAppAuthsCount", info);
+        if (businessStaffAppAuthInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessStaffAppAuthInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 83 - 0
service-user/src/main/java/com/java110/user/smo/impl/StaffAppAuthInnerServiceSMOImpl.java

@@ -0,0 +1,83 @@
+package com.java110.user.smo.impl;
+
+
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.PageDto;
+import com.java110.dto.staffAppAuth.StaffAppAuthDto;
+import com.java110.intf.user.IStaffAppAuthInnerServiceSMO;
+import com.java110.po.staffAppAuth.StaffAppAuthPo;
+import com.java110.user.dao.IStaffAppAuthServiceDao;
+import com.java110.utils.util.BeanConvertUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @ClassName FloorInnerServiceSMOImpl
+ * @Description 员工微信认证内部服务实现类
+ * @Author wuxw
+ * @Date 2019/4/24 9:20
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+@RestController
+public class StaffAppAuthInnerServiceSMOImpl extends BaseServiceSMO implements IStaffAppAuthInnerServiceSMO {
+
+    @Autowired
+    private IStaffAppAuthServiceDao staffAppAuthServiceDaoImpl;
+
+
+    @Override
+    public int saveStaffAppAuth(@RequestBody StaffAppAuthPo staffAppAuthPo) {
+        int saveFlag = 1;
+        staffAppAuthServiceDaoImpl.saveStaffAppAuthInfo(BeanConvertUtil.beanCovertMap(staffAppAuthPo));
+        return saveFlag;
+    }
+
+    @Override
+    public int updateStaffAppAuth(@RequestBody StaffAppAuthPo staffAppAuthPo) {
+        int saveFlag = 1;
+        staffAppAuthServiceDaoImpl.updateStaffAppAuthInfo(BeanConvertUtil.beanCovertMap(staffAppAuthPo));
+        return saveFlag;
+    }
+
+    @Override
+    public int deleteStaffAppAuth(@RequestBody StaffAppAuthPo staffAppAuthPo) {
+        int saveFlag = 1;
+        staffAppAuthPo.setStatusCd("1");
+        staffAppAuthServiceDaoImpl.updateStaffAppAuthInfo(BeanConvertUtil.beanCovertMap(staffAppAuthPo));
+        return saveFlag;
+    }
+
+    @Override
+    public List<StaffAppAuthDto> queryStaffAppAuths(@RequestBody StaffAppAuthDto staffAppAuthDto) {
+
+        //校验是否传了 分页信息
+
+        int page = staffAppAuthDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            staffAppAuthDto.setPage((page - 1) * staffAppAuthDto.getRow());
+        }
+
+        List<StaffAppAuthDto> staffAppAuths = BeanConvertUtil.covertBeanList(staffAppAuthServiceDaoImpl.getStaffAppAuthInfo(BeanConvertUtil.beanCovertMap(staffAppAuthDto)), StaffAppAuthDto.class);
+
+        return staffAppAuths;
+    }
+
+
+    @Override
+    public int queryStaffAppAuthsCount(@RequestBody StaffAppAuthDto staffAppAuthDto) {
+        return staffAppAuthServiceDaoImpl.queryStaffAppAuthsCount(BeanConvertUtil.beanCovertMap(staffAppAuthDto));
+    }
+
+    public IStaffAppAuthServiceDao getStaffAppAuthServiceDaoImpl() {
+        return staffAppAuthServiceDaoImpl;
+    }
+
+    public void setStaffAppAuthServiceDaoImpl(IStaffAppAuthServiceDao staffAppAuthServiceDaoImpl) {
+        this.staffAppAuthServiceDaoImpl = staffAppAuthServiceDaoImpl;
+    }
+}