예제 #1
0
 @Transactional
 public int updateUserInfo(UserInfoDO updateUserInfoParam, BaseParam baseParam) throws Exception {
   if (updateUserInfoParam.getLocationFlag() != null
       && updateUserInfoParam.getLocationFlag() == 1) { // 修改默认咖啡厅
     // 默认咖啡厅
     String text =
         HttpUtil.get(HttpUtil.BAIDU_GET_DIS + baseParam.getLat() + "," + baseParam.getLon());
     Map<String, Object> locationMap = JsonUtil.toBean(text, Map.class);
     Map<String, Object> addressComponent =
         (Map<String, Object>)
             ((Map<String, Object>) locationMap.get("result")).get("addressComponent");
     // 城市,区,街道
     updateUserInfoParam.setDistrict((String) addressComponent.get("district"));
     updateUserInfoParam.setStreet((String) addressComponent.get("street"));
     updateUserInfoParam.setCity((String) addressComponent.get("city"));
   }
   if (updateUserInfoParam.getBirthdayFlag() != null
       && updateUserInfoParam.getBirthdayFlag() == 1) {
     if (updateUserInfoParam.getBirthdayType() == 1) { // 阴历
       updateUserInfoParam.setLunarBirthday(updateUserInfoParam.getBirthday());
       updateUserInfoParam.setBirthday(
           Lunar.lunarToSolar(updateUserInfoParam.getFormatBirthday(), false));
     } else { // 阳历
       String lunarString = Lunar.solarToLunar(updateUserInfoParam.getFormatBirthday());
       updateUserInfoParam.setLunarBirthday(DateUtil.getyyyyMMddDate(lunarString));
     }
     // 星座
     int month = updateUserInfoParam.getBirthday().getMonth() + 1;
     int day = updateUserInfoParam.getBirthday().getDate();
     updateUserInfoParam.setConstellation(Constellation.getConstellation(month, day));
   }
   uploadBooksMapper.udateUserInfo(updateUserInfoParam, updateUserInfoParam.getUserId());
   return userInfoMapper.updateUserInfo(updateUserInfoParam);
 }
예제 #2
0
 @Transactional
 public int registerDetail(
     BaseParam baseParam,
     UserInfoDO registerDetailUserParam,
     RegisterUserResult registerUserResult)
     throws Exception {
   registerDetailUserParam.setUserId(baseParam.getUserId());
   if (registerDetailUserParam.getBirthday() != null) {
     if (registerDetailUserParam.getBirthdayType() == 1) { // 阴历
       registerDetailUserParam.setLunarBirthday(registerDetailUserParam.getBirthday());
       registerDetailUserParam.setBirthday(
           Lunar.lunarToSolar(registerDetailUserParam.getFormatBirthday(), false));
     } else { // 阳历
       String lunarString = Lunar.solarToLunar(registerDetailUserParam.getFormatBirthday());
       registerDetailUserParam.setLunarBirthday(DateUtil.getyyyyMMddDate(lunarString));
     }
     // 星座
     int month = registerDetailUserParam.getBirthday().getMonth() + 1;
     int day = registerDetailUserParam.getBirthday().getDate();
     registerDetailUserParam.setConstellation(Constellation.getConstellation(month, day));
   }
   // 默认咖啡厅
   if (registerDetailUserParam.getDefaultPlace() != null) {
     String text =
         HttpUtil.get(HttpUtil.BAIDU_GET_DIS + baseParam.getLat() + "," + baseParam.getLon());
     Map<String, Object> locationMap = JsonUtil.toBean(text, Map.class);
     System.out.println(locationMap);
     Map<String, Object> addressComponent =
         (Map<String, Object>)
             ((Map<String, Object>) locationMap.get("result")).get("addressComponent");
     System.out.println(addressComponent);
     // 城市,区,街道
     registerDetailUserParam.setDistrict((String) addressComponent.get("district"));
     registerDetailUserParam.setStreet((String) addressComponent.get("street"));
     registerDetailUserParam.setCity((String) addressComponent.get("city"));
   }
   int result = userInfoMapper.addUserInfoDetail(registerDetailUserParam);
   uploadBooksMapper.udateUserInfo(registerDetailUserParam, registerDetailUserParam.getUserId());
   return result;
 }