diff --git a/bweb/src/main/java/com/hfkj/controller/BsUserController.java b/bweb/src/main/java/com/hfkj/controller/BsUserController.java index 4863c27..f7f2284 100644 --- a/bweb/src/main/java/com/hfkj/controller/BsUserController.java +++ b/bweb/src/main/java/com/hfkj/controller/BsUserController.java @@ -12,6 +12,7 @@ import com.hfkj.entity.BsUserParentRel; import com.hfkj.model.ResponseData; import com.hfkj.service.user.BsUserGradeService; import com.hfkj.service.user.BsUserParentRelService; +import com.hfkj.service.user.BsUserPlatformAuthorizeService; import com.hfkj.service.user.BsUserService; import com.hfkj.sysenum.user.UserGradeEnum; import io.swagger.annotations.Api; @@ -42,6 +43,8 @@ public class BsUserController { private BsUserGradeService userGradeService; @Resource private BsUserParentRelService userParentRelService; + @Resource + private BsUserPlatformAuthorizeService userPlatformAuthorizeService; @RequestMapping(value="/gradeAdjust",method = RequestMethod.POST) @ResponseBody @@ -110,7 +113,7 @@ public class BsUserController { Map param = new HashMap<>(); param.put("user", user); // 授权 - param.put("platform_authorize", new ArrayList<>()); + param.put("platform_authorize", userPlatformAuthorizeService.getUserAuth(userId)); // 邀请人 param.put("inviteUser", user.getInviteUserId()!=null?userService.getUser(user.getInviteUserId()):null); // 贡献关系 diff --git a/cweb/src/main/java/com/hfkj/controller/UserController.java b/cweb/src/main/java/com/hfkj/controller/UserController.java index 5556a84..36119b3 100644 --- a/cweb/src/main/java/com/hfkj/controller/UserController.java +++ b/cweb/src/main/java/com/hfkj/controller/UserController.java @@ -10,10 +10,13 @@ import com.hfkj.common.utils.*; import com.hfkj.config.CommonSysConst; import com.hfkj.config.SysConfig; import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserPlatformAuthorize; import com.hfkj.model.ResponseData; import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.UserSessionObject; +import com.hfkj.service.user.BsUserPlatformAuthorizeService; import com.hfkj.service.user.BsUserService; +import com.hfkj.sysenum.user.UserAuthorizePlatformEnum; import com.hfkj.sysenum.user.UserLoginType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -47,6 +50,8 @@ public class UserController { @Resource private BsUserService userService; @Resource + private BsUserPlatformAuthorizeService userPlatformAuthorizeService; + @Resource private RedisUtil redisUtil; @Autowired private UserCenter userCenter; @@ -366,6 +371,16 @@ public class UserController { user.setWechatUnionid(userinfo.getString("unionid")); userService.updateInfo(user); + // 授权信息 + BsUserPlatformAuthorize authorize = new BsUserPlatformAuthorize(); + authorize.setUserId(user.getId()); + authorize.setPlatformCode(UserAuthorizePlatformEnum.type2.getType()); + authorize.setPlatformName(UserAuthorizePlatformEnum.type2.getName()); + authorize.setAvatar(userinfo.getString("headimgurl")); + authorize.setNickName(userinfo.getString("nickname")); + authorize.setOpenId(user.getWechatOpenId()); + userPlatformAuthorizeService.edit(authorize); + return ResponseMsgUtil.success(userCenter.getSessionModel(UserSessionObject.class)); } catch (Exception e) { return ResponseMsgUtil.exception(e); diff --git a/service/src/main/java/com/hfkj/common/QRCodeGenerator.java b/service/src/main/java/com/hfkj/common/QRCodeGenerator.java index 59a55b8..1b96a29 100644 --- a/service/src/main/java/com/hfkj/common/QRCodeGenerator.java +++ b/service/src/main/java/com/hfkj/common/QRCodeGenerator.java @@ -63,7 +63,7 @@ public class QRCodeGenerator { public static String overlapImage(String path ,String number) { try { // 创建BufferedImage对象 - int width = 100; + int width = 115; int height = 45; BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); diff --git a/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapper.java b/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapper.java new file mode 100644 index 0000000..8d7d21b --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapper.java @@ -0,0 +1,141 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserPlatformAuthorize; +import com.hfkj.entity.BsUserPlatformAuthorizeExample; +import java.util.List; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.DeleteProvider; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.InsertProvider; +import org.apache.ibatis.annotations.Options; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.SelectProvider; +import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.UpdateProvider; +import org.apache.ibatis.type.JdbcType; +import org.springframework.stereotype.Repository; + +/** + * + * 代码由工具生成,请勿修改!!! + * 如果需要扩展请在其父类进行扩展 + * + **/ +@Repository +public interface BsUserPlatformAuthorizeMapper extends BsUserPlatformAuthorizeMapperExt { + @SelectProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="countByExample") + long countByExample(BsUserPlatformAuthorizeExample example); + + @DeleteProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="deleteByExample") + int deleteByExample(BsUserPlatformAuthorizeExample example); + + @Delete({ + "delete from bs_user_platform_authorize", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + + @Insert({ + "insert into bs_user_platform_authorize (user_id, platform_code, ", + "platform_name, open_id, ", + "avatar, nick_name, ", + "gender, province, city, ", + "`status`, create_time, ", + "update_time, ext_1, ", + "ext_2, ext_3)", + "values (#{userId,jdbcType=BIGINT}, #{platformCode,jdbcType=INTEGER}, ", + "#{platformName,jdbcType=VARCHAR}, #{openId,jdbcType=VARCHAR}, ", + "#{avatar,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, ", + "#{gender,jdbcType=BIT}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, ", + "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + }) + @Options(useGeneratedKeys=true,keyProperty="id") + int insert(BsUserPlatformAuthorize record); + + @InsertProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="insertSelective") + @Options(useGeneratedKeys=true,keyProperty="id") + int insertSelective(BsUserPlatformAuthorize record); + + @SelectProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="selectByExample") + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="platform_code", property="platformCode", jdbcType=JdbcType.INTEGER), + @Result(column="platform_name", property="platformName", jdbcType=JdbcType.VARCHAR), + @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), + @Result(column="avatar", property="avatar", jdbcType=JdbcType.VARCHAR), + @Result(column="nick_name", property="nickName", jdbcType=JdbcType.VARCHAR), + @Result(column="gender", property="gender", jdbcType=JdbcType.BIT), + @Result(column="province", property="province", jdbcType=JdbcType.VARCHAR), + @Result(column="city", property="city", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + List selectByExample(BsUserPlatformAuthorizeExample example); + + @Select({ + "select", + "id, user_id, platform_code, platform_name, open_id, avatar, nick_name, gender, ", + "province, city, `status`, create_time, update_time, ext_1, ext_2, ext_3", + "from bs_user_platform_authorize", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="platform_code", property="platformCode", jdbcType=JdbcType.INTEGER), + @Result(column="platform_name", property="platformName", jdbcType=JdbcType.VARCHAR), + @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), + @Result(column="avatar", property="avatar", jdbcType=JdbcType.VARCHAR), + @Result(column="nick_name", property="nickName", jdbcType=JdbcType.VARCHAR), + @Result(column="gender", property="gender", jdbcType=JdbcType.BIT), + @Result(column="province", property="province", jdbcType=JdbcType.VARCHAR), + @Result(column="city", property="city", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + BsUserPlatformAuthorize selectByPrimaryKey(Long id); + + @UpdateProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="updateByExampleSelective") + int updateByExampleSelective(@Param("record") BsUserPlatformAuthorize record, @Param("example") BsUserPlatformAuthorizeExample example); + + @UpdateProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="updateByExample") + int updateByExample(@Param("record") BsUserPlatformAuthorize record, @Param("example") BsUserPlatformAuthorizeExample example); + + @UpdateProvider(type=BsUserPlatformAuthorizeSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(BsUserPlatformAuthorize record); + + @Update({ + "update bs_user_platform_authorize", + "set user_id = #{userId,jdbcType=BIGINT},", + "platform_code = #{platformCode,jdbcType=INTEGER},", + "platform_name = #{platformName,jdbcType=VARCHAR},", + "open_id = #{openId,jdbcType=VARCHAR},", + "avatar = #{avatar,jdbcType=VARCHAR},", + "nick_name = #{nickName,jdbcType=VARCHAR},", + "gender = #{gender,jdbcType=BIT},", + "province = #{province,jdbcType=VARCHAR},", + "city = #{city,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "update_time = #{updateTime,jdbcType=TIMESTAMP},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(BsUserPlatformAuthorize record); +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapperExt.java b/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapperExt.java new file mode 100644 index 0000000..5e9ca0b --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeMapperExt.java @@ -0,0 +1,7 @@ +package com.hfkj.dao; + +/** + * mapper扩展类 + */ +public interface BsUserPlatformAuthorizeMapperExt { +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeSqlProvider.java new file mode 100644 index 0000000..23bdf7e --- /dev/null +++ b/service/src/main/java/com/hfkj/dao/BsUserPlatformAuthorizeSqlProvider.java @@ -0,0 +1,388 @@ +package com.hfkj.dao; + +import com.hfkj.entity.BsUserPlatformAuthorize; +import com.hfkj.entity.BsUserPlatformAuthorizeExample.Criteria; +import com.hfkj.entity.BsUserPlatformAuthorizeExample.Criterion; +import com.hfkj.entity.BsUserPlatformAuthorizeExample; +import java.util.List; +import java.util.Map; +import org.apache.ibatis.jdbc.SQL; + +public class BsUserPlatformAuthorizeSqlProvider { + + public String countByExample(BsUserPlatformAuthorizeExample example) { + SQL sql = new SQL(); + sql.SELECT("count(*)").FROM("bs_user_platform_authorize"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String deleteByExample(BsUserPlatformAuthorizeExample example) { + SQL sql = new SQL(); + sql.DELETE_FROM("bs_user_platform_authorize"); + applyWhere(sql, example, false); + return sql.toString(); + } + + public String insertSelective(BsUserPlatformAuthorize record) { + SQL sql = new SQL(); + sql.INSERT_INTO("bs_user_platform_authorize"); + + if (record.getUserId() != null) { + sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); + } + + if (record.getPlatformCode() != null) { + sql.VALUES("platform_code", "#{platformCode,jdbcType=INTEGER}"); + } + + if (record.getPlatformName() != null) { + sql.VALUES("platform_name", "#{platformName,jdbcType=VARCHAR}"); + } + + if (record.getOpenId() != null) { + sql.VALUES("open_id", "#{openId,jdbcType=VARCHAR}"); + } + + if (record.getAvatar() != null) { + sql.VALUES("avatar", "#{avatar,jdbcType=VARCHAR}"); + } + + if (record.getNickName() != null) { + sql.VALUES("nick_name", "#{nickName,jdbcType=VARCHAR}"); + } + + if (record.getGender() != null) { + sql.VALUES("gender", "#{gender,jdbcType=BIT}"); + } + + if (record.getProvince() != null) { + sql.VALUES("province", "#{province,jdbcType=VARCHAR}"); + } + + if (record.getCity() != null) { + sql.VALUES("city", "#{city,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); + } + + if (record.getCreateTime() != null) { + sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); + } + + return sql.toString(); + } + + public String selectByExample(BsUserPlatformAuthorizeExample example) { + SQL sql = new SQL(); + if (example != null && example.isDistinct()) { + sql.SELECT_DISTINCT("id"); + } else { + sql.SELECT("id"); + } + sql.SELECT("user_id"); + sql.SELECT("platform_code"); + sql.SELECT("platform_name"); + sql.SELECT("open_id"); + sql.SELECT("avatar"); + sql.SELECT("nick_name"); + sql.SELECT("gender"); + sql.SELECT("province"); + sql.SELECT("city"); + sql.SELECT("`status`"); + sql.SELECT("create_time"); + sql.SELECT("update_time"); + sql.SELECT("ext_1"); + sql.SELECT("ext_2"); + sql.SELECT("ext_3"); + sql.FROM("bs_user_platform_authorize"); + applyWhere(sql, example, false); + + if (example != null && example.getOrderByClause() != null) { + sql.ORDER_BY(example.getOrderByClause()); + } + + return sql.toString(); + } + + public String updateByExampleSelective(Map parameter) { + BsUserPlatformAuthorize record = (BsUserPlatformAuthorize) parameter.get("record"); + BsUserPlatformAuthorizeExample example = (BsUserPlatformAuthorizeExample) parameter.get("example"); + + SQL sql = new SQL(); + sql.UPDATE("bs_user_platform_authorize"); + + if (record.getId() != null) { + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + } + + if (record.getUserId() != null) { + sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); + } + + if (record.getPlatformCode() != null) { + sql.SET("platform_code = #{record.platformCode,jdbcType=INTEGER}"); + } + + if (record.getPlatformName() != null) { + sql.SET("platform_name = #{record.platformName,jdbcType=VARCHAR}"); + } + + if (record.getOpenId() != null) { + sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}"); + } + + if (record.getAvatar() != null) { + sql.SET("avatar = #{record.avatar,jdbcType=VARCHAR}"); + } + + if (record.getNickName() != null) { + sql.SET("nick_name = #{record.nickName,jdbcType=VARCHAR}"); + } + + if (record.getGender() != null) { + sql.SET("gender = #{record.gender,jdbcType=BIT}"); + } + + if (record.getProvince() != null) { + sql.SET("province = #{record.province,jdbcType=VARCHAR}"); + } + + if (record.getCity() != null) { + sql.SET("city = #{record.city,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + } + + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByExample(Map parameter) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_platform_authorize"); + + sql.SET("id = #{record.id,jdbcType=BIGINT}"); + sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); + sql.SET("platform_code = #{record.platformCode,jdbcType=INTEGER}"); + sql.SET("platform_name = #{record.platformName,jdbcType=VARCHAR}"); + sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}"); + sql.SET("avatar = #{record.avatar,jdbcType=VARCHAR}"); + sql.SET("nick_name = #{record.nickName,jdbcType=VARCHAR}"); + sql.SET("gender = #{record.gender,jdbcType=BIT}"); + sql.SET("province = #{record.province,jdbcType=VARCHAR}"); + sql.SET("city = #{record.city,jdbcType=VARCHAR}"); + sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); + sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); + sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); + sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); + sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); + sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); + + BsUserPlatformAuthorizeExample example = (BsUserPlatformAuthorizeExample) parameter.get("example"); + applyWhere(sql, example, true); + return sql.toString(); + } + + public String updateByPrimaryKeySelective(BsUserPlatformAuthorize record) { + SQL sql = new SQL(); + sql.UPDATE("bs_user_platform_authorize"); + + if (record.getUserId() != null) { + sql.SET("user_id = #{userId,jdbcType=BIGINT}"); + } + + if (record.getPlatformCode() != null) { + sql.SET("platform_code = #{platformCode,jdbcType=INTEGER}"); + } + + if (record.getPlatformName() != null) { + sql.SET("platform_name = #{platformName,jdbcType=VARCHAR}"); + } + + if (record.getOpenId() != null) { + sql.SET("open_id = #{openId,jdbcType=VARCHAR}"); + } + + if (record.getAvatar() != null) { + sql.SET("avatar = #{avatar,jdbcType=VARCHAR}"); + } + + if (record.getNickName() != null) { + sql.SET("nick_name = #{nickName,jdbcType=VARCHAR}"); + } + + if (record.getGender() != null) { + sql.SET("gender = #{gender,jdbcType=BIT}"); + } + + if (record.getProvince() != null) { + sql.SET("province = #{province,jdbcType=VARCHAR}"); + } + + if (record.getCity() != null) { + sql.SET("city = #{city,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{status,jdbcType=INTEGER}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getUpdateTime() != null) { + sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); + } + + sql.WHERE("id = #{id,jdbcType=BIGINT}"); + + return sql.toString(); + } + + protected void applyWhere(SQL sql, BsUserPlatformAuthorizeExample example, boolean includeExamplePhrase) { + if (example == null) { + return; + } + + String parmPhrase1; + String parmPhrase1_th; + String parmPhrase2; + String parmPhrase2_th; + String parmPhrase3; + String parmPhrase3_th; + if (includeExamplePhrase) { + parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } else { + parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; + parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; + parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; + parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; + parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; + parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; + } + + StringBuilder sb = new StringBuilder(); + List oredCriteria = example.getOredCriteria(); + boolean firstCriteria = true; + for (int i = 0; i < oredCriteria.size(); i++) { + Criteria criteria = oredCriteria.get(i); + if (criteria.isValid()) { + if (firstCriteria) { + firstCriteria = false; + } else { + sb.append(" or "); + } + + sb.append('('); + List criterions = criteria.getAllCriteria(); + boolean firstCriterion = true; + for (int j = 0; j < criterions.size(); j++) { + Criterion criterion = criterions.get(j); + if (firstCriterion) { + firstCriterion = false; + } else { + sb.append(" and "); + } + + if (criterion.isNoValue()) { + sb.append(criterion.getCondition()); + } else if (criterion.isSingleValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); + } else { + sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); + } + } else if (criterion.isBetweenValue()) { + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); + } else { + sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); + } + } else if (criterion.isListValue()) { + sb.append(criterion.getCondition()); + sb.append(" ("); + List listItems = (List) criterion.getValue(); + boolean comma = false; + for (int k = 0; k < listItems.size(); k++) { + if (comma) { + sb.append(", "); + } else { + comma = true; + } + if (criterion.getTypeHandler() == null) { + sb.append(String.format(parmPhrase3, i, j, k)); + } else { + sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); + } + } + sb.append(')'); + } + } + sb.append(')'); + } + } + + if (sb.length() > 0) { + sql.WHERE(sb.toString()); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorize.java b/service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorize.java new file mode 100644 index 0000000..9c60704 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorize.java @@ -0,0 +1,296 @@ +package com.hfkj.entity; + +import java.io.Serializable; +import java.util.Date; + +/** + * bs_user_platform_authorize + * @author + */ +/** + * + * 代码由工具生成 + * + **/ +public class BsUserPlatformAuthorize implements Serializable { + /** + * 主键 + */ + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 平台代码 + */ + private Integer platformCode; + + /** + * 平台名称 + */ + private String platformName; + + /** + * 平台open_id + */ + private String openId; + + /** + * 头像 + */ + private String avatar; + + /** + * 昵称 + */ + private String nickName; + + /** + * 性别: 0:女 1:男 + */ + private Boolean gender; + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 状态 0:删除 1:正常 + */ + private Integer status; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + private String ext1; + + private String ext2; + + private String ext3; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Integer getPlatformCode() { + return platformCode; + } + + public void setPlatformCode(Integer platformCode) { + this.platformCode = platformCode; + } + + public String getPlatformName() { + return platformName; + } + + public void setPlatformName(String platformName) { + this.platformName = platformName; + } + + public String getOpenId() { + return openId; + } + + public void setOpenId(String openId) { + this.openId = openId; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public Boolean getGender() { + return gender; + } + + public void setGender(Boolean gender) { + this.gender = gender; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getExt1() { + return ext1; + } + + public void setExt1(String ext1) { + this.ext1 = ext1; + } + + public String getExt2() { + return ext2; + } + + public void setExt2(String ext2) { + this.ext2 = ext2; + } + + public String getExt3() { + return ext3; + } + + public void setExt3(String ext3) { + this.ext3 = ext3; + } + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + BsUserPlatformAuthorize other = (BsUserPlatformAuthorize) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) + && (this.getPlatformCode() == null ? other.getPlatformCode() == null : this.getPlatformCode().equals(other.getPlatformCode())) + && (this.getPlatformName() == null ? other.getPlatformName() == null : this.getPlatformName().equals(other.getPlatformName())) + && (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId())) + && (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar())) + && (this.getNickName() == null ? other.getNickName() == null : this.getNickName().equals(other.getNickName())) + && (this.getGender() == null ? other.getGender() == null : this.getGender().equals(other.getGender())) + && (this.getProvince() == null ? other.getProvince() == null : this.getProvince().equals(other.getProvince())) + && (this.getCity() == null ? other.getCity() == null : this.getCity().equals(other.getCity())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) + && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) + && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); + result = prime * result + ((getPlatformCode() == null) ? 0 : getPlatformCode().hashCode()); + result = prime * result + ((getPlatformName() == null) ? 0 : getPlatformName().hashCode()); + result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode()); + result = prime * result + ((getAvatar() == null) ? 0 : getAvatar().hashCode()); + result = prime * result + ((getNickName() == null) ? 0 : getNickName().hashCode()); + result = prime * result + ((getGender() == null) ? 0 : getGender().hashCode()); + result = prime * result + ((getProvince() == null) ? 0 : getProvince().hashCode()); + result = prime * result + ((getCity() == null) ? 0 : getCity().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); + result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); + result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", userId=").append(userId); + sb.append(", platformCode=").append(platformCode); + sb.append(", platformName=").append(platformName); + sb.append(", openId=").append(openId); + sb.append(", avatar=").append(avatar); + sb.append(", nickName=").append(nickName); + sb.append(", gender=").append(gender); + sb.append(", province=").append(province); + sb.append(", city=").append(city); + sb.append(", status=").append(status); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", ext1=").append(ext1); + sb.append(", ext2=").append(ext2); + sb.append(", ext3=").append(ext3); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorizeExample.java b/service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorizeExample.java new file mode 100644 index 0000000..6e578d1 --- /dev/null +++ b/service/src/main/java/com/hfkj/entity/BsUserPlatformAuthorizeExample.java @@ -0,0 +1,1273 @@ +package com.hfkj.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class BsUserPlatformAuthorizeExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public BsUserPlatformAuthorizeExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(Long value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(Long value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(Long value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(Long value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(Long value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(Long value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(Long value1, Long value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(Long value1, Long value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andPlatformCodeIsNull() { + addCriterion("platform_code is null"); + return (Criteria) this; + } + + public Criteria andPlatformCodeIsNotNull() { + addCriterion("platform_code is not null"); + return (Criteria) this; + } + + public Criteria andPlatformCodeEqualTo(Integer value) { + addCriterion("platform_code =", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeNotEqualTo(Integer value) { + addCriterion("platform_code <>", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeGreaterThan(Integer value) { + addCriterion("platform_code >", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeGreaterThanOrEqualTo(Integer value) { + addCriterion("platform_code >=", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeLessThan(Integer value) { + addCriterion("platform_code <", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeLessThanOrEqualTo(Integer value) { + addCriterion("platform_code <=", value, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeIn(List values) { + addCriterion("platform_code in", values, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeNotIn(List values) { + addCriterion("platform_code not in", values, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeBetween(Integer value1, Integer value2) { + addCriterion("platform_code between", value1, value2, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformCodeNotBetween(Integer value1, Integer value2) { + addCriterion("platform_code not between", value1, value2, "platformCode"); + return (Criteria) this; + } + + public Criteria andPlatformNameIsNull() { + addCriterion("platform_name is null"); + return (Criteria) this; + } + + public Criteria andPlatformNameIsNotNull() { + addCriterion("platform_name is not null"); + return (Criteria) this; + } + + public Criteria andPlatformNameEqualTo(String value) { + addCriterion("platform_name =", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotEqualTo(String value) { + addCriterion("platform_name <>", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameGreaterThan(String value) { + addCriterion("platform_name >", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameGreaterThanOrEqualTo(String value) { + addCriterion("platform_name >=", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameLessThan(String value) { + addCriterion("platform_name <", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameLessThanOrEqualTo(String value) { + addCriterion("platform_name <=", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameLike(String value) { + addCriterion("platform_name like", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotLike(String value) { + addCriterion("platform_name not like", value, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameIn(List values) { + addCriterion("platform_name in", values, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotIn(List values) { + addCriterion("platform_name not in", values, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameBetween(String value1, String value2) { + addCriterion("platform_name between", value1, value2, "platformName"); + return (Criteria) this; + } + + public Criteria andPlatformNameNotBetween(String value1, String value2) { + addCriterion("platform_name not between", value1, value2, "platformName"); + return (Criteria) this; + } + + public Criteria andOpenIdIsNull() { + addCriterion("open_id is null"); + return (Criteria) this; + } + + public Criteria andOpenIdIsNotNull() { + addCriterion("open_id is not null"); + return (Criteria) this; + } + + public Criteria andOpenIdEqualTo(String value) { + addCriterion("open_id =", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdNotEqualTo(String value) { + addCriterion("open_id <>", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdGreaterThan(String value) { + addCriterion("open_id >", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdGreaterThanOrEqualTo(String value) { + addCriterion("open_id >=", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdLessThan(String value) { + addCriterion("open_id <", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdLessThanOrEqualTo(String value) { + addCriterion("open_id <=", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdLike(String value) { + addCriterion("open_id like", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdNotLike(String value) { + addCriterion("open_id not like", value, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdIn(List values) { + addCriterion("open_id in", values, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdNotIn(List values) { + addCriterion("open_id not in", values, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdBetween(String value1, String value2) { + addCriterion("open_id between", value1, value2, "openId"); + return (Criteria) this; + } + + public Criteria andOpenIdNotBetween(String value1, String value2) { + addCriterion("open_id not between", value1, value2, "openId"); + return (Criteria) this; + } + + public Criteria andAvatarIsNull() { + addCriterion("avatar is null"); + return (Criteria) this; + } + + public Criteria andAvatarIsNotNull() { + addCriterion("avatar is not null"); + return (Criteria) this; + } + + public Criteria andAvatarEqualTo(String value) { + addCriterion("avatar =", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarNotEqualTo(String value) { + addCriterion("avatar <>", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarGreaterThan(String value) { + addCriterion("avatar >", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarGreaterThanOrEqualTo(String value) { + addCriterion("avatar >=", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarLessThan(String value) { + addCriterion("avatar <", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarLessThanOrEqualTo(String value) { + addCriterion("avatar <=", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarLike(String value) { + addCriterion("avatar like", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarNotLike(String value) { + addCriterion("avatar not like", value, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarIn(List values) { + addCriterion("avatar in", values, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarNotIn(List values) { + addCriterion("avatar not in", values, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarBetween(String value1, String value2) { + addCriterion("avatar between", value1, value2, "avatar"); + return (Criteria) this; + } + + public Criteria andAvatarNotBetween(String value1, String value2) { + addCriterion("avatar not between", value1, value2, "avatar"); + return (Criteria) this; + } + + public Criteria andNickNameIsNull() { + addCriterion("nick_name is null"); + return (Criteria) this; + } + + public Criteria andNickNameIsNotNull() { + addCriterion("nick_name is not null"); + return (Criteria) this; + } + + public Criteria andNickNameEqualTo(String value) { + addCriterion("nick_name =", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameNotEqualTo(String value) { + addCriterion("nick_name <>", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameGreaterThan(String value) { + addCriterion("nick_name >", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameGreaterThanOrEqualTo(String value) { + addCriterion("nick_name >=", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameLessThan(String value) { + addCriterion("nick_name <", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameLessThanOrEqualTo(String value) { + addCriterion("nick_name <=", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameLike(String value) { + addCriterion("nick_name like", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameNotLike(String value) { + addCriterion("nick_name not like", value, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameIn(List values) { + addCriterion("nick_name in", values, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameNotIn(List values) { + addCriterion("nick_name not in", values, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameBetween(String value1, String value2) { + addCriterion("nick_name between", value1, value2, "nickName"); + return (Criteria) this; + } + + public Criteria andNickNameNotBetween(String value1, String value2) { + addCriterion("nick_name not between", value1, value2, "nickName"); + return (Criteria) this; + } + + public Criteria andGenderIsNull() { + addCriterion("gender is null"); + return (Criteria) this; + } + + public Criteria andGenderIsNotNull() { + addCriterion("gender is not null"); + return (Criteria) this; + } + + public Criteria andGenderEqualTo(Boolean value) { + addCriterion("gender =", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotEqualTo(Boolean value) { + addCriterion("gender <>", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderGreaterThan(Boolean value) { + addCriterion("gender >", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderGreaterThanOrEqualTo(Boolean value) { + addCriterion("gender >=", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderLessThan(Boolean value) { + addCriterion("gender <", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderLessThanOrEqualTo(Boolean value) { + addCriterion("gender <=", value, "gender"); + return (Criteria) this; + } + + public Criteria andGenderIn(List values) { + addCriterion("gender in", values, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotIn(List values) { + addCriterion("gender not in", values, "gender"); + return (Criteria) this; + } + + public Criteria andGenderBetween(Boolean value1, Boolean value2) { + addCriterion("gender between", value1, value2, "gender"); + return (Criteria) this; + } + + public Criteria andGenderNotBetween(Boolean value1, Boolean value2) { + addCriterion("gender not between", value1, value2, "gender"); + return (Criteria) this; + } + + public Criteria andProvinceIsNull() { + addCriterion("province is null"); + return (Criteria) this; + } + + public Criteria andProvinceIsNotNull() { + addCriterion("province is not null"); + return (Criteria) this; + } + + public Criteria andProvinceEqualTo(String value) { + addCriterion("province =", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotEqualTo(String value) { + addCriterion("province <>", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceGreaterThan(String value) { + addCriterion("province >", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceGreaterThanOrEqualTo(String value) { + addCriterion("province >=", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLessThan(String value) { + addCriterion("province <", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLessThanOrEqualTo(String value) { + addCriterion("province <=", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceLike(String value) { + addCriterion("province like", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotLike(String value) { + addCriterion("province not like", value, "province"); + return (Criteria) this; + } + + public Criteria andProvinceIn(List values) { + addCriterion("province in", values, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotIn(List values) { + addCriterion("province not in", values, "province"); + return (Criteria) this; + } + + public Criteria andProvinceBetween(String value1, String value2) { + addCriterion("province between", value1, value2, "province"); + return (Criteria) this; + } + + public Criteria andProvinceNotBetween(String value1, String value2) { + addCriterion("province not between", value1, value2, "province"); + return (Criteria) this; + } + + public Criteria andCityIsNull() { + addCriterion("city is null"); + return (Criteria) this; + } + + public Criteria andCityIsNotNull() { + addCriterion("city is not null"); + return (Criteria) this; + } + + public Criteria andCityEqualTo(String value) { + addCriterion("city =", value, "city"); + return (Criteria) this; + } + + public Criteria andCityNotEqualTo(String value) { + addCriterion("city <>", value, "city"); + return (Criteria) this; + } + + public Criteria andCityGreaterThan(String value) { + addCriterion("city >", value, "city"); + return (Criteria) this; + } + + public Criteria andCityGreaterThanOrEqualTo(String value) { + addCriterion("city >=", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLessThan(String value) { + addCriterion("city <", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLessThanOrEqualTo(String value) { + addCriterion("city <=", value, "city"); + return (Criteria) this; + } + + public Criteria andCityLike(String value) { + addCriterion("city like", value, "city"); + return (Criteria) this; + } + + public Criteria andCityNotLike(String value) { + addCriterion("city not like", value, "city"); + return (Criteria) this; + } + + public Criteria andCityIn(List values) { + addCriterion("city in", values, "city"); + return (Criteria) this; + } + + public Criteria andCityNotIn(List values) { + addCriterion("city not in", values, "city"); + return (Criteria) this; + } + + public Criteria andCityBetween(String value1, String value2) { + addCriterion("city between", value1, value2, "city"); + return (Criteria) this; + } + + public Criteria andCityNotBetween(String value1, String value2) { + addCriterion("city not between", value1, value2, "city"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(Integer value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(Integer value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(Integer value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(Integer value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(Integer value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(Integer value1, Integer value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(Integer value1, Integer value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andExt1IsNull() { + addCriterion("ext_1 is null"); + return (Criteria) this; + } + + public Criteria andExt1IsNotNull() { + addCriterion("ext_1 is not null"); + return (Criteria) this; + } + + public Criteria andExt1EqualTo(String value) { + addCriterion("ext_1 =", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotEqualTo(String value) { + addCriterion("ext_1 <>", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThan(String value) { + addCriterion("ext_1 >", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1GreaterThanOrEqualTo(String value) { + addCriterion("ext_1 >=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThan(String value) { + addCriterion("ext_1 <", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1LessThanOrEqualTo(String value) { + addCriterion("ext_1 <=", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Like(String value) { + addCriterion("ext_1 like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotLike(String value) { + addCriterion("ext_1 not like", value, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1In(List values) { + addCriterion("ext_1 in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotIn(List values) { + addCriterion("ext_1 not in", values, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1Between(String value1, String value2) { + addCriterion("ext_1 between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt1NotBetween(String value1, String value2) { + addCriterion("ext_1 not between", value1, value2, "ext1"); + return (Criteria) this; + } + + public Criteria andExt2IsNull() { + addCriterion("ext_2 is null"); + return (Criteria) this; + } + + public Criteria andExt2IsNotNull() { + addCriterion("ext_2 is not null"); + return (Criteria) this; + } + + public Criteria andExt2EqualTo(String value) { + addCriterion("ext_2 =", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotEqualTo(String value) { + addCriterion("ext_2 <>", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThan(String value) { + addCriterion("ext_2 >", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2GreaterThanOrEqualTo(String value) { + addCriterion("ext_2 >=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThan(String value) { + addCriterion("ext_2 <", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2LessThanOrEqualTo(String value) { + addCriterion("ext_2 <=", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Like(String value) { + addCriterion("ext_2 like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotLike(String value) { + addCriterion("ext_2 not like", value, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2In(List values) { + addCriterion("ext_2 in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotIn(List values) { + addCriterion("ext_2 not in", values, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2Between(String value1, String value2) { + addCriterion("ext_2 between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt2NotBetween(String value1, String value2) { + addCriterion("ext_2 not between", value1, value2, "ext2"); + return (Criteria) this; + } + + public Criteria andExt3IsNull() { + addCriterion("ext_3 is null"); + return (Criteria) this; + } + + public Criteria andExt3IsNotNull() { + addCriterion("ext_3 is not null"); + return (Criteria) this; + } + + public Criteria andExt3EqualTo(String value) { + addCriterion("ext_3 =", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotEqualTo(String value) { + addCriterion("ext_3 <>", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThan(String value) { + addCriterion("ext_3 >", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3GreaterThanOrEqualTo(String value) { + addCriterion("ext_3 >=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThan(String value) { + addCriterion("ext_3 <", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3LessThanOrEqualTo(String value) { + addCriterion("ext_3 <=", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Like(String value) { + addCriterion("ext_3 like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotLike(String value) { + addCriterion("ext_3 not like", value, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3In(List values) { + addCriterion("ext_3 in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotIn(List values) { + addCriterion("ext_3 not in", values, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3Between(String value1, String value2) { + addCriterion("ext_3 between", value1, value2, "ext3"); + return (Criteria) this; + } + + public Criteria andExt3NotBetween(String value1, String value2) { + addCriterion("ext_3 not between", value1, value2, "ext3"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/service/src/main/java/com/hfkj/service/user/BsUserPlatformAuthorizeService.java b/service/src/main/java/com/hfkj/service/user/BsUserPlatformAuthorizeService.java new file mode 100644 index 0000000..3b1eb2c --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/BsUserPlatformAuthorizeService.java @@ -0,0 +1,26 @@ +package com.hfkj.service.user; + +import com.hfkj.entity.BsUserPlatformAuthorize; + +import java.util.List; + +/** + * @className: BsUserPlatformAuthorizeService + * @author: HuRui + * @date: 2024/11/6 + **/ +public interface BsUserPlatformAuthorizeService { + + /** + * 编辑数据 + * @param data + */ + void edit(BsUserPlatformAuthorize data); + + /** + * 查询用户授权 + * @param userId + * @return + */ + List getUserAuth(Long userId); +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserContributeServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserContributeServiceImpl.java index 3c12b4d..2198b62 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/BsUserContributeServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserContributeServiceImpl.java @@ -53,8 +53,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { BigDecimal selfPurchaseReward = new BigDecimal(secDictionaryService.getDictionary("SELF_PURCHASE_REWARD", user.getGrade()+"").getCodeName()); // 元宝汇率 BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue()); + // 合伙人权益加成 + BigDecimal partnerIncomePer = user.getPartnerIncomePer()!=null?user.getPartnerIncomePer():new BigDecimal("0"); // 获得元宝数量 (返利金额 * 元宝汇率) * 等级自购奖励比例 - BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)).multiply(selfPurchaseReward.divide(new BigDecimal("100"))).setScale(6, BigDecimal.ROUND_HALF_DOWN); + BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) + .multiply((selfPurchaseReward.add(partnerIncomePer)).divide(new BigDecimal("100"))) + .setScale(6, BigDecimal.ROUND_HALF_DOWN); Map userRechargeParam = new HashMap<>(); userRechargeParam.put("sourceId", MapUtils.getLong(otherParam, "sourceId")); @@ -103,6 +107,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue()); // 直属贡献比例 BigDecimal directlyContributeRate = new BigDecimal("0"); + // 合伙人权益加成 + BigDecimal partnerIncomePer = new BigDecimal("0"); + BsUser parentUserId = userService.getUser(parentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } if (UserGradeEnum.grade1.getCode().equals(userGrade.getCode()) || UserGradeEnum.grade2.getCode().equals(userGrade.getCode())) { @@ -124,7 +134,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { } // 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献 BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); if (parentRel != null) { // 上级账户 @@ -138,9 +148,16 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { if (channel != null) { // 贡献比例 9% directlyContributeRate = new BigDecimal("9"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + BsUser channelUserId = userService.getUser(parentRel.getParentUserId()); + if (channelUserId != null) { + partnerIncomePer = channelUserId.getPartnerIncomePer()!=null?channelUserId.getPartnerIncomePer():new BigDecimal("0"); + } + // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道贡献 parentUserParam.clear(); @@ -165,6 +182,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue()); // 直属贡献比例 BigDecimal directlyContributeRate = new BigDecimal("0"); + // 合伙人权益加成 + BigDecimal partnerIncomePer = new BigDecimal("0"); + BsUser parentUserId = userService.getUser(parentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } if (UserGradeEnum.grade1.getCode().equals(userGrade.getCode()) || UserGradeEnum.grade2.getCode().equals(userGrade.getCode())) { @@ -177,7 +200,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { } // 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献 BigDecimal goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 上级账户 @@ -196,9 +219,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { if (UserGradeEnum.grade3.getCode().equals(userParentRel.getParentUserGrade())) { // 贡献比例 10% directlyContributeRate = new BigDecimal("10"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道贡献 parentUserParam.clear(); @@ -213,9 +242,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { if (userParentRel != null) { // 贡献比例 13% directlyContributeRate = new BigDecimal("13"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道贡献 parentUserParam.clear(); @@ -229,9 +264,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { } else if (UserGradeEnum.grade4.getCode().equals(userParentRel.getParentUserGrade())) { // 贡献比例 23% directlyContributeRate = new BigDecimal("23"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道贡献 parentUserParam.clear(); @@ -246,9 +287,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { if (channel != null) { // 贡献比例 9% directlyContributeRate = new BigDecimal("9"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道贡献 parentUserParam.clear(); @@ -296,11 +343,17 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { // 递归判断找到渠道 BsUserParentRel userParentRel = userParentRelService.getParent(Arrays.asList(UserGradeEnum.grade4),parentRel.getParentUserId()); if (userParentRel != null) { - // 贡献比例 10% + // 贡献比例 13% directlyContributeRate = new BigDecimal("13"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道贡献 parentUserParam.clear(); @@ -315,9 +368,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { if (channel != null) { // 贡献比例 9% directlyContributeRate = new BigDecimal("9"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道贡献 parentUserParam.clear(); @@ -339,6 +398,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue()); // 直属贡献比例 BigDecimal directlyContributeRate = new BigDecimal("0"); + // 合伙人权益加成 + BigDecimal partnerIncomePer = new BigDecimal("0"); + BsUser parentUserId = userService.getUser(parentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献元宝 BigDecimal goldCoin = new BigDecimal("0"); @@ -352,7 +417,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { // 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 上级账户 @@ -382,9 +447,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { directlyContributeRate = new BigDecimal("21.6"); parentUserParam.put("sourceContent", "非直属会员贡献"); } + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 团长账户 userAccountService.recharge(userParentRel.getUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam); @@ -414,9 +485,16 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { parentUserParam.put("sourceContent", "非直属团长团队贡献"); } } + + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(channel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道账户 @@ -439,9 +517,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { directlyContributeRate = new BigDecimal("55"); parentUserParam.put("sourceContent", "非直属会员贡献"); } + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道账户 userAccountService.recharge(userParentRel.getParentUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam); @@ -451,9 +535,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { if (channel != null) { // 贡献比例 9% directlyContributeRate = new BigDecimal("9"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(channel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 贡献 parentUserParam.clear(); @@ -476,6 +566,12 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue()); // 直属贡献比例 BigDecimal directlyContributeRate = new BigDecimal("0"); + // 合伙人权益加成 + BigDecimal partnerIncomePer = new BigDecimal("0"); + BsUser parentUserId = userService.getUser(parentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献元宝 BigDecimal goldCoin = new BigDecimal("0"); @@ -489,7 +585,7 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { // 直属贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 上级账户 @@ -519,9 +615,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { directlyContributeRate = new BigDecimal("21.6"); parentUserParam.put("sourceContent", "非直属会员贡献"); } + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(parentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 团长账户 userAccountService.recharge(userParentRel.getUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam); @@ -551,9 +653,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { parentUserParam.put("sourceContent", "非直属团长团队贡献"); } } + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(channel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道账户 @@ -576,9 +684,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { directlyContributeRate = new BigDecimal("55"); parentUserParam.put("sourceContent", "非直属会员贡献"); } + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(userParentRel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate.add(partnerIncomePer)).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 渠道账户 userAccountService.recharge(userParentRel.getParentUserId(), goldCoin, UserAccountRecordSourceTypeEnum.type1, parentUserParam); @@ -588,9 +702,15 @@ public class BsUserContributeServiceImpl implements BsUserContributeService { if (channel != null) { // 贡献比例 9% directlyContributeRate = new BigDecimal("9"); + // 合伙人权益加成 + partnerIncomePer = new BigDecimal("0"); + parentUserId = userService.getUser(channel.getParentUserId()); + if (parentUserId != null) { + partnerIncomePer = parentUserId.getPartnerIncomePer()!=null?parentUserId.getPartnerIncomePer():new BigDecimal("0"); + } // 贡献 = (返利金额 * 元宝汇率) * 直属贡献 goldCoin = (rebateAmount.multiply(goldCoinExchangeRate)) - .multiply(directlyContributeRate.divide(new BigDecimal("100"))) + .multiply((directlyContributeRate).add(partnerIncomePer).divide(new BigDecimal("100"))) .setScale(6, BigDecimal.ROUND_HALF_DOWN); // 贡献 parentUserParam.clear(); diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeServiceImpl.java index 0a992fc..8b6a0ba 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserGradeServiceImpl.java @@ -4,6 +4,7 @@ import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; import com.hfkj.entity.BsUser; +import com.hfkj.entity.BsUserGradeConfig; import com.hfkj.model.UserTeamModel; import com.hfkj.service.user.*; import com.hfkj.sysenum.user.UserAccountRecordSourceTypeEnum; @@ -16,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -34,6 +36,8 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { private BsUserAccountRecordService userAccountRecordService; @Resource private BsUserParentRelService userParentRelService; + @Resource + private BsUserGradeConfigService userGradeConfigService; @Override @Transactional(propagation= Propagation.REQUIRED,rollbackFor= {RuntimeException.class}) @@ -96,17 +100,24 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { if (!UserGradeEnum.grade1.getCode().equals(user.getGrade())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "只有“见习会员”才能进行购买"); } + // 获取晋升配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade1); + Map otherParam = new HashMap<>(); otherParam.put("sourceContent", "升级优淘会员"); - // 支付3元宝 - userAccountService.consume(user.getId(),new BigDecimal("3"), UserAccountRecordSourceTypeEnum.type2, otherParam); + // 支付元宝 + userAccountService.consume(user.getId(),config.getPromotionConditions1(), UserAccountRecordSourceTypeEnum.type2, otherParam); } @Override public Map promoteGrade2Progress(Long userId) { - Map map = new HashMap<>(); - map.put("condition1", false); + // 获取配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade2); + Map map = new LinkedHashMap<>(); + map.put("conditionTarget1", config.getPromotionConditions1()); + map.put("conditionTarget2", config.getPromotionConditions2()); + map.put("condition1", false); // 条件一(支付3元宝) Map accountRecordParam = new HashMap<>(); accountRecordParam.put("userId", userId); @@ -124,7 +135,12 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { @Override public Map promoteGrade3Progress(Long userId) { - Map map = new HashMap<>(); + // 获取配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade3); + Map map = new LinkedHashMap<>(); + map.put("conditionTarget1", config.getPromotionConditions1()); + map.put("conditionTarget2", config.getPromotionConditions2()); + map.put("conditionTarget3", config.getPromotionConditions3()); Map param = new HashMap<>(); param.put("parentUserId", userId); @@ -145,7 +161,12 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { @Override public Map promoteGrade4Progress(Long userId) { - Map map = new HashMap<>(); + // 获取配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade4); + Map map = new LinkedHashMap<>(); + map.put("conditionTarget1", config.getPromotionConditions1()); + map.put("conditionTarget2", config.getPromotionConditions2()); + map.put("conditionTarget3", config.getPromotionConditions3()); Map param = new HashMap<>(); param.put("parentUserId", userId); @@ -175,6 +196,9 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { boolean payCondition = false; boolean profitCondition = false; + // 获取等级晋升配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade2); + // 完成进度 Map map = promoteGrade2Progress(user.getId()); @@ -184,7 +208,7 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { } // 条件二(元宝收益达到5元宝) - if (new BigDecimal(MapUtils.getString(map, "condition2")).compareTo(new BigDecimal("5")) >= 1) { + if (new BigDecimal(MapUtils.getString(map, "condition2")).compareTo(config.getPromotionConditions2()) >= 1) { profitCondition = true; } // 满足其中条件一项 @@ -202,19 +226,22 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { boolean nonDirect = false; // 非直属 boolean profitCondition = false; // 元宝收益 + // 获取等级晋升配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade3); + // 完成进度 Map map = promoteGrade3Progress(user.getId()); // 条件一(直属正式会员达到30人) - if (MapUtils.getInteger(map, "condition1") >= 30) { + if (MapUtils.getInteger(map, "condition1") >= config.getPromotionConditions1().intValue()) { directlyUnder = true; } // 条件二(非直属正式会员达到100人) - if (MapUtils.getInteger(map, "condition2") >= 100) { + if (MapUtils.getInteger(map, "condition2") >= config.getPromotionConditions2().intValue()) { nonDirect = true; } // 条件三(累计元宝收益达到100元宝) - if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(new BigDecimal("100")) >= 1) { + if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(config.getPromotionConditions3()) >= 1) { profitCondition = true; } // 满足全部条件 @@ -232,19 +259,22 @@ public class BsUserGradeServiceImpl implements BsUserGradeService { boolean nonDirect = false; // 非直属 boolean profitCondition = false; // 元宝收益 + // 获取等级晋升配置 + BsUserGradeConfig config = userGradeConfigService.getConfig(UserGradeEnum.grade4); + // 完成进度 Map map = promoteGrade3Progress(user.getId()); // 条件一(直属团长达到100人) - if (MapUtils.getInteger(map, "condition1") >= 100) { + if (MapUtils.getInteger(map, "condition1") >= config.getPromotionConditions1().intValue()) { directlyUnder = true; } // 条件二(非直属团长达到300人) - if (MapUtils.getInteger(map, "condition2") >= 300) { + if (MapUtils.getInteger(map, "condition2") >= config.getPromotionConditions2().intValue()) { nonDirect = true; } // 条件三(累计元宝收益达到10000元宝) - if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(new BigDecimal("10000")) >= 1) { + if (new BigDecimal(MapUtils.getString(map, "condition3")).compareTo(config.getPromotionConditions3()) >= 1) { profitCondition = true; } return (directlyUnder && nonDirect && profitCondition); diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserPlatformAuthorizeServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserPlatformAuthorizeServiceImpl.java new file mode 100644 index 0000000..e290e5b --- /dev/null +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserPlatformAuthorizeServiceImpl.java @@ -0,0 +1,38 @@ +package com.hfkj.service.user.impl; + +import com.hfkj.dao.BsUserPlatformAuthorizeMapper; +import com.hfkj.entity.BsUserPlatformAuthorize; +import com.hfkj.service.user.BsUserPlatformAuthorizeService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @className: BsUserPlatformAuthorizeServiceImpl + * @author: HuRui + * @date: 2024/11/6 + **/ +@Service("userPlatformAuthorizeService") +public class BsUserPlatformAuthorizeServiceImpl implements BsUserPlatformAuthorizeService { + @Resource + private BsUserPlatformAuthorizeMapper userPlatformAuthorizeMapper; + + @Override + public void edit(BsUserPlatformAuthorize data) { + data.setUpdateTime(new Date()); + if (data.getId() == null) { + data.setStatus(1); + data.setCreateTime(new Date()); + userPlatformAuthorizeMapper.insert(data); + } else { + userPlatformAuthorizeMapper.updateByPrimaryKey(data); + } + } + + @Override + public List getUserAuth(Long userId) { + return null; + } +} diff --git a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java index 539f5e6..eab4c6f 100644 --- a/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/user/impl/BsUserServiceImpl.java @@ -11,10 +11,7 @@ import com.hfkj.dao.BsUserMapper; import com.hfkj.entity.*; import com.hfkj.model.UserSessionObject; import com.hfkj.service.user.*; -import com.hfkj.sysenum.user.UserAccountStatusEnum; -import com.hfkj.sysenum.user.UserGradeEnum; -import com.hfkj.sysenum.user.UserLoginType; -import com.hfkj.sysenum.user.UserStatusEnum; +import com.hfkj.sysenum.user.*; import org.apache.catalina.User; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -54,6 +51,8 @@ public class BsUserServiceImpl implements BsUserService { private BsUserParentRelService userParentRelService; @Resource private BsUserGradeService userGradeService; + @Resource + private BsUserPlatformAuthorizeService userPlatformAuthorizeService; private final static String CACHE_KEY = "USER"; /** @@ -298,6 +297,16 @@ public class BsUserServiceImpl implements BsUserService { editData(bsUser); // 创建账户余额 userAccountService.create(bsUser.getId()); + + // 授权信息 + BsUserPlatformAuthorize authorize = new BsUserPlatformAuthorize(); + authorize.setUserId(user.getId()); + authorize.setPlatformCode(UserAuthorizePlatformEnum.type2.getType()); + authorize.setPlatformName(UserAuthorizePlatformEnum.type2.getName()); + authorize.setAvatar(user.getHeadImg()); + authorize.setNickName(user.getName()); + authorize.setOpenId(user.getWechatOpenId()); + userPlatformAuthorizeService.edit(authorize); } else { bsUser.setHeadImg(user.getHeadImg()); bsUser.setName(user.getName()); diff --git a/service/src/main/java/com/hfkj/sysenum/user/UserAuthorizePlatformEnum.java b/service/src/main/java/com/hfkj/sysenum/user/UserAuthorizePlatformEnum.java new file mode 100644 index 0000000..e1f1fca --- /dev/null +++ b/service/src/main/java/com/hfkj/sysenum/user/UserAuthorizePlatformEnum.java @@ -0,0 +1,29 @@ +package com.hfkj.sysenum.user; + +import lombok.Getter; + +/** + * 用户账户记录来源 + * @author hurui + */ +@Getter +public enum UserAuthorizePlatformEnum { + /** + * 支付宝 + */ + type1(1 , "支付宝"), + /** + * 微信 + */ + type2(2 , "微信"), + ; + + private Integer type; + private String name; + + UserAuthorizePlatformEnum(int type , String name) { + this.type = type; + this.name = name; + } + +}