Browse Source

优化登陆时 同步用户信息给 商城系统

wuxw 1 year ago
parent
commit
fb51b43ad1

+ 130 - 131
java110-db/src/main/resources/mapper/store/ResourceSupplierV1ServiceDaoImplMapper.xml

@@ -5,156 +5,155 @@
 <mapper namespace="resourceSupplierV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存供应商信息 add by wuxw 2018-07-03 -->
     <insert id="saveResourceSupplierInfo" parameterType="Map">
         insert into resource_supplier(
-supplier_name,account_bank,create_user_id,address,contact_name,rs_id,tel,bank_account_number,create_user_name,remark,store_id
-) values (
-#{supplierName},#{accountBank},#{createUserId},#{address},#{contactName},#{rsId},#{tel},#{bankAccountNumber},#{createUserName},#{remark},#{storeId}
-)
+        supplier_name,account_bank,create_user_id,address,contact_name,rs_id,tel,bank_account_number,create_user_name,remark,store_id
+        ) values (
+        #{supplierName},#{accountBank},#{createUserId},#{address},#{contactName},#{rsId},#{tel},#{bankAccountNumber},#{createUserName},#{remark},#{storeId}
+        )
     </insert>
 
 
-
     <!-- 查询供应商信息 add by wuxw 2018-07-03 -->
     <select id="getResourceSupplierInfo" parameterType="Map" resultType="Map">
-        select  t.supplier_name,t.supplier_name supplierName,t.account_bank,t.account_bank accountBank,t.create_user_id,t.create_user_id createUserId,t.address,t.contact_name,t.contact_name contactName,t.rs_id,t.rs_id rsId,t.tel,t.bank_account_number,t.bank_account_number bankAccountNumber,t.status_cd,t.status_cd statusCd,t.create_user_name,t.create_user_name createUserName,t.remark,t.store_id,t.store_id storeId 
-from resource_supplier t 
-where 1 =1 
-<if test="supplierName !=null and supplierName != ''">
-   and t.supplier_name= #{supplierName}
-</if> 
-<if test="accountBank !=null and accountBank != ''">
-   and t.account_bank= #{accountBank}
-</if> 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</if> 
-<if test="address !=null and address != ''">
-   and t.address= #{address}
-</if> 
-<if test="contactName !=null and contactName != ''">
-   and t.contact_name= #{contactName}
-</if> 
-<if test="rsId !=null and rsId != ''">
-   and t.rs_id= #{rsId}
-</if> 
-<if test="tel !=null and tel != ''">
-   and t.tel= #{tel}
-</if> 
-<if test="bankAccountNumber !=null and bankAccountNumber != ''">
-   and t.bank_account_number= #{bankAccountNumber}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-   and t.create_user_name= #{createUserName}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.supplier_name,t.supplier_name supplierName,t.account_bank,t.account_bank
+        accountBank,t.create_user_id,t.create_user_id createUserId,t.address,t.contact_name,t.contact_name
+        contactName,t.rs_id,t.rs_id rsId,t.tel,t.bank_account_number,t.bank_account_number
+        bankAccountNumber,t.status_cd,t.status_cd statusCd,t.create_user_name,t.create_user_name
+        createUserName,t.remark,t.store_id,t.store_id storeId
+        from resource_supplier t
+        where 1 =1
+        <if test="supplierName !=null and supplierName != ''">
+            and t.supplier_name= #{supplierName}
+        </if>
+        <if test="accountBank !=null and accountBank != ''">
+            and t.account_bank= #{accountBank}
+        </if>
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </if>
+        <if test="address !=null and address != ''">
+            and t.address= #{address}
+        </if>
+        <if test="contactName !=null and contactName != ''">
+            and t.contact_name= #{contactName}
+        </if>
+        <if test="rsId !=null and rsId != ''">
+            and t.rs_id= #{rsId}
+        </if>
+        <if test="tel !=null and tel != ''">
+            and t.tel= #{tel}
+        </if>
+        <if test="bankAccountNumber !=null and bankAccountNumber != ''">
+            and t.bank_account_number= #{bankAccountNumber}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            and t.create_user_name= #{createUserName}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </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="updateResourceSupplierInfo" parameterType="Map">
-        update  resource_supplier t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="supplierName !=null and supplierName != ''">
-, t.supplier_name= #{supplierName}
-</if> 
-<if test="accountBank !=null and accountBank != ''">
-, t.account_bank= #{accountBank}
-</if> 
-<if test="createUserId !=null and createUserId != ''">
-, t.create_user_id= #{createUserId}
-</if> 
-<if test="address !=null and address != ''">
-, t.address= #{address}
-</if> 
-<if test="contactName !=null and contactName != ''">
-, t.contact_name= #{contactName}
-</if> 
-<if test="tel !=null and tel != ''">
-, t.tel= #{tel}
-</if> 
-<if test="bankAccountNumber !=null and bankAccountNumber != ''">
-, t.bank_account_number= #{bankAccountNumber}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-, t.create_user_name= #{createUserName}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
-<if test="storeId !=null and storeId != ''">
-, t.store_id= #{storeId}
-</if> 
- where 1=1 <if test="rsId !=null and rsId != ''">
-and t.rs_id= #{rsId}
-</if> 
+        update resource_supplier t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="supplierName !=null and supplierName != ''">
+            , t.supplier_name= #{supplierName}
+        </if>
+        <if test="accountBank !=null and accountBank != ''">
+            , t.account_bank= #{accountBank}
+        </if>
+        <if test="createUserId !=null and createUserId != ''">
+            , t.create_user_id= #{createUserId}
+        </if>
+        <if test="address !=null and address != ''">
+            , t.address= #{address}
+        </if>
+        <if test="contactName !=null and contactName != ''">
+            , t.contact_name= #{contactName}
+        </if>
+        <if test="tel !=null and tel != ''">
+            , t.tel= #{tel}
+        </if>
+        <if test="bankAccountNumber !=null and bankAccountNumber != ''">
+            , t.bank_account_number= #{bankAccountNumber}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            , t.create_user_name= #{createUserName}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            , t.store_id= #{storeId}
+        </if>
+        where 1=1
+        <if test="rsId !=null and rsId != ''">
+            and t.rs_id= #{rsId}
+        </if>
 
     </update>
 
     <!-- 查询供应商数量 add by wuxw 2018-07-03 -->
-     <select id="queryResourceSuppliersCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from resource_supplier t 
-where 1 =1 
-<if test="supplierName !=null and supplierName != ''">
-   and t.supplier_name= #{supplierName}
-</if> 
-<if test="accountBank !=null and accountBank != ''">
-   and t.account_bank= #{accountBank}
-</if> 
-<if test="createUserId !=null and createUserId != ''">
-   and t.create_user_id= #{createUserId}
-</if> 
-<if test="address !=null and address != ''">
-   and t.address= #{address}
-</if> 
-<if test="contactName !=null and contactName != ''">
-   and t.contact_name= #{contactName}
-</if> 
-<if test="rsId !=null and rsId != ''">
-   and t.rs_id= #{rsId}
-</if> 
-<if test="tel !=null and tel != ''">
-   and t.tel= #{tel}
-</if> 
-<if test="bankAccountNumber !=null and bankAccountNumber != ''">
-   and t.bank_account_number= #{bankAccountNumber}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="createUserName !=null and createUserName != ''">
-   and t.create_user_name= #{createUserName}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="storeId !=null and storeId != ''">
-   and t.store_id= #{storeId}
-</if> 
+    <select id="queryResourceSuppliersCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from resource_supplier t
+        where 1 =1
+        <if test="supplierName !=null and supplierName != ''">
+            and t.supplier_name= #{supplierName}
+        </if>
+        <if test="accountBank !=null and accountBank != ''">
+            and t.account_bank= #{accountBank}
+        </if>
+        <if test="createUserId !=null and createUserId != ''">
+            and t.create_user_id= #{createUserId}
+        </if>
+        <if test="address !=null and address != ''">
+            and t.address= #{address}
+        </if>
+        <if test="contactName !=null and contactName != ''">
+            and t.contact_name= #{contactName}
+        </if>
+        <if test="rsId !=null and rsId != ''">
+            and t.rs_id= #{rsId}
+        </if>
+        <if test="tel !=null and tel != ''">
+            and t.tel= #{tel}
+        </if>
+        <if test="bankAccountNumber !=null and bankAccountNumber != ''">
+            and t.bank_account_number= #{bankAccountNumber}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="createUserName !=null and createUserName != ''">
+            and t.create_user_name= #{createUserName}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="storeId !=null and storeId != ''">
+            and t.store_id= #{storeId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 3 - 0
java110-interface/src/main/java/com/java110/intf/job/IMallInnerServiceSMO.java

@@ -34,4 +34,7 @@ public interface IMallInnerServiceSMO {
 
     @RequestMapping(value = "/generatorMallCode", method = RequestMethod.POST)
     String generatorMallCode(@RequestBody UserDto userDto);
+
+    @RequestMapping(value = "/sendUserInfo", method = RequestMethod.POST)
+    ResultVo sendUserInfo(@RequestBody UserDto userDto);
 }

+ 21 - 0
service-job/src/main/java/com/java110/job/smo/impl/MallInnerServiceSMOImpl.java

@@ -66,4 +66,25 @@ public class MallInnerServiceSMOImpl extends BaseServiceSMO implements IMallInne
         return resultVo.getData().toString();
     }
 
+    @Override
+    public ResultVo sendUserInfo(@RequestBody UserDto userDto) {
+
+        String mallSwitch = MappingCache.getValue(MALL_DOMAIN, "MALL_SWITCH");
+
+        if ("OFF".equals(mallSwitch)) {
+           return new ResultVo(ResultVo.CODE_OK,ResultVo.MSG_OK);
+        }
+
+        JSONObject paramIn = new JSONObject();
+        paramIn.put("userId", userDto.getUserId());
+        paramIn.put("tel", userDto.getTel());
+        paramIn.put("password", userDto.getPassword());
+        paramIn.put("userName", userDto.getName());
+        paramIn.put("address", userDto.getAddress());
+
+        ResultVo resultVo = sendMallImpl.post("/mall/api/token.generatorCode", paramIn);
+
+        return resultVo;
+    }
+
 }

+ 7 - 0
service-user/src/main/java/com/java110/user/cmd/user/OwnerUserLoginCmd.java

@@ -23,6 +23,7 @@ import com.java110.intf.common.ISmsInnerServiceSMO;
 import com.java110.intf.common.ISystemInfoV1InnerServiceSMO;
 import com.java110.intf.community.ICommunityInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
+import com.java110.intf.job.IMallInnerServiceSMO;
 import com.java110.intf.user.*;
 import com.java110.po.owner.OwnerAppUserPo;
 import com.java110.po.user.UserAttrPo;
@@ -79,6 +80,9 @@ public class OwnerUserLoginCmd extends Cmd {
     @Autowired
     private IOwnerRoomRelV1InnerServiceSMO ownerRoomRelV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IMallInnerServiceSMO mallInnerServiceSMOImpl;
+
     @Autowired
     private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
 
@@ -127,6 +131,9 @@ public class OwnerUserLoginCmd extends Cmd {
             throw new CmdException("密码错误或者用户不存在");
         }
 
+        //todo 1.2 同步物业用户资料给商城
+        mallInnerServiceSMOImpl.sendUserInfo(userDtos.get(0));
+
         // todo  2.0 校验 业主用户绑定表是否存在记录
         OwnerAppUserDto ownerAppUserDto = new OwnerAppUserDto();
         ownerAppUserDto.setUserId(userDtos.get(0).getUserId());