wuxw лет назад: 3
Родитель
Сommit
bd0a76ccce

+ 55 - 31
java110-bean/src/main/java/com/java110/dto/storeShopCommunity/StoreShopCommunityDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.storeShopCommunity;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -14,17 +15,19 @@ import java.util.Date;
  **/
 public class StoreShopCommunityDto extends PageDto implements Serializable {
 
+    public static final String STATE_SUCCESS = "24002";
+
     private String address;
-private String cityCode;
-private String codeName;
-private String communityName;
-private String startTime;
-private String shopId;
-private String endTime;
-private String state;
-private String communityId;
-private String message;
-private String scId;
+    private String cityCode;
+    private String codeName;
+    private String communityName;
+    private String startTime;
+    private String shopId;
+    private String endTime;
+    private String state;
+    private String communityId;
+    private String message;
+    private String scId;
 
 
     private Date createTime;
@@ -35,67 +38,88 @@ private String scId;
     public String getAddress() {
         return address;
     }
-public void setAddress(String address) {
+
+    public void setAddress(String address) {
         this.address = address;
     }
-public String getCityCode() {
+
+    public String getCityCode() {
         return cityCode;
     }
-public void setCityCode(String cityCode) {
+
+    public void setCityCode(String cityCode) {
         this.cityCode = cityCode;
     }
-public String getCodeName() {
+
+    public String getCodeName() {
         return codeName;
     }
-public void setCodeName(String codeName) {
+
+    public void setCodeName(String codeName) {
         this.codeName = codeName;
     }
-public String getCommunityName() {
+
+    public String getCommunityName() {
         return communityName;
     }
-public void setCommunityName(String communityName) {
+
+    public void setCommunityName(String communityName) {
         this.communityName = communityName;
     }
-public String getStartTime() {
+
+    public String getStartTime() {
         return startTime;
     }
-public void setStartTime(String startTime) {
+
+    public void setStartTime(String startTime) {
         this.startTime = startTime;
     }
-public String getShopId() {
+
+    public String getShopId() {
         return shopId;
     }
-public void setShopId(String shopId) {
+
+    public void setShopId(String shopId) {
         this.shopId = shopId;
     }
-public String getEndTime() {
+
+    public String getEndTime() {
         return endTime;
     }
-public void setEndTime(String endTime) {
+
+    public void setEndTime(String endTime) {
         this.endTime = endTime;
     }
-public String getState() {
+
+    public String getState() {
         return state;
     }
-public void setState(String state) {
+
+    public void setState(String state) {
         this.state = state;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
-public String getMessage() {
+
+    public String getMessage() {
         return message;
     }
-public void setMessage(String message) {
+
+    public void setMessage(String message) {
         this.message = message;
     }
-public String getScId() {
+
+    public String getScId() {
         return scId;
     }
-public void setScId(String scId) {
+
+    public void setScId(String scId) {
         this.scId = scId;
     }
 

+ 129 - 131
java110-db/src/main/resources/mapper/store/StoreShopCommunityV1ServiceDaoImplMapper.xml

@@ -5,156 +5,154 @@
 <mapper namespace="storeShopCommunityV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存小区店铺信息 add by wuxw 2018-07-03 -->
     <insert id="saveStoreShopCommunityInfo" parameterType="Map">
         insert into s_shop_community(
-address,city_code,code_name,community_name,start_time,shop_id,end_time,state,community_id,message,sc_id
-) values (
-#{address},#{cityCode},#{codeName},#{communityName},#{startTime},#{shopId},#{endTime},#{state},#{communityId},#{message},#{scId}
-)
+        address,city_code,code_name,community_name,start_time,shop_id,end_time,state,community_id,message,sc_id
+        ) values (
+        #{address},#{cityCode},#{codeName},#{communityName},#{startTime},#{shopId},#{endTime},#{state},#{communityId},#{message},#{scId}
+        )
     </insert>
 
 
-
     <!-- 查询小区店铺信息 add by wuxw 2018-07-03 -->
     <select id="getStoreShopCommunityInfo" parameterType="Map" resultType="Map">
-        select  t.address,t.city_code,t.city_code cityCode,t.code_name,t.code_name codeName,t.community_name,t.community_name communityName,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.shop_id,t.shop_id shopId,t.end_time,t.end_time endTime,t.state,t.community_id,t.community_id communityId,t.message,t.sc_id,t.sc_id scId 
-from s_shop_community t 
-where 1 =1 
-<if test="address !=null and address != ''">
-   and t.address= #{address}
-</if> 
-<if test="cityCode !=null and cityCode != ''">
-   and t.city_code= #{cityCode}
-</if> 
-<if test="codeName !=null and codeName != ''">
-   and t.code_name= #{codeName}
-</if> 
-<if test="communityName !=null and communityName != ''">
-   and t.community_name= #{communityName}
-</if> 
-<if test="startTime !=null and startTime != ''">
-   and t.start_time= #{startTime}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="shopId !=null and shopId != ''">
-   and t.shop_id= #{shopId}
-</if> 
-<if test="endTime !=null and endTime != ''">
-   and t.end_time= #{endTime}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="message !=null and message != ''">
-   and t.message= #{message}
-</if> 
-<if test="scId !=null and scId != ''">
-   and t.sc_id= #{scId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.address,t.city_code,t.city_code cityCode,t.code_name,t.code_name
+        codeName,t.community_name,t.community_name communityName,t.start_time,t.start_time
+        startTime,t.status_cd,t.status_cd statusCd,t.shop_id,t.shop_id shopId,t.end_time,t.end_time
+        endTime,t.state,t.community_id,t.community_id communityId,t.message,t.sc_id,t.sc_id scId
+        from s_shop_community t
+        where 1 =1
+        <if test="address !=null and address != ''">
+            and t.address= #{address}
+        </if>
+        <if test="cityCode !=null and cityCode != ''">
+            and t.city_code= #{cityCode}
+        </if>
+        <if test="codeName !=null and codeName != ''">
+            and t.code_name= #{codeName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.start_time= #{startTime}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            and t.shop_id= #{shopId}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.end_time= #{endTime}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="message !=null and message != ''">
+            and t.message= #{message}
+        </if>
+        <if test="scId !=null and scId != ''">
+            and t.sc_id= #{scId}
+        </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="updateStoreShopCommunityInfo" parameterType="Map">
-        update  s_shop_community t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="address !=null and address != ''">
-, t.address= #{address}
-</if> 
-<if test="cityCode !=null and cityCode != ''">
-, t.city_code= #{cityCode}
-</if> 
-<if test="codeName !=null and codeName != ''">
-, t.code_name= #{codeName}
-</if> 
-<if test="communityName !=null and communityName != ''">
-, t.community_name= #{communityName}
-</if> 
-<if test="startTime !=null and startTime != ''">
-, t.start_time= #{startTime}
-</if> 
-<if test="shopId !=null and shopId != ''">
-, t.shop_id= #{shopId}
-</if> 
-<if test="endTime !=null and endTime != ''">
-, t.end_time= #{endTime}
-</if> 
-<if test="state !=null and state != ''">
-, t.state= #{state}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="message !=null and message != ''">
-, t.message= #{message}
-</if> 
- where 1=1 <if test="scId !=null and scId != ''">
-and t.sc_id= #{scId}
-</if> 
+        update s_shop_community t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="address !=null and address != ''">
+            , t.address= #{address}
+        </if>
+        <if test="cityCode !=null and cityCode != ''">
+            , t.city_code= #{cityCode}
+        </if>
+        <if test="codeName !=null and codeName != ''">
+            , t.code_name= #{codeName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            , t.community_name= #{communityName}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            , t.start_time= #{startTime}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            , t.shop_id= #{shopId}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            , t.end_time= #{endTime}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="message !=null and message != ''">
+            , t.message= #{message}
+        </if>
+        where 1=1
+        <if test="scId !=null and scId != ''">
+            and t.sc_id= #{scId}
+        </if>
 
     </update>
 
     <!-- 查询小区店铺数量 add by wuxw 2018-07-03 -->
-     <select id="queryStoreShopCommunitysCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from s_shop_community t 
-where 1 =1 
-<if test="address !=null and address != ''">
-   and t.address= #{address}
-</if> 
-<if test="cityCode !=null and cityCode != ''">
-   and t.city_code= #{cityCode}
-</if> 
-<if test="codeName !=null and codeName != ''">
-   and t.code_name= #{codeName}
-</if> 
-<if test="communityName !=null and communityName != ''">
-   and t.community_name= #{communityName}
-</if> 
-<if test="startTime !=null and startTime != ''">
-   and t.start_time= #{startTime}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="shopId !=null and shopId != ''">
-   and t.shop_id= #{shopId}
-</if> 
-<if test="endTime !=null and endTime != ''">
-   and t.end_time= #{endTime}
-</if> 
-<if test="state !=null and state != ''">
-   and t.state= #{state}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="message !=null and message != ''">
-   and t.message= #{message}
-</if> 
-<if test="scId !=null and scId != ''">
-   and t.sc_id= #{scId}
-</if> 
+    <select id="queryStoreShopCommunitysCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from s_shop_community t
+        where 1 =1
+        <if test="address !=null and address != ''">
+            and t.address= #{address}
+        </if>
+        <if test="cityCode !=null and cityCode != ''">
+            and t.city_code= #{cityCode}
+        </if>
+        <if test="codeName !=null and codeName != ''">
+            and t.code_name= #{codeName}
+        </if>
+        <if test="communityName !=null and communityName != ''">
+            and t.community_name= #{communityName}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.start_time= #{startTime}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="shopId !=null and shopId != ''">
+            and t.shop_id= #{shopId}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.end_time= #{endTime}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="message !=null and message != ''">
+            and t.message= #{message}
+        </if>
+        <if test="scId !=null and scId != ''">
+            and t.sc_id= #{scId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 44 - 1
service-store/src/main/java/com/java110/store/cmd/store/PropertySaveStoreAndShopCmd.java

@@ -9,10 +9,13 @@ import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.AuthenticationFactory;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.dto.account.AccountDto;
+import com.java110.dto.community.CommunityDto;
 import com.java110.dto.shop.ShopDto;
 import com.java110.dto.store.StoreDto;
+import com.java110.dto.storeShopCommunity.StoreShopCommunityDto;
 import com.java110.intf.acct.IAccountBondObjInnerServiceSMO;
 import com.java110.intf.acct.IAccountInnerServiceSMO;
+import com.java110.intf.community.ICommunityV1InnerServiceSMO;
 import com.java110.intf.store.*;
 import com.java110.intf.user.IOrgV1InnerServiceSMO;
 import com.java110.intf.user.IPrivilegeUserV1InnerServiceSMO;
@@ -25,6 +28,7 @@ import com.java110.po.shop.ShopPo;
 import com.java110.po.store.StorePo;
 import com.java110.po.store.StoreUserPo;
 import com.java110.po.storeShop.StoreShopPo;
+import com.java110.po.storeShopCommunity.StoreShopCommunityPo;
 import com.java110.po.user.UserPo;
 import com.java110.utils.cache.CommonCache;
 import com.java110.utils.cache.MappingCache;
@@ -34,6 +38,7 @@ import com.java110.utils.constant.UserLevelConstant;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -78,11 +83,16 @@ public class PropertySaveStoreAndShopCmd extends Cmd {
     @Autowired
     private IAccountBondObjInnerServiceSMO accountBondObjInnerServiceSMOImpl;
 
+    @Autowired
+    private IStoreShopCommunityV1InnerServiceSMO storeShopCommunityV1InnerServiceSMOImpl;
+
+    @Autowired
+    private ICommunityV1InnerServiceSMO communityV1InnerServiceSMOImpl;
+
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
         Assert.hasKeyAndValue(reqJson, "shopName", "未包含商铺名称");
-        Assert.hasKeyAndValue(reqJson, "areaCode", "未包含地区");
         Assert.hasKeyAndValue(reqJson, "link", "未包含手机号");
         Assert.hasKeyAndValue(reqJson, "password", "未包含密码");
         Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");
@@ -92,6 +102,15 @@ public class PropertySaveStoreAndShopCmd extends Cmd {
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
+
+        CommunityDto communityDto = new CommunityDto();
+        communityDto.setCommunityId(reqJson.getString("communityId"));
+        List<CommunityDto> communityDtos = communityV1InnerServiceSMOImpl.queryCommunitys(communityDto);
+
+        Assert.listOnlyOne(communityDtos,"小区不存在");
+        reqJson.put("communityName",communityDtos.get(0).getName());
+        reqJson.put("areaCode",communityDtos.get(0).getAreaCode());
+
         StoreDto storeDto = new StoreDto();
         storeDto.setTel(reqJson.getString("link"));
         List<StoreDto> storeDtos = storeV1InnerServiceSMOImpl.queryStores(storeDto);
@@ -224,10 +243,34 @@ public class PropertySaveStoreAndShopCmd extends Cmd {
         //保存商铺
         saveShop(storePo, reqJson);
 
+        // 关联 小区和商铺
+        saveShopCommunity(reqJson);
+
         //开户
         addAccountDto(storePo, reqJson);
     }
 
+    private void saveShopCommunity(JSONObject reqJson) {
+
+        StoreShopCommunityPo storeShopCommunityPo = new StoreShopCommunityPo();
+        storeShopCommunityPo.setAddress("无");
+        storeShopCommunityPo.setCityCode(reqJson.getString("areaCode"));
+        storeShopCommunityPo.setCodeName("无");
+        storeShopCommunityPo.setCommunityId(reqJson.getString("communityId"));
+        storeShopCommunityPo.setCommunityName(reqJson.getString("communityName"));
+        storeShopCommunityPo.setEndTime("2050-01-01");
+        storeShopCommunityPo.setMessage("物业添加");
+        storeShopCommunityPo.setScId(GenerateCodeFactory.getGeneratorId("10"));
+        storeShopCommunityPo.setShopId(reqJson.getString("shopId"));
+        storeShopCommunityPo.setStartTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+        storeShopCommunityPo.setState(StoreShopCommunityDto.STATE_SUCCESS);
+        int flag = storeShopCommunityV1InnerServiceSMOImpl.saveStoreShopCommunity(storeShopCommunityPo);
+
+        if(flag < 1){
+            throw new IllegalArgumentException("小区关联商铺失败");
+        }
+    }
+
 
     /**
      * 开户

+ 9 - 6
service-store/src/main/resources/dataSource-dynamic.yml

@@ -44,15 +44,18 @@ dataSources:
 
 shardingRule:
   tables:
-    business_xxx:
-      actualDataNodes: ds${0..1}.business_community
+    s_shop:
+      actualDataNodes: ds0.s_shop
       databaseStrategy:
-        inline:
-          shardingColumn: community_id
-          algorithmExpression: ds${Long.parseLong(community_id) % 2}
+        none:
+    s_shop_community:
+      actualDataNodes: ds0.s_shop_community
+      databaseStrategy:
+        none:
 
   bindingTables:
-    - business_xxx
+    - s_shop
+    - s_shop_community
 
   defaultDataSourceName: ds1
   defaultDatabaseStrategy:

+ 9 - 6
service-store/src/main/resources/dataSource-zihao.yml

@@ -44,15 +44,18 @@ dataSources:
 
 shardingRule:
   tables:
-    business_xxx:
-      actualDataNodes: ds${0..1}.business_community
+    s_shop:
+      actualDataNodes: ds0.s_shop
       databaseStrategy:
-        inline:
-          shardingColumn: community_id
-          algorithmExpression: ds${Long.parseLong(community_id) % 2}
+        none:
+    s_shop_community:
+      actualDataNodes: ds0.s_shop_community
+      databaseStrategy:
+        none:
 
   bindingTables:
-    - business_xxx
+    - s_shop
+    - s_shop_community
 
   defaultDataSourceName: ds1
   defaultDatabaseStrategy:

+ 9 - 6
service-store/src/main/resources/dataSource.yml

@@ -44,15 +44,18 @@ dataSources:
 
 shardingRule:
   tables:
-    business_xxx:
-      actualDataNodes: ds${0..1}.business_community
+    s_shop:
+      actualDataNodes: ds0.s_shop
       databaseStrategy:
-        inline:
-          shardingColumn: community_id
-          algorithmExpression: ds${Long.parseLong(community_id) % 2}
+        none:
+    s_shop_community:
+      actualDataNodes: ds0.s_shop_community
+      databaseStrategy:
+        none:
 
   bindingTables:
-    - business_xxx
+    - s_shop
+    - s_shop_community
 
   defaultDataSourceName: ds1
   defaultDatabaseStrategy: