Преглед изворни кода

业主表中加入 小区字段,方便后期处理

wuxw пре 6 година
родитељ
комит
812d9ff257

+ 2 - 0
Api/src/main/java/com/java110/api/listener/owner/DeleteOwnerListener.java

@@ -96,6 +96,8 @@ public class DeleteOwnerListener extends AbstractServiceApiDataFlowListener {
         business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
         JSONObject businessOwner = new JSONObject();
         businessOwner.put("memberId", paramInJson.getString("memberId"));
+        businessOwner.put("communityId", paramInJson.getString("communityId"));
+
         business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOwner", businessOwner);
 
         return business;

+ 23 - 3
HardwareAdapationService/src/main/java/com/java110/hardwareAdapation/thread/TranslateOwnerToMachine.java

@@ -1,6 +1,9 @@
 package com.java110.hardwareAdapation.thread;
 
 import com.java110.core.smo.order.IOrderInnerServiceSMO;
+import com.java110.core.smo.owner.IOwnerInnerServiceSMO;
+import com.java110.core.smo.user.IUserInnerServiceSMO;
+import com.java110.dto.OwnerDto;
 import com.java110.dto.order.OrderDto;
 import com.java110.utils.cache.MappingCache;
 import com.java110.utils.factory.ApplicationContextFactory;
@@ -10,6 +13,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.annotation.Order;
 
+import java.util.List;
+
 /**
  * 从订单中同步业主信息至设备中间表
  * add by wuxw 2019-11-14
@@ -20,9 +25,12 @@ public class TranslateOwnerToMachine implements Runnable {
     public static boolean TRANSLATE_STATE = false;
 
     private IOrderInnerServiceSMO orderInnerServiceSMOImpl;
+    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
 
     public TranslateOwnerToMachine() {
         orderInnerServiceSMOImpl = ApplicationContextFactory.getBean("orderInnerServiceSMOImpl", IOrderInnerServiceSMO.class);
+        ownerInnerServiceSMOImpl = ApplicationContextFactory.getBean("ownerInnerServiceSMOImpl", IOwnerInnerServiceSMO.class);
+
     }
 
     @Override
@@ -44,13 +52,25 @@ public class TranslateOwnerToMachine implements Runnable {
      * 执行任务
      */
     private void executeTask() {
+        OwnerDto ownerDto = null;
         //查询订单信息
         OrderDto orderDto = new OrderDto();
-        orderInnerServiceSMOImpl.queryOwenrOrders(orderDto);
-
+        List<OrderDto> orderDtos = orderInnerServiceSMOImpl.queryOwenrOrders(orderDto);
+        for (OrderDto tmpOrderDto : orderDtos) {
+            try {
+                //根据bId 查询业主信息
+                ownerDto = new OwnerDto();
+                ownerDto.setbId(tmpOrderDto.getbId());
+                List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
+                dealData(tmpOrderDto, ownerDtos);
+            } catch (Exception e) {
+                logger.error("执行订单任务失败", e);
+            }
+        }
     }
 
-    private void getTask() {
+    private void dealData(OrderDto tmpOrderDto, List<OwnerDto> ownerDtos) {
 
     }
+
 }

+ 2 - 1
OrderService/src/main/java/com/java110/order/smo/impl/OrderInnerServiceSMOImpl.java

@@ -6,6 +6,7 @@ import com.java110.core.smo.order.IOrderInnerServiceSMO;
 import com.java110.core.smo.user.IUserInnerServiceSMO;
 import com.java110.dto.order.OrderDto;
 import com.java110.order.dao.ICenterServiceDAO;
+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;
@@ -56,7 +57,7 @@ public class OrderInnerServiceSMOImpl extends BaseServiceSMO implements IOrderIn
 
     @Override
     public List<OrderDto> queryOwenrOrders(@RequestBody OrderDto orderDto) {
-        return null;
+        return BeanConvertUtil.covertBeanList(centerServiceDAOImpl.queryOwenrOrders(BeanConvertUtil.beanCovertMap(orderDto)), OrderDto.class);
     }
 
 

+ 3 - 1
UserService/src/main/java/com/java110/user/listener/owner/AbstractOwnerBusinessServiceDataFlowListener.java

@@ -32,7 +32,7 @@ public abstract class AbstractOwnerBusinessServiceDataFlowListener extends Abstr
     /**
      * 刷新 businessOwnerInfo 数据
      * 主要将 数据库 中字段和 接口传递字段建立关系
-     *
+     *,t.community_id,t.community_id communityId
      * @param businessOwnerInfo
      */
     protected void flushBusinessOwnerInfo(Map businessOwnerInfo, String statusCd) {
@@ -47,6 +47,7 @@ public abstract class AbstractOwnerBusinessServiceDataFlowListener extends Abstr
         businessOwnerInfo.put("age", businessOwnerInfo.get("age"));
         businessOwnerInfo.put("memberId", businessOwnerInfo.get("member_id"));
         businessOwnerInfo.put("ownerTypeCd", businessOwnerInfo.get("owner_type_cd"));
+        businessOwnerInfo.put("communityId", businessOwnerInfo.get("community_id"));
         businessOwnerInfo.remove("bId");
         businessOwnerInfo.put("statusCd", statusCd);
     }
@@ -81,6 +82,7 @@ public abstract class AbstractOwnerBusinessServiceDataFlowListener extends Abstr
         currentOwnerInfo.put("age", currentOwnerInfo.get("age"));
         currentOwnerInfo.put("memberId", currentOwnerInfo.get("member_id"));
         currentOwnerInfo.put("ownerTypeCd", currentOwnerInfo.get("owner_type_cd"));
+        currentOwnerInfo.put("communityId", currentOwnerInfo.get("community_id"));
 
 
         currentOwnerInfo.put("operate", StatusConstant.OPERATE_DEL);

+ 40 - 15
java110-bean/src/main/java/com/java110/dto/OwnerDto.java

@@ -31,6 +31,8 @@ public class OwnerDto extends PageDto implements Serializable {
     private String psId;
     private String num;
 
+    private String bId;
+
     private String userName;
 
 
@@ -42,49 +44,64 @@ public class OwnerDto extends PageDto implements Serializable {
     public String getSex() {
         return sex;
     }
-public void setSex(String sex) {
+
+    public void setSex(String sex) {
         this.sex = sex;
     }
-public String getName() {
+
+    public String getName() {
         return name;
     }
-public void setName(String name) {
+
+    public void setName(String name) {
         this.name = name;
     }
-public String getLink() {
+
+    public String getLink() {
         return link;
     }
-public void setLink(String link) {
+
+    public void setLink(String link) {
         this.link = link;
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
     }
-public String getOwnerId() {
+
+    public String getOwnerId() {
         return ownerId;
     }
-public void setOwnerId(String ownerId) {
+
+    public void setOwnerId(String ownerId) {
         this.ownerId = ownerId;
     }
-public String getUserId() {
+
+    public String getUserId() {
         return userId;
     }
-public void setUserId(String userId) {
+
+    public void setUserId(String userId) {
         this.userId = userId;
     }
-public String getAge() {
+
+    public String getAge() {
         return age;
     }
-public void setAge(String age) {
+
+    public void setAge(String age) {
         this.age = age;
     }
-public String getMemberId() {
+
+    public String getMemberId() {
         return memberId;
     }
-public void setMemberId(String memberId) {
+
+    public void setMemberId(String memberId) {
         this.memberId = memberId;
     }
 
@@ -169,4 +186,12 @@ public void setMemberId(String memberId) {
     public void setNum(String num) {
         this.num = num;
     }
+
+    public String getbId() {
+        return bId;
+    }
+
+    public void setbId(String bId) {
+        this.bId = bId;
+    }
 }

+ 30 - 0
java110-bean/src/main/java/com/java110/dto/order/OrderDto.java

@@ -5,4 +5,34 @@ import com.java110.dto.PageDto;
 import java.io.Serializable;
 
 public class OrderDto extends PageDto implements Serializable {
+    private String oId;
+
+    private String bId;
+
+    private String businessTypeCd;
+
+
+    public String getoId() {
+        return oId;
+    }
+
+    public void setoId(String oId) {
+        this.oId = oId;
+    }
+
+    public String getbId() {
+        return bId;
+    }
+
+    public void setbId(String bId) {
+        this.bId = bId;
+    }
+
+    public String getBusinessTypeCd() {
+        return businessTypeCd;
+    }
+
+    public void setBusinessTypeCd(String businessTypeCd) {
+        this.businessTypeCd = businessTypeCd;
+    }
 }

+ 1 - 3
java110-db/src/main/resources/mapper/center/CenterServiceDAOImplMapper.xml

@@ -171,10 +171,8 @@
 
     <!---->
     <select id="queryOwenrOrders" parameterType="map">
-        select cb.b_id bId,co.o_id,cb.business_type_cd businessTypeCd oId  from c_orders co,c_business cb where co.o_id = cb.o_id
+        select cb.b_id bId,co.o_id oId,cb.business_type_cd businessTypeCd  from c_orders co,c_business cb where co.o_id = cb.o_id
         and cb.business_type_cd in ('110100030001','110100040001','110100050001')
-        and co.status_cd = ''
-
     </select>
 
 </mapper>

+ 33 - 8
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml

@@ -7,9 +7,9 @@
     <!-- 保存业主信息 add by wuxw 2018-07-03 -->
     <insert id="saveBusinessOwnerInfo" parameterType="Map">
         insert into business_building_owner(
-        operate,sex,name,link,remark,owner_id,b_id,user_id,age,member_id,owner_type_cd
+        operate,sex,name,link,remark,owner_id,b_id,user_id,age,member_id,owner_type_cd,community_id
         ) values (
-        #{operate},#{sex},#{name},#{link},#{remark},#{ownerId},#{bId},#{userId},#{age},#{memberId},#{ownerTypeCd}
+        #{operate},#{sex},#{name},#{link},#{remark},#{ownerId},#{bId},#{userId},#{age},#{memberId},#{ownerTypeCd},#{communityId}
         )
     </insert>
 
@@ -17,7 +17,7 @@
     <!-- 查询业主信息(Business) add by wuxw 2018-07-03 -->
     <select id="getBusinessOwnerInfo" parameterType="Map" resultType="Map">
         select t.operate,t.sex,t.name,t.link,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,
-        t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd
+        t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd,t.community_id,t.community_id communityId
         from business_building_owner t
         where 1 =1
         <if test="operate !=null and operate != ''">
@@ -38,6 +38,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
@@ -60,8 +63,8 @@
     <!-- 保存业主信息至 instance表中 add by wuxw 2018-07-03 -->
     <insert id="saveOwnerInfoInstance" parameterType="Map">
         insert into building_owner(
-        sex,name,link,status_cd,remark,owner_id,b_id,user_id,age,member_id,owner_type_cd
-        ) select t.sex,t.name,t.link,'0',t.remark,t.owner_id,t.b_id,t.user_id,t.age,t.member_id,t.owner_type_cd
+        sex,name,link,status_cd,remark,owner_id,b_id,user_id,age,member_id,owner_type_cd,community_id
+        ) select t.sex,t.name,t.link,'0',t.remark,t.owner_id,t.b_id,t.user_id,t.age,t.member_id,t.owner_type_cd,t.community_id communityId
         from business_building_owner t where 1=1
         and t.operate= 'ADD'
         <if test="sex !=null">
@@ -79,6 +82,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
@@ -102,7 +108,7 @@
     <select id="getOwnerInfo" parameterType="Map" resultType="Map">
         select t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,
         t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,
-        t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd,t.create_time createTime
+        t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd,t.create_time createTime,t.community_id,t.community_id communityId
         from building_owner t
         where 1 =1
         <if test="sex !=null">
@@ -123,6 +129,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
@@ -182,6 +191,9 @@
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         <if test="memberId !=null and memberId != ''">
             and t.member_id= #{memberId}
         </if>
@@ -211,6 +223,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
@@ -257,6 +272,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
@@ -281,7 +299,7 @@
     <select id="getOwnerInfoByCondition" parameterType="Map" resultType="Map">
         select t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id
         bId,
-        t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd
+        t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd,t.community_id,t.community_id communityId
         FROM building_owner t , s_community_member cm
         WHERE t.`member_id` = cm.`member_id`
         AND cm.`community_id` = #{communityId}
@@ -305,6 +323,9 @@
         <if test="ownerId !=null and ownerId != ''">
             and t.owner_id= #{ownerId}
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         <if test="bId !=null and bId != ''">
             and t.b_id= #{bId}
         </if>
@@ -354,7 +375,7 @@
         SELECT t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id
         bId,
         t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd,
-        r.`room_id` roomId,r.`room_num` roomNum
+        r.`room_id` roomId,r.`room_num` roomNum,t.community_id,t.community_id communityId
         FROM building_room r,building_owner_room_rel orr,building_owner t
         WHERE r.`room_id` = orr.`room_id`
         AND orr.`owner_id` = t.`owner_id`
@@ -367,6 +388,9 @@
                 #{item}
             </foreach>
         </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
         AND r.`status_cd` = '0'
         AND orr.`status_cd` = '0'
         AND t.`status_cd` = '0'
@@ -393,6 +417,7 @@
         <if test="psId !=null and psId != ''">
             AND ps.`ps_id` = #{psId}
         </if>
+
     </select>