java110 hace 5 años
padre
commit
fc2133f669

+ 9 - 0
java110-bean/src/main/java/com/java110/po/user/UserPo.java

@@ -22,6 +22,7 @@ public class UserPo implements Serializable {
     private String sex;
     private String tel;
     private String levelCd;
+    private String statusCd;
 
     public String getId() {
         return id;
@@ -110,4 +111,12 @@ public class UserPo implements Serializable {
     public void setLevelCd(String levelCd) {
         this.levelCd = levelCd;
     }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
 }

+ 6 - 3
java110-db/src/main/resources/mapper/user/OwnerAppUserServiceDaoImplMapper.xml

@@ -229,9 +229,6 @@
         <if test="state !=null and state != ''">
             , t.state= #{state}
         </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
-        </if>
         <if test="appTypeCd !=null and appTypeCd != ''">
             , t.app_type_cd= #{appTypeCd}
         </if>
@@ -248,6 +245,12 @@
         <if test="appUserId !=null and appUserId != ''">
             and t.app_user_id= #{appUserId}
         </if>
+        <if test="memberId !=null and memberId != ''">
+            and t.member_id= #{memberId}
+        </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>

+ 4 - 0
java110-interface/src/main/java/com/java110/intf/user/IOwnerAppUserInnerServiceSMO.java

@@ -2,6 +2,7 @@ package com.java110.intf.user;
 
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.owner.OwnerAppUserDto;
+import com.java110.po.owner.OwnerAppUserPo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -38,4 +39,7 @@ public interface IOwnerAppUserInnerServiceSMO {
      */
     @RequestMapping(value = "/queryOwnerAppUsersCount", method = RequestMethod.POST)
     int queryOwnerAppUsersCount(@RequestBody OwnerAppUserDto ownerAppUserDto);
+
+    @RequestMapping(value = "/updateOwnerAppUser", method = RequestMethod.POST)
+    int updateOwnerAppUser(@RequestBody OwnerAppUserPo ownerAppUserPo);
 }

+ 9 - 0
java110-interface/src/main/java/com/java110/intf/user/IOwnerInnerServiceSMO.java

@@ -2,6 +2,7 @@ package com.java110.intf.user;
 
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.owner.OwnerDto;
+import com.java110.po.owner.OwnerPo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -98,4 +99,12 @@ public interface IOwnerInnerServiceSMO {
     @RequestMapping(value = "/queryOwnersByParkingSpace", method = RequestMethod.POST)
     List<OwnerDto> queryOwnersByParkingSpace(@RequestBody OwnerDto ownerDto);
 
+    /**
+     * 修改业主信息
+     * @param ownerPo
+     * @return
+     */
+    @RequestMapping(value = "/updateOwnerMember", method = RequestMethod.POST)
+    int updateOwnerMember(@RequestBody OwnerPo ownerPo);
+
 }

+ 4 - 0
java110-interface/src/main/java/com/java110/intf/user/IUserInnerServiceSMO.java

@@ -3,6 +3,7 @@ package com.java110.intf.user;
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.user.UserAttrDto;
 import com.java110.dto.user.UserDto;
+import com.java110.po.user.UserPo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -93,4 +94,7 @@ public interface IUserInnerServiceSMO {
      */
     @RequestMapping(value = "/getUserAttrs", method = RequestMethod.POST)
     List<UserAttrDto> getUserAttrs(@RequestBody UserAttrDto userAttrDto);
+
+    @RequestMapping(value = "/updateUser", method = RequestMethod.POST)
+    int updateUser(@RequestBody  UserPo userPo);
 }

+ 2 - 0
service-user/src/main/java/com/java110/user/api/OwnerApi.java

@@ -50,12 +50,14 @@ public class OwnerApi {
     @RequestMapping(value = "/changeOwnerPhone", method = RequestMethod.POST)
     public ResponseEntity<String> changeOwnerPhone(@RequestBody JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson,"link","请求报文中未包含手机号");
+        Assert.hasKeyAndValue(reqJson,"userId","请求报文中未包含用户ID");
         Assert.hasKeyAndValue(reqJson,"memberId","请求报文中未包含业主信息");
         Assert.hasKeyAndValue(reqJson,"communityId","请求报文中未包含小区信息");
         OwnerPo ownerPo = new OwnerPo();
         ownerPo.setLink(reqJson.getString("link"));
         ownerPo.setMemberId(reqJson.getString("memberId"));
         ownerPo.setCommunityId(reqJson.getString("communityId"));
+        ownerPo.setUserId(reqJson.getString("userId"));
 
         return changeOwnerPhoneImpl.change(ownerPo);
     }

+ 22 - 118
service-user/src/main/java/com/java110/user/bmo/owner/impl/ChangeOwnerPhoneImpl.java

@@ -1,27 +1,22 @@
 package com.java110.user.bmo.owner.impl;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.java110.dto.RoomDto;
-import com.java110.dto.file.FileDto;
-import com.java110.dto.file.FileRelDto;
-import com.java110.dto.owner.OwnerDto;
-import com.java110.dto.owner.OwnerRoomRelDto;
+import com.java110.core.annotation.Java110Transactional;
 import com.java110.intf.common.IFileInnerServiceSMO;
 import com.java110.intf.common.IFileRelInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
+import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.po.owner.OwnerAppUserPo;
 import com.java110.po.owner.OwnerPo;
+import com.java110.po.user.UserPo;
 import com.java110.user.bmo.owner.IChangeOwnerPhone;
-import com.java110.user.bmo.owner.IQueryTenants;
 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
 public class ChangeOwnerPhoneImpl implements IChangeOwnerPhone {
 
@@ -29,126 +24,35 @@ public class ChangeOwnerPhoneImpl implements IChangeOwnerPhone {
     private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
 
     @Autowired
-    private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
+    private IUserInnerServiceSMO userInnerServiceSMOImpl;
 
     @Autowired
-    private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl;
+    private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl;
 
-    @Autowired
-    private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl;
 
-    @Autowired
-    private IFileInnerServiceSMO fileInnerServiceSMOImpl;
 
     @Override
+    @Java110Transactional
     public ResponseEntity<String> change(OwnerPo ownerPo) {
 
+        String userId = ownerPo.getUserId();
+        ownerPo.setUserId("");
+        //修改业主手机号
+        ownerInnerServiceSMOImpl.updateOwnerMember(ownerPo);
 
+        UserPo userPo = new UserPo();
+        userPo.setUserId(userId);
+        userPo.setTel(ownerPo.getLink());
+        userInnerServiceSMOImpl.updateUser(userPo);
 
-        return ResultVo.success();
-    }
-
-    /**
-     * 处理业主信息
-     *
-     * @param reqJson
-     * @param tmpOwnerDto
-     * @param data
-     */
-    private void dealOwner(JSONObject reqJson, OwnerDto tmpOwnerDto, JSONArray data) {
-
-        JSONObject dataObj = new JSONObject();
-        dataObj.put("name", tmpOwnerDto.getName());
-        dataObj.put("gender", tmpOwnerDto.getSex());
-        dataObj.put("certificationType", "1");//身份证
-        dataObj.put("certificationCode", tmpOwnerDto.getIdCard());
-        dataObj.put("birthday", "");
-        dataObj.put("contact", tmpOwnerDto.getLink());
-        dataObj.put("tenantsType", tmpOwnerDto.getOwnerTypeCd());
-
-        dataObj.put("tenantsPhoto", getOwnerPhoto(tmpOwnerDto));
-        dataObj.put("accessTypt", "0");
-        dataObj.put("accessInfo", "");
-
-        if (!OwnerDto.OWNER_TYPE_CD_OWNER.equals(tmpOwnerDto.getOwnerTypeCd())) {
-            OwnerDto memberOwnerDto = new OwnerDto();
-            memberOwnerDto.setOwnerId(tmpOwnerDto.getOwnerId());
-            memberOwnerDto.setCommunityId(reqJson.getString("code"));
-            List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(memberOwnerDto);
-
-            if (ownerDtos != null && ownerDtos.size() > 0) {
-                dataObj.put("ownerName", ownerDtos.get(0).getName());
-                dataObj.put("ownerCertificationType", "1");
-                dataObj.put("ownerCertificationCode", ownerDtos.get(0).getIdCard());
-            }
-        } else {
-            dataObj.put("ownerName", tmpOwnerDto.getName());
-            dataObj.put("ownerCertificationType", "1");
-            dataObj.put("ownerCertificationCode", tmpOwnerDto.getIdCard());
-        }
-
-
-        dataObj.put("weixin", "");
-        dataObj.put("qq", "");
-        dataObj.put("email", "");
-        dataObj.put("update_time", tmpOwnerDto.getCreateTime());
-        OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
-        ownerRoomRelDto.setOwnerId(tmpOwnerDto.getOwnerId());
-
-        List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-        if (ownerRoomRelDtos == null || ownerRoomRelDtos.size() < 1) {
-            dataObj.put("floor", "");
-            dataObj.put("building", "");
-            dataObj.put("houses", "");
-            data.add(dataObj);
-            return;
-        }
-
-        RoomDto roomDto = new RoomDto();
-        roomDto.setRoomId(ownerRoomRelDtos.get(0).getRoomId());
-        roomDto.setCommunityId(reqJson.getString("code"));
-        List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
-
-        if (roomDtos == null || roomDtos.size() < 1) {
-            dataObj.put("floor", "");
-            dataObj.put("building", "");
-            dataObj.put("houses", "");
-            data.add(dataObj);
-            return;
-        }
-        String floor = "";
-        String building = "";
-        String houses = "";
-        for (RoomDto tmpRoomDto : roomDtos) {
-            floor += (tmpRoomDto.getLayer() + ",");
-            building += (tmpRoomDto.getFloorNum() + ",");
-            houses += (tmpRoomDto.getRoomNum() + ",");
-        }
-        dataObj.put("floor", floor);
-        dataObj.put("building", building);
-        dataObj.put("houses", houses);
-        data.add(dataObj);
-
+        OwnerAppUserPo ownerAppUserPo = new OwnerAppUserPo();
+        ownerAppUserPo.setMemberId(ownerPo.getMemberId());
+        ownerAppUserPo.setCommunityId(ownerPo.getCommunityId());
+        ownerAppUserPo.setLink(ownerPo.getLink());
+        ownerAppUserInnerServiceSMOImpl.updateOwnerAppUser(ownerAppUserPo);
 
+        return ResultVo.success();
     }
 
-    private String getOwnerPhoto(OwnerDto ownerDto) {
-        FileRelDto fileRelDto = new FileRelDto();
-        fileRelDto.setObjId(ownerDto.getMemberId());
-        fileRelDto.setRelTypeCd("10000");
-        List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto);
-        if (fileRelDtos == null || fileRelDtos.size() != 1) {
-            return "";
-        }
-        FileDto fileDto = new FileDto();
-        fileDto.setFileId(fileRelDtos.get(0).getFileSaveName());
-        fileDto.setFileSaveName(fileRelDtos.get(0).getFileSaveName());
-        fileDto.setCommunityId(ownerDto.getCommunityId());
-        List<FileDto> fileDtos = fileInnerServiceSMOImpl.queryFiles(fileDto);
-        if (fileDtos == null || fileDtos.size() != 1) {
-            return "";
-        }
 
-        return fileDtos.get(0).getContext();
-    }
 }

+ 10 - 0
service-user/src/main/java/com/java110/user/smo/impl/OwnerAppUserInnerServiceSMOImpl.java

@@ -6,6 +6,7 @@ import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
 import com.java110.intf.user.IUserInnerServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.owner.OwnerAppUserDto;
+import com.java110.po.owner.OwnerAppUserPo;
 import com.java110.user.dao.IOwnerAppUserServiceDao;
 import com.java110.utils.util.BeanConvertUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName FloorInnerServiceSMOImpl
@@ -53,6 +55,14 @@ public class OwnerAppUserInnerServiceSMOImpl extends BaseServiceSMO implements I
         return ownerAppUserServiceDaoImpl.queryOwnerAppUsersCount(BeanConvertUtil.beanCovertMap(ownerAppUserDto));
     }
 
+    @Override
+    public int updateOwnerAppUser(@RequestBody OwnerAppUserPo ownerAppUserPo) {
+        Map info = BeanConvertUtil.beanCovertMap(ownerAppUserPo);
+        info.put("statusCd","0");
+        ownerAppUserServiceDaoImpl.updateOwnerAppUserInfoInstance(info);
+        return 0;
+    }
+
     public IOwnerAppUserServiceDao getOwnerAppUserServiceDaoImpl() {
         return ownerAppUserServiceDaoImpl;
     }

+ 10 - 2
service-user/src/main/java/com/java110/user/smo/impl/OwnerInnerServiceSMOImpl.java

@@ -11,6 +11,7 @@ import com.java110.intf.community.ICommunityInnerServiceSMO;
 import com.java110.intf.user.IOwnerAttrInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.po.owner.OwnerPo;
 import com.java110.user.dao.IOwnerServiceDao;
 import com.java110.utils.constant.OwnerTypeConstant;
 import com.java110.utils.constant.StatusConstant;
@@ -101,7 +102,7 @@ public class OwnerInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerIn
         List<OwnerAttrDto> ownerAttrDtos = ownerAttrInnerServiceSMOImpl.queryOwnerAttrs(ownerAttrDto);
 
         for (OwnerDto owner : owners) {
-            refreshOwner(owner, users,ownerAttrDtos);
+            refreshOwner(owner, users, ownerAttrDtos);
         }
         return owners;
     }
@@ -243,7 +244,7 @@ public class OwnerInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerIn
         List<OwnerAttrDto> ownerAttrDtos = ownerAttrInnerServiceSMOImpl.queryOwnerAttrs(ownerAttrDto);
 
         for (OwnerDto owner : owners) {
-            refreshOwner(owner, users,ownerAttrDtos);
+            refreshOwner(owner, users, ownerAttrDtos);
         }
         return owners;
     }
@@ -264,6 +265,13 @@ public class OwnerInnerServiceSMOImpl extends BaseServiceSMO implements IOwnerIn
         return BeanConvertUtil.covertBeanList(ownerServiceDaoImpl.queryOwnersByParkingSpace(BeanConvertUtil.beanCovertMap(ownerDto)), OwnerDto.class);
     }
 
+    @Override
+    public int updateOwnerMember(OwnerPo ownerPo) {
+        Map info = BeanConvertUtil.beanCovertMap(ownerPo);
+        ownerServiceDaoImpl.updateOwnerInfoInstance(info);
+        return 1;
+    }
+
     public IUserInnerServiceSMO getUserInnerServiceSMOImpl() {
         return userInnerServiceSMOImpl;
     }

+ 8 - 0
service-user/src/main/java/com/java110/user/smo/impl/UserInnerServiceSMOImpl.java

@@ -4,6 +4,7 @@ import com.java110.intf.user.IUserInnerServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.user.UserAttrDto;
 import com.java110.dto.user.UserDto;
+import com.java110.po.user.UserPo;
 import com.java110.user.dao.IUserServiceDao;
 import com.java110.utils.constant.StatusConstant;
 import com.java110.utils.util.BeanConvertUtil;
@@ -107,6 +108,13 @@ public class UserInnerServiceSMOImpl implements IUserInnerServiceSMO {
         return userAttrDtos;
     }
 
+    @Override
+    public int updateUser(@RequestBody UserPo userPo) {
+        userPo.setStatusCd("0");
+        userServiceDaoImpl.updateUserInfoInstance(BeanConvertUtil.beanCovertMap(userPo));
+        return 1;
+    }
+
     private void freshUserAttrs(List<UserDto> userDtos) {
 
         Map param = null;