| | |
| | | <version>4.17.6</version> |
| | | </dependency> |
| | | |
| | | <!--邮件发送依赖--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-mail</artifactId> |
| | | </dependency> |
| | | <!--谷歌地图依赖--> |
| | | <dependency> |
| | | <groupId>com.google.maps</groupId> |
| | | <artifactId>google-maps-services</artifactId> |
| | | <version>2.0.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-simple</artifactId> |
| | | <version>1.7.25</version> |
| | | </dependency> |
| | | |
| | | <!--引入本地工行支付jar start--> |
| | | <!--<dependency> |
| | | <groupId>com.icbc</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/icbc-api-sdk-cop.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.icbc.api</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/icbc-api-sdk-cop-io.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.com.infosec</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/icbc-ca.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>cn.com.infosecCrypto</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/InfosecCrypto_Java1_02_JDK14+.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>proguard</groupId> |
| | | <artifactId>icbc</artifactId> |
| | | <version>v2</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/proguard.jar</systemPath> |
| | | </dependency>--> |
| | | <!--引入本地工行支付jar end--> |
| | | </dependencies> |
| | | |
| | | |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/queryByType") |
| | | @ApiOperation(value = "获取各种协议及H5页面", tags = {"用户端-协议"}, notes = "") |
| | | @ApiOperation(value = "获取各种协议及H5页面【1.0】", tags = {"用户端-协议"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "语言类型(1=简体中文,2=英语,3=法语)", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "数据类型(1:隐私协议,2:用户协议,3:用户指南,4:法律条款,5:关于我们,6=注册协议,7=取消订单说明,8=充值领券规则设置,9=司机注册协议,10=改派说明,11=跨城出行乘车须知,12:常见问题,13:计价规则,14:包车协议)", name = "type", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<BaseWarpper> queryByType(Integer type){ |
| | | public ResultUtil<BaseWarpper> queryByType(Integer type, Integer language){ |
| | | try { |
| | | String s = agreementService.queryByType(type); |
| | | String s = agreementService.queryByType(type, language); |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | baseWarpper.setContent(s); |
| | | return ResultUtil.success(baseWarpper); |
| | |
| | | import com.stylefeng.guns.modular.system.service.ISmsrecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserInfoService; |
| | | import com.stylefeng.guns.modular.system.service.IVerifiedService; |
| | | import com.stylefeng.guns.modular.system.util.ALiApiUtil; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.warpper.LoginWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInfoWarpper; |
| | | import com.stylefeng.guns.modular.system.warpper.UserInviteInfoWarpper; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ALiApiUtil aLiApiUtil; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/isEnterEmergencyContact") |
| | |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/sedEmail") |
| | | @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil sedEmail(String email){ |
| | | try { |
| | | if(ToolUtil.isEmpty(email)){ |
| | | return ResultUtil.error("邮箱地址不能为空"); |
| | | } |
| | | Random random = new Random(); |
| | | StringBuffer sb = new StringBuffer(); |
| | | for(int i = 0; i < 4; i++){ |
| | | sb.append((int) (random.nextDouble() * 10)); |
| | | } |
| | | String authCode = sb.toString(); |
| | | redisUtil.setStrValue(email, authCode, 5 * 60); |
| | | EmailUtil.getMimeMessage(email, "验证码", "您的验证码:<span style=\"color:red;\">" + authCode + "</span>"); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/facebookLogin") |
| | | @ApiOperation(value = "FaceBook授权登录【1.0】", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "FaceBook用户id", name = "id", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "FaceBook用户名称", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "FaceBook绑定的email", name = "email", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "当前定位区县行政编号", name = "registAreaCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"), |
| | | }) |
| | | public ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid){ |
| | | try { |
| | | return userInfoService.facebookLogin(id, name, email, registAreaCode, uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 设置电话号码 |
| | | * @param phone |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/bindingEmail") |
| | | @ApiOperation(value = "设置邮箱地址【1.0】", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "绑定类型(1=注册账号绑定,2=个人中心绑定)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<LoginWarpper> bindingEmail(Integer type, String email, String code, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return userInfoService.bindingEmail(uid, type, email, code); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户个人信息 |
| | | * @param request |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryUserInfo") |
| | | @ApiOperation(value = "获取用户详情", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取用户详情【1.0】", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | * @param type |
| | | * @return |
| | | */ |
| | | String queryByType(@Param("type") Integer type, @Param("useType") Integer useType); |
| | | String queryByType(@Param("type") Integer type, @Param("language") Integer language, @Param("useType") Integer useType); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * 邮箱查询用户 |
| | | * @param email |
| | | * @return |
| | | */ |
| | | UserInfo queryByEmail(@Param("email") String email); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据微信openid获取用户 |
| | | * @param openid |
| | | * @param unionid |
| | |
| | | <resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.Agreement"> |
| | | <id column="id" property="id"/> |
| | | <result column="useType" property="useType"/> |
| | | <result column="language" property="language"/> |
| | | <result column="content" property="content"/> |
| | | <result column="type" property="type"/> |
| | | |
| | |
| | | <if test="null != useType"> |
| | | and useType = #{useType} |
| | | </if> |
| | | <if test="null != language"> |
| | | and `language` = #{language} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="registIp" property="registIp"/> |
| | | <result column="registAreaCode" property="registAreaCode"/> |
| | | <result column="phone" property="phone"/> |
| | | <result column="email" property="email"/> |
| | | <result column="nickName" property="nickName"/> |
| | | <result column="avatar" property="avatar"/> |
| | | <result column="birthday" property="birthday"/> |
| | |
| | | <result column="balance" property="balance"/> |
| | | <result column="integral" property="integral"/> |
| | | <result column="passWord" property="passWord"/> |
| | | <result column="faceBookId" property="faceBookId"/> |
| | | <result column="openId" property="openId"/> |
| | | <result column="appletsOpenId" property="appletsOpenId"/> |
| | | <result column="unionid" property="unionid"/> |
| | |
| | | <result column="updateUser" property="updateUser"/> |
| | | <result column="uid" property="uid"/> |
| | | <result column="uType" property="uType"/> |
| | | <result column="language" property="language"/> |
| | | </resultMap> |
| | | |
| | | <select id="queryFreeMOney" resultType="Double"> |
| | |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | from t_user where flag != 3 and phone = #{phone} |
| | | </select> |
| | | |
| | | |
| | | <select id="queryByEmail" resultType="UserInfo"> |
| | | select |
| | | id as id, |
| | | registIp as registIp, |
| | | registAreaCode as registAreaCode, |
| | | phone as phone, |
| | | nickName as nickName, |
| | | avatar as avatar, |
| | | birthday as birthday, |
| | | sex as sex, |
| | | emergencyContact as emergencyContact, |
| | | emergencyContactNumber as emergencyContactNumber, |
| | | isAuth as isAuth, |
| | | name as name, |
| | | idCard as idCard, |
| | | idCardFront as idCardFront, |
| | | idCardReverse as idCardReverse, |
| | | consumption as consumption, |
| | | balance as balance, |
| | | integral as integral, |
| | | passWord as passWord, |
| | | openId as openId, |
| | | appletsOpenId as appletsOpenId, |
| | | unionid as unionid, |
| | | state as state, |
| | | flag as flag, |
| | | insertTime as insertTime, |
| | | insertUser as insertUser, |
| | | updateTime as updateTime, |
| | | updateUser as updateUser |
| | | from t_user where flag != 3 and email = #{email} |
| | | </select> |
| | | |
| | | |
| | |
| | | select |
| | | a.id as id, |
| | | a.phone as phone, |
| | | a.email as email, |
| | | a.nickName as nickName, |
| | | a.avatar as avatar, |
| | | DATE_FORMAT(a.birthday, '%Y-%m-%d') as birthday, |
| | |
| | | a.integral as integral, |
| | | a.emergencyContact as emergencyContact, |
| | | a.emergencyContactNumber as emergencyContactNumber, |
| | | a.balance as balance |
| | | a.balance as balance, |
| | | a.language |
| | | from t_user a where 1 = 1 |
| | | <if test="null != uid"> |
| | | and a.id = #{uid} |
| | |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | /** |
| | | * 语言类型(1=简体中文,2=英语,3=法语) |
| | | */ |
| | | @TableField("language") |
| | | private Integer language; |
| | | |
| | | public Integer getUseType() { |
| | | return useType; |
| | |
| | | this.type = type; |
| | | } |
| | | |
| | | public Integer getLanguage() { |
| | | return language; |
| | | } |
| | | |
| | | public void setLanguage(Integer language) { |
| | | this.language = language; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "Agreement{" + |
| | |
| | | @TableField("phone") |
| | | private String phone; |
| | | /** |
| | | * 邮箱 |
| | | */ |
| | | @TableField("email") |
| | | private String email; |
| | | /** |
| | | * 昵称 |
| | | */ |
| | | @TableField("nickName") |
| | |
| | | @TableField("passWord") |
| | | private String passWord; |
| | | /** |
| | | * facebook用户id |
| | | */ |
| | | @TableField("faceBookId") |
| | | private String faceBookId; |
| | | /** |
| | | * 微信openid |
| | | */ |
| | | @TableField("openId") |
| | |
| | | */ |
| | | @TableField("uType") |
| | | private Integer uType; |
| | | /** |
| | | * 语言类型(1=简体中文,2=英语,3=法语) |
| | | */ |
| | | @TableField("language") |
| | | private Integer language; |
| | | |
| | | public Integer getuType() { |
| | | return uType; |
| | |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getNickName() { |
| | |
| | | this.passWord = passWord; |
| | | } |
| | | |
| | | public String getFaceBookId() { |
| | | return faceBookId; |
| | | } |
| | | |
| | | public void setFaceBookId(String faceBookId) { |
| | | this.faceBookId = faceBookId; |
| | | } |
| | | |
| | | public String getOpenId() { |
| | | return openId; |
| | | } |
| | |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public Integer getLanguage() { |
| | | return language; |
| | | } |
| | | |
| | | public void setLanguage(Integer language) { |
| | | this.language = language; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "UserInfo{" + |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | String queryByType(Integer type) throws Exception; |
| | | String queryByType(Integer type, Integer language) throws Exception; |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * facebook登录 |
| | | * @param id |
| | | * @param name |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 忘记密码的操作 |
| | | * @param phone |
| | | * @param code |
| | |
| | | |
| | | |
| | | /** |
| | | * 绑定邮箱 |
| | | * @param email |
| | | * @param code |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | ResultUtil bindingEmail(Integer uid, Integer type, String email, String code) throws Exception; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 从redis中获取用户id |
| | | * @param request |
| | | * @return |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public String queryByType(Integer type) throws Exception { |
| | | String s = agreementMapper.queryByType(type, 1); |
| | | public String queryByType(Integer type, Integer language) throws Exception { |
| | | String s = agreementMapper.queryByType(type, language, 1); |
| | | if(ToolUtil.isEmpty(s)){ |
| | | s = agreementMapper.queryByType(type, null); |
| | | s = agreementMapper.queryByType(type, language, null); |
| | | } |
| | | return s; |
| | | } |
| | |
| | | sb.append((int) (random.nextDouble() * 10)); |
| | | } |
| | | String authCode = sb.toString(); |
| | | authCode="1234"; |
| | | String sms = "短信验证码【" + authCode + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!"; |
| | | |
| | | //发送验证码短信 |
| | |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmail(ToolUtil.isNotEmpty(userInfo.getEmail()) ? 2 : 1); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | if(uid!=null){ |
| | |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmail(ToolUtil.isNotEmpty(userInfo.getEmail()) ? 2 : 1); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil facebookLogin(String id, String name, String email, String registAreaCode, Integer uid) throws Exception { |
| | | UserInfo userInfo = this.selectOne(new EntityWrapper<UserInfo>().eq("faceBookId", id).ne("flag", 3)); |
| | | if(null == userInfo){ |
| | | userInfo = new UserInfo(); |
| | | userInfo.setEmail(email); |
| | | userInfo.setNickName(name); |
| | | userInfo.setIsAuth(1); |
| | | userInfo.setConsumption(0D); |
| | | userInfo.setBalance(0D); |
| | | userInfo.setIntegral(0); |
| | | userInfo.setPassWord(ShiroKit.md5("", salt)); |
| | | userInfo.setFaceBookId(id); |
| | | userInfo.setState(1); |
| | | userInfo.setFlag(1); |
| | | userInfo.setInsertTime(new Date()); |
| | | userInfo.setFreeMoney(new BigDecimal(0)); |
| | | |
| | | Double money = this.userInfoMapper.queryFreeMOney(); |
| | | if(money!=null){ |
| | | userInfo.setFreeMoney(BigDecimal.valueOf(money)); |
| | | } |
| | | if(null!=uid){ |
| | | userInfo.setUid(uid); |
| | | //微信登录只能是乘客用户分享 |
| | | userInfo.setuType(1); |
| | | } |
| | | //用户所属企业 |
| | | if(null != registAreaCode){ |
| | | Company query = companyCityService.query(registAreaCode); |
| | | userInfo.setCompanyId(null != query ? query.getId() : null); |
| | | userInfo.setRegistAreaCode(registAreaCode); |
| | | } |
| | | this.insert(userInfo); |
| | | |
| | | this.addCoupon(userInfo);//添加优惠券 |
| | | |
| | | UserInfo finalUserInfo = userInfo; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if(pushMinistryOfTransport){ |
| | | //上传数据 |
| | | pushMinistryOfTransportUtil.baseInfoPassenger(finalUserInfo.getId()); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | if(userInfo.getState() == 2){ |
| | | return ResultUtil.error("账号被冻结"); |
| | | } |
| | | |
| | | //调用单点登录的逻辑 |
| | | this.singlePointLogin(userInfo.getId()); |
| | | |
| | | String token = this.getToken(userInfo, ""); |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(userInfo.getId()); |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(ToolUtil.isNotEmpty(userInfo.getPhone()) ? 2 : 1); |
| | | loginWarpper.setEmail(ToolUtil.isNotEmpty(userInfo.getEmail()) ? 2 : 1); |
| | | loginWarpper.setEmergencyContact(userInfo.getEmergencyContact()); |
| | | loginWarpper.setEmergencyContactNumber(userInfo.getEmergencyContactNumber()); |
| | | if(uid!=null){ |
| | | userInfo = userInfoMapper.selectById(uid); |
| | | List<Map<String, Object>> query = userActivityInviteMapper.query(userInfo.getCompanyId()); |
| | | Date date = new Date(); |
| | | for(Map<String, Object> map : query){ |
| | | Double lavePrice = Double.valueOf(map.get("lavePrice").toString()); |
| | | for(int i = Integer.valueOf(String.valueOf(map.get("totalNum"))); i > 0; i--){ |
| | | //判断当前优惠券金额是否大于可发放剩余总金额 |
| | | if(Double.valueOf(String.valueOf(map.get("money"))).compareTo(lavePrice) > 0){ |
| | | break; |
| | | } |
| | | UserCouponRecord userCouponRecord = new UserCouponRecord(); |
| | | userCouponRecord.setActivityType(3); |
| | | userCouponRecord.setCouponActivityId(Integer.valueOf(String.valueOf(map.get("id")))); |
| | | userCouponRecord.setCouponId(Integer.valueOf(String.valueOf(map.get("couponId")))); |
| | | userCouponRecord.setState(1); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + Integer.valueOf(String.valueOf(map.get("effective")))); |
| | | userCouponRecord.setExpirationTime(calendar.getTime()); |
| | | userCouponRecord.setCouponType(Integer.valueOf(String.valueOf(map.get("couponType")))); |
| | | userCouponRecord.setCouponUseType(Integer.valueOf(String.valueOf(map.get("couponUseType")))); |
| | | userCouponRecord.setInsertTime(date); |
| | | userCouponRecord.setFullMoney(Double.valueOf(String.valueOf(map.get("fullMoney")))); |
| | | userCouponRecord.setMoney(Double.valueOf(String.valueOf(map.get("money")))); |
| | | userCouponRecord.setCompanyId(userInfo.getCompanyId()); |
| | | userCouponRecord.setUserId(uid); |
| | | userCouponRecordService.insert(userCouponRecord); |
| | | //修改剩余可发放总金额 |
| | | lavePrice -= Double.valueOf(String.valueOf(map.get("money"))); |
| | | } |
| | | UserActivityInvite uai = userActivityInviteMapper.selectById(Integer.valueOf(map.get("id").toString())); |
| | | uai.setLavePrice(new BigDecimal(lavePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userActivityInviteMapper.updateById(uai); |
| | | } |
| | | } |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(2); |
| | | loginWarpper.setEmail(2); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | |
| | | return ResultUtil.success(new LoginWarpper()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ResultUtil bindingEmail(Integer uid, Integer type, String email, String code) throws Exception { |
| | | boolean b = this.checkCaptcha(email, code); |
| | | if(!b){ |
| | | return ResultUtil.error("验证码无效"); |
| | | } |
| | | UserInfo userInfo = this.selectById(uid); |
| | | UserInfo userInfo1 = userInfoMapper.queryByEmail(email); |
| | | if(null != userInfo1){ |
| | | userInfo1.setOpenId(userInfo.getOpenId()); |
| | | userInfo1.setUnionid(userInfo.getUnionid()); |
| | | userInfo1.setAppletsOpenId(userInfo.getAppletsOpenId()); |
| | | userInfo1.setAvatar(userInfo.getAvatar()); |
| | | userInfo1.setSex(userInfo.getSex()); |
| | | userInfo1.setNickName(userInfo.getNickName()); |
| | | this.updateById(userInfo1); |
| | | |
| | | this.deleteById(userInfo.getId());//删除原有数据 |
| | | //还原之前账号领取的注册优惠券 |
| | | List<UserCouponRecord> list = userCouponRecordService.selectList(new EntityWrapper<UserCouponRecord>().eq("userId", userInfo.getId())); |
| | | for(UserCouponRecord ucr : list){ |
| | | if(ucr.getActivityType() == 1){//赠送 |
| | | |
| | | } |
| | | if(ucr.getActivityType() == 2){//注册 |
| | | UserActivityRegistered userActivityRegistered = userActivityRegisteredService.selectById(ucr.getCouponActivityId()); |
| | | userActivityRegistered.setLaveNum(userActivityRegistered.getLaveNum() + 1); |
| | | userActivityRegistered.setLavePrice(userActivityRegistered.getLavePrice() + ucr.getMoney()); |
| | | userActivityRegisteredService.updateById(userActivityRegistered); |
| | | } |
| | | if(ucr.getActivityType() == 3){//邀请 |
| | | |
| | | } |
| | | if(ucr.getActivityType() == 4){//充值 |
| | | |
| | | } |
| | | userCouponRecordService.deleteById(ucr.getId()); |
| | | } |
| | | |
| | | |
| | | //获取新的token等数据 |
| | | String token = this.getToken(userInfo1, ""); |
| | | LoginWarpper loginWarpper = new LoginWarpper(); |
| | | loginWarpper.setId(userInfo1.getId()); |
| | | loginWarpper.setToken(token); |
| | | loginWarpper.setAppid(UUIDUtil.getRandomCode()); |
| | | loginWarpper.setPhone(2); |
| | | loginWarpper.setEmail(2); |
| | | return ResultUtil.success(loginWarpper); |
| | | } |
| | | |
| | | userInfo.setEmail(email); |
| | | userInfo.setUpdateTime(new Date()); |
| | | userInfo.setUpdateUser(userInfo.getId()); |
| | | this.updateById(userInfo); |
| | | if(type == 1){//注册成功后发送邮件 |
| | | EmailUtil.getMimeMessage(email, "注册账户", ""); |
| | | } |
| | | return ResultUtil.success(new LoginWarpper()); |
| | | } |
| | | |
| | | /** |
| | | * 从redis中获取数据 |
| | |
| | | UserInfo userInfo = this.selectById(uid); |
| | | userInfo.setPassWord(ShiroKit.md5(password, salt)); |
| | | this.updateById(userInfo); |
| | | //发送邮件 |
| | | EmailUtil.getMimeMessage(userInfo.getEmail(), "修改密码", ""); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | import javax.mail.*; |
| | | import javax.mail.internet.InternetAddress; |
| | | import javax.mail.internet.MimeBodyPart; |
| | | import javax.mail.internet.MimeMessage; |
| | | import javax.mail.internet.MimeMultipart; |
| | | import java.util.Date; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * 邮件工具类 |
| | | */ |
| | | public class EmailUtil { |
| | | |
| | | /* |
| | | * gmail邮箱SSL方式 |
| | | */ |
| | | private static void gmailssl(Properties props) { |
| | | final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; |
| | | props.put("mail.debug", "true"); |
| | | props.put("mail.smtp.host", "smtp.gmail.com"); |
| | | props.put("mail.smtp.ssl.enable", "true"); |
| | | props.put("mail.smtp.socketFactory.class", SSL_FACTORY); |
| | | props.put("mail.smtp.port", "465"); |
| | | props.put("mail.smtp.socketFactory.port", "465"); |
| | | props.put("mail.smtp.auth", "true"); |
| | | } |
| | | |
| | | |
| | | //gmail邮箱的TLS方式 |
| | | private static void gmailtls(Properties props) { |
| | | props.put("mail.smtp.auth", "true"); |
| | | props.put("mail.smtp.starttls.enable", "true"); |
| | | props.put("mail.smtp.host", "smtp.gmail.com"); |
| | | props.put("mail.smtp.port", "587"); |
| | | } |
| | | |
| | | /** |
| | | * 创建邮件内容 需科学上网 |
| | | * |
| | | * @param sentToEmail 接收人邮箱 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static boolean getMimeMessage(String sentToEmail, String subject, String content) throws Exception { |
| | | //1.创建一封邮件的实例对象 |
| | | Properties props = new Properties(); |
| | | //选择ssl方式 |
| | | gmailssl(props); |
| | | |
| | | final String username = "southwindservice@gmail.com";// gmail 邮箱 |
| | | final String password = "irkgrsuzxgmwrxzy";// Google应用专用密码 |
| | | // 当做多商户的时候需要使用getInstance, 如果只是一个邮箱发送的话就用getDefaultInstance |
| | | // Session.getDefaultInstance 会将username,password保存在session会话中 |
| | | // Session.getInstance 不进行保存 |
| | | Session session = Session.getInstance(props, |
| | | new Authenticator() { |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | MimeMessage msg = new MimeMessage(session); |
| | | //2.设置发件人地址 |
| | | msg.setFrom(new InternetAddress(sentToEmail)); |
| | | /** |
| | | * 3.设置收件人地址(可以增加多个收件人、抄送、密送),即下面这一行代码书写多行 |
| | | * MimeMessage.RecipientType.TO:发送 |
| | | * MimeMessage.RecipientType.CC:抄送 |
| | | * MimeMessage.RecipientType.BCC:密送 |
| | | */ |
| | | msg.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(sentToEmail)); |
| | | //4.设置邮件主题 |
| | | msg.setSubject(subject, "UTF-8"); |
| | | // 6. 创建文本"节点" |
| | | MimeBodyPart text = new MimeBodyPart(); |
| | | // 这里添加图片的方式是将整个图片包含到邮件内容中, 实际上也可以以 http 链接的形式添加网络图片 |
| | | text.setContent(content, "text/html;charset=UTF-8"); |
| | | // 7. (文本+图片)设置 文本 和 图片"节点"的关系(将 文本 和 图片"节点"合成一个混合"节点") |
| | | MimeMultipart mm_text_image = new MimeMultipart(); |
| | | mm_text_image.addBodyPart(text); |
| | | mm_text_image.setSubType("related"); // 关联关系 |
| | | // 11. 设置整个邮件的关系(将最终的混合"节点"作为邮件的内容添加到邮件对象) |
| | | msg.setContent(mm_text_image); |
| | | //设置邮件的发送时间,默认立即发送 |
| | | msg.setSentDate(new Date()); |
| | | |
| | | Transport.send(msg); |
| | | return true; |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | boolean mimeMessage = getMimeMessage("393733352@qq.com", "测试内容", "这是一段测试内容"); |
| | | System.out.println(mimeMessage); |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | public class DistancematrixVo { |
| | | /** |
| | | * 预估时间(秒) |
| | | */ |
| | | private Long duration; |
| | | |
| | | /** |
| | | * 预估里程(米) |
| | | */ |
| | | private Long distance; |
| | | |
| | | public Long getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(Long duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Long getDistance() { |
| | | return distance; |
| | | } |
| | | |
| | | public void setDistance(Long distance) { |
| | | this.distance = distance; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | public class FindPlaceFromTextVo { |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 详细地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private Double lat; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private Double lng; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getAddress() { |
| | | return address; |
| | | } |
| | | |
| | | public void setAddress(String address) { |
| | | this.address = address; |
| | | } |
| | | |
| | | public Double getLat() { |
| | | return lat; |
| | | } |
| | | |
| | | public void setLat(Double lat) { |
| | | this.lat = lat; |
| | | } |
| | | |
| | | public Double getLng() { |
| | | return lng; |
| | | } |
| | | |
| | | public void setLng(Double lng) { |
| | | this.lng = lng; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | public class GeocodeVo { |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private double lat; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private double lng; |
| | | |
| | | public double getLat() { |
| | | return lat; |
| | | } |
| | | |
| | | public void setLat(double lat) { |
| | | this.lat = lat; |
| | | } |
| | | |
| | | public double getLng() { |
| | | return lng; |
| | | } |
| | | |
| | | public void setLng(double lng) { |
| | | this.lng = lng; |
| | | } |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.GoogleMap; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.maps.*; |
| | | import com.google.maps.model.*; |
| | | |
| | | /** |
| | | * 谷歌地图工具类 |
| | | */ |
| | | public class GoogleMapUtil { |
| | | |
| | | private final static String key = "AIzaSyA_FEliOkbkL1IAHQsnBpbpo9MlIp729H0"; |
| | | |
| | | |
| | | /** |
| | | * 地理编码(地址获取位置坐标) |
| | | * @param address 地址信息 |
| | | * @throws Exception |
| | | */ |
| | | public static GeocodeVo getGeocode(String address) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | GeocodingResult[] results = GeocodingApi.geocode(context, address).await(); |
| | | GeocodeVo vo = null; |
| | | if(results.length > 0){ |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(results[0].addressComponents)); |
| | | |
| | | Geometry geometry = results[0].geometry; |
| | | LatLng location = geometry.location; |
| | | vo = new GeocodeVo(); |
| | | vo.setLat(location.lat); |
| | | vo.setLng(location.lng); |
| | | } |
| | | context.shutdown(); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 逆地理编码获取地址信息 |
| | | * @param lat 纬度 |
| | | * @param lng 经度 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String getReverseGeocode(double lat, double lng) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | GeocodingApiRequest request = GeocodingApi.reverseGeocode(context, new LatLng(lat, lng)); |
| | | GeocodingResult[] results = request.await(); |
| | | String address = null; |
| | | if(results.length > 0){ |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(results[0].addressComponents)); |
| | | |
| | | address = results[0].formattedAddress; |
| | | } |
| | | context.shutdown(); |
| | | return address; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 搜索地图获取地图结果 |
| | | * @param input |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static FindPlaceFromTextVo findplacefromtext(String input) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | FindPlaceFromTextRequest request = new FindPlaceFromTextRequest(context); |
| | | request.input(input); |
| | | request.inputType(FindPlaceFromTextRequest.InputType.TEXT_QUERY); |
| | | FindPlaceFromText findPlaceFromText = request.await(); |
| | | PlacesSearchResult[] candidates = findPlaceFromText.candidates; |
| | | FindPlaceFromTextVo vo = null; |
| | | if(candidates.length > 0){ |
| | | vo = new FindPlaceFromTextVo(); |
| | | String formattedAddress = candidates[0].formattedAddress; |
| | | String name = candidates[0].name; |
| | | Geometry geometry = candidates[0].geometry; |
| | | LatLng location = geometry.location; |
| | | double lat = location.lat; |
| | | double lng = location.lng; |
| | | |
| | | vo.setName(name); |
| | | vo.setAddress(formattedAddress); |
| | | vo.setLat(lat); |
| | | vo.setLng(lng); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取两个地点之间的预估里程和预估时间 |
| | | * @param origin 起点 |
| | | * @param destination 终点 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static DistancematrixVo getDistancematrix(String origin, String destination) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | DistanceMatrixApiRequest request = DistanceMatrixApi.getDistanceMatrix(context, new String[]{origin}, new String[]{destination}); |
| | | request.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | DistanceMatrix distanceMatrix = request.await(); |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(distanceMatrix)); |
| | | context.shutdown(); |
| | | |
| | | DistanceMatrixElement elements = distanceMatrix.rows[0].elements[0]; |
| | | DistancematrixVo vo = new DistancematrixVo(); |
| | | vo.setDistance(elements.distance.inMeters); |
| | | vo.setDuration(elements.duration.inSeconds); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取两地点之间的线路规划 |
| | | * @param origin 起点 要计算方向的位置ID、地址或文本纬度/经度值。目标参数的选项与原点参数的相同。 |
| | | * @param destination 终点 要计算方向的位置ID、地址或文本纬度/经度值。目标参数的选项与原点参数的相同。 |
| | | * |
| | | */ |
| | | public static void getDirections(String origin, String destination) throws Exception{ |
| | | GeoApiContext context = new GeoApiContext.Builder() |
| | | .apiKey(key) |
| | | .build(); |
| | | DirectionsApiRequest directions = DirectionsApi.getDirections(context, origin, destination); |
| | | directions.mode(TravelMode.DRIVING);//出行方式(驾车) |
| | | DirectionsResult result = directions.await(); |
| | | |
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
| | | System.out.println(gson.toJson(result)); |
| | | context.shutdown(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static void main(String[] ages){ |
| | | try { |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.stylefeng.guns.modular.system.util.Tingg; |
| | | |
| | | /** |
| | | * Tingg支付工具类 |
| | | */ |
| | | public class TinggPayUtil { |
| | | } |
| | |
| | | private String appid; |
| | | @ApiModelProperty("是否有手机号码(1=否,2=是)") |
| | | private Integer phone; |
| | | @ApiModelProperty("是否有邮箱(1=否,2=是)") |
| | | private Integer email; |
| | | @ApiModelProperty("紧急联系人") |
| | | private String emergencyContact; |
| | | @ApiModelProperty("联系人电话") |
| | |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public Integer getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(Integer email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getEmergencyContact() { |
| | | return emergencyContact; |
| | | } |
| | |
| | | private String nickName; |
| | | @ApiModelProperty("电话") |
| | | private String phone; |
| | | @ApiModelProperty("邮箱地址") |
| | | private String email; |
| | | @ApiModelProperty("是否实名(1:否,2:是)") |
| | | private Integer isAuth; |
| | | @ApiModelProperty("实名认证状态(1=待认证,2=认证通过,3=认证失败)") |
| | |
| | | private Integer integral; |
| | | @ApiModelProperty("账户余额") |
| | | private Double balance; |
| | | @ApiModelProperty("多语言(1=简体中文,2=英语,3=法语)") |
| | | private Integer language; |
| | | @ApiModelProperty("紧急联系人姓名") |
| | | private String emergencyContact; |
| | | @ApiModelProperty("紧急联系人电话") |
| | |
| | | |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public Integer getIsAuth() { |
| | |
| | | this.balance = balance; |
| | | } |
| | | |
| | | public Integer getLanguage() { |
| | | return language; |
| | | } |
| | | |
| | | public void setLanguage(Integer language) { |
| | | this.language = language; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "UserInfoWarpper{" + |
| | |
| | | userInfoWarpper.setEmergencyContact(null != map.get("emergencyContact") ? String.valueOf(map.get("emergencyContact")) : ""); |
| | | userInfoWarpper.setEmergencyContactNumber(null != map.get("emergencyContactNumber") ? String.valueOf(map.get("emergencyContactNumber")) : ""); |
| | | userInfoWarpper.setBalance(null != map.get("balance") ? Double.valueOf(String.valueOf(map.get("balance"))) : 0); |
| | | userInfoWarpper.setEmail(null != map.get("email") ? String.valueOf(map.get("email")) : ""); |
| | | userInfoWarpper.setLanguage(null != map.get("language") ? Integer.valueOf(String.valueOf(map.get("language"))) : 1); |
| | | } |
| | | return userInfoWarpper; |
| | | } |
| | |
| | | spring: |
| | | profiles: local |
| | | datasource: |
| | | url: jdbc:mysql://116.63.168.184:3306/feima?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://127.0.0.1:3306/igotravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | password: 123456 |
| | | db-name: guns #用来搜集数据库的所有表 |
| | | filters: wall,mergeStat |
| | | |
| | |
| | | |
| | | --- |
| | | |
| | | --- |
| | | #脸书 |
| | | facebook: |
| | | appid: |
| | | secretKey: |
| | | |
| | | --- |
| | | |
| | | juhe: #聚合数据 |
| | | appKey: c0d55e1fb67efd7ae3175ee9bd8c6bc2 # |
| | | |
| | |
| | | #测试环境 |
| | | callbackPath: http://39.108.37.243/user |
| | | |
| | | --- |
| | | |
| | | spring: |
| | | mail: |
| | | host: smtp.gmail.com # 配置 smtp 服务器地址 |
| | | port: 465 # smtp 服务器的端口 |
| | | username: southwindservice@gmail.com # 配置邮箱用户名(你的邮箱地址) |
| | | password: irkgrsuzxgmwrxzy # 配置申请到的授权码(刚让复制的授权码) |
| | | default-encoding: UTF-8 # 配置邮件编码 |
| | | properties: |
| | | mail: |
| | | smtp: |
| | | socketFactoryClass: javax.net.ssl.SSLSocketFactory # 配饰 SSL 加密工厂 |
| | | debug: true |
| | | from: southwindservice@gmail.com # 发送方邮件,配在yml中可方便更改 |
| | | |
| | | --- |
| | | |