| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.user.UserCustomSettingsException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | | import com.yeshi.fanli.vo.user.UserSettingsVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | |
| | | * 设置界面开关状态
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param type 1-通知免打扰(20:00-8:00) 2-不看消息红点提醒 3-不看奖金统计 不看邀请拿奖金 4-不看分享记录和选品库 不看消息红点提醒 |
| | | * @param state 0关闭 1开启
|
| | | * @param params
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "setModuleState", method = RequestMethod.POST)
|
| | | public void setModuleState(AcceptData acceptData, Long uid, Integer type, Integer state, PrintWriter out) {
|
| | | public void setModuleState(AcceptData acceptData, Long uid, String params, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | userCustomSettingsService.saveModuleState(uid, type, state);
|
| | | if (params == null || params.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("传递参数为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject json = JSONObject.fromObject(params);
|
| | | Iterator<String> iterator = json.keys();
|
| | | while(iterator.hasNext()){
|
| | | String type = (String) iterator.next();
|
| | | int state = json.getInt(type);
|
| | | userCustomSettingsService.saveModuleState(uid, type, state);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult("设置成功"));
|
| | | |
| | | } catch (UserCustomSettingsException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取等级信息
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRankInfo", method = RequestMethod.POST)
|
| | | public void getRankInfo(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | |
| | | UserInfoExtraVO rankInfo = userInfoExtraService.getRankInfo(uid);
|
| | | |
| | | GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
|
| | | gsonBuilder.excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy.MM.dd").create();
|
| | | |
| | | JSONObject resultData = new JSONObject();
|
| | | resultData.put("rankInfo", gson.toJson(rankInfo));
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | | |
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | List<Map<String, Object>> countOrderNumber( @Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | |
| | | /** |
| | | * 奖金统计 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Map<String, Object> countOrderNumberBySettleTime(@Param("uid")Long uid, @Param("state")Integer state, |
| | | @Param("day")Integer day); |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra; |
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO; |
| | | |
| | | public interface UserInfoExtraMapper extends BaseMapper<UserInfoExtra> { |
| | | |
| | | /** |
| | | * 获取用户附加信息 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserInfoExtra getInfoExtraByUid(Long uid); |
| | | |
| | | /** |
| | | * 获取用户附加信息等其他信息 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserInfoExtraVO getInfoExtraVOByUid(Long uid); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserRank; |
| | | |
| | | public interface UserRankMapper extends BaseMapper<UserRank> { |
| | | |
| | | List<UserRank> getAllRank(); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserRankRecord; |
| | | |
| | | public interface UserRankRecordMapper extends BaseMapper<UserRankRecord> { |
| | | |
| | | } |
| | |
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 订单-简版
|
| | | * |
| | | * @author yj
|
| | | * 用户app界面个性化设置
|
| | | * @author Administrator
|
| | | *
|
| | | * @date 2018年12月23日
|
| | | */
|
| | |
|
| | | @Table("yeshi_ec_user_custom_settings")
|
| | | public class UserCustomSettings {
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | /**
|
| | | * 用户附加信息
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_info_extra")
|
| | | public class UserInfoExtra {
|
| | |
|
| | | @Column(name = "uie_id")
|
| | | private Long id;
|
| | |
|
| | | // 用户id
|
| | | @Expose
|
| | | @Column(name = "uie_uid")
|
| | | private UserInfo userInfo;
|
| | | |
| | | // 等级id
|
| | | @Expose
|
| | | @Column(name = "uie_rank_id")
|
| | | private UserRank userRank;
|
| | |
|
| | | // 等级来源:返利、分享、邀请
|
| | | @Column(name = "uie_rank_source")
|
| | | private Integer rankSource;
|
| | | |
| | | // 等级判断订单数量
|
| | | @Column(name = "uie_rank_order_num")
|
| | | private Integer rankOrderNum;
|
| | | |
| | | // 等级更新时间
|
| | | @Expose
|
| | | @Column(name = "uie_rank_update_time")
|
| | | private Date rankUpdateTime;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "uie_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | // 更新时间
|
| | | @Column(name = "uie_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public UserRank getUserRank() {
|
| | | return userRank;
|
| | | }
|
| | |
|
| | | public void setUserRank(UserRank userRank) {
|
| | | this.userRank = userRank;
|
| | | }
|
| | |
|
| | | public Date getRankUpdateTime() {
|
| | | return rankUpdateTime;
|
| | | }
|
| | |
|
| | | public void setRankUpdateTime(Date rankUpdateTime) {
|
| | | this.rankUpdateTime = rankUpdateTime;
|
| | | }
|
| | |
|
| | | 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 UserInfo getUserInfo() {
|
| | | return userInfo;
|
| | | }
|
| | |
|
| | | public void setUserInfo(UserInfo userInfo) {
|
| | | this.userInfo = userInfo;
|
| | | }
|
| | |
|
| | | public Integer getRankSource() {
|
| | | return rankSource;
|
| | | }
|
| | |
|
| | | public void setRankSource(Integer rankSource) {
|
| | | this.rankSource = rankSource;
|
| | | }
|
| | |
|
| | | public Integer getRankOrderNum() {
|
| | | return rankOrderNum;
|
| | | }
|
| | |
|
| | | public void setRankOrderNum(Integer rankOrderNum) {
|
| | | this.rankOrderNum = rankOrderNum;
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | /**
|
| | | * 用户等级
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_rank")
|
| | | public class UserRank {
|
| | | |
| | | @Column(name = "ur_id")
|
| | | private Long id;
|
| | |
|
| | | // 名称
|
| | | @Expose
|
| | | @Column(name = "ur_name")
|
| | | private String name;
|
| | |
|
| | | // 图片
|
| | | @Expose
|
| | | @Column(name = "ur_picture")
|
| | | private String picture;
|
| | | |
| | | // 皇冠图片
|
| | | @Expose
|
| | | @Column(name = "ur_icon")
|
| | | private String icon;
|
| | |
|
| | | // 返利订单数量
|
| | | @Expose
|
| | | @Column(name = "ur_rebate_num")
|
| | | private Integer rebateNum;
|
| | | |
| | | // 分享订单数量
|
| | | @Expose
|
| | | @Column(name = "ur_share_num")
|
| | | private Integer shareNum;
|
| | | |
| | | // 邀请订单数量
|
| | | @Expose
|
| | | @Column(name = "ur_invite_num")
|
| | | private Integer inviteNum;
|
| | |
|
| | | // 排序字段
|
| | | @Column(name = "ur_orderby")
|
| | | private Integer orderby;
|
| | | |
| | | // 创建时间
|
| | | @Column(name = "ur_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | // 更新时间
|
| | | @Column(name = "ur_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getName() {
|
| | | return name;
|
| | | }
|
| | |
|
| | | public void setName(String name) {
|
| | | this.name = name;
|
| | | }
|
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
| | |
|
| | | public void setPicture(String picture) {
|
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public Integer getRebateNum() {
|
| | | return rebateNum;
|
| | | }
|
| | |
|
| | | public void setRebateNum(Integer rebateNum) {
|
| | | this.rebateNum = rebateNum;
|
| | | }
|
| | |
|
| | | public Integer getShareNum() {
|
| | | return shareNum;
|
| | | }
|
| | |
|
| | | public void setShareNum(Integer shareNum) {
|
| | | this.shareNum = shareNum;
|
| | | }
|
| | |
|
| | | public Integer getInviteNum() {
|
| | | return inviteNum;
|
| | | }
|
| | |
|
| | | public void setInviteNum(Integer inviteNum) {
|
| | | this.inviteNum = inviteNum;
|
| | | }
|
| | |
|
| | | 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 Integer getOrderby() {
|
| | | return orderby;
|
| | | }
|
| | |
|
| | | public void setOrderby(Integer orderby) {
|
| | | this.orderby = orderby;
|
| | | }
|
| | |
|
| | | public String getIcon() {
|
| | | return icon;
|
| | | }
|
| | |
|
| | | public void setIcon(String icon) {
|
| | | this.icon = icon;
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 用户等级记录
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_user_rank_record")
|
| | | public class UserRankRecord {
|
| | |
|
| | | @Column(name = "urd_id")
|
| | | private Long id;
|
| | |
|
| | | // 用户id
|
| | | @Column(name = "urd_uid")
|
| | | private Long uid;
|
| | |
|
| | | // 等级id
|
| | | @Column(name = "urd_rank_id")
|
| | | private Long rankId;
|
| | |
|
| | | // 创建时间
|
| | | @Column(name = "urd_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Long getRankId() {
|
| | | return rankId;
|
| | | }
|
| | |
|
| | | public void setRankId(Long rankId) {
|
| | | this.rankId = rankId;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.user; |
| | | |
| | | public class UserInfoExtraException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public UserInfoExtraException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public UserInfoExtraException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
| | |
| | | ORDER BY t.`co_create_time` |
| | | </select> |
| | | |
| | | |
| | | <select id="countOrderNumberBySettleTime" resultType="java.util.HashMap"> |
| | | <!-- 统计历史订单数量 根据结算时间 --> |
| | | SELECT SUM(A.self)AS totalSelf,SUM(A.shared)AS totalShared,SUM(A.invite)AS totalInvite |
| | | FROM ( |
| | | <!-- 返利订单 --> |
| | | SELECT IFNULL(COUNT(ho_id),0) AS self,0 AS shared,0 AS invite |
| | | FROM (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND (v2.`hb_type` = 1 OR v2.`hb_type` = 2) |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` <!-- 自购订单 --> |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <if test="state != null"> |
| | | AND co.`co_state` = ${state} |
| | | </if> |
| | | |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_settle_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.co_settle_time) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(co.`co_settle_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)YX |
| | | |
| | | UNION ALL |
| | | <!-- 分享订单 --> |
| | | SELECT 0 AS self,IFNULL(COUNT(ho_id),0) AS shared,0 AS invite |
| | | FROM (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} AND v2.`hb_type` = 20 |
| | | ) hb ON hb.hb_id=ho.`ho_hongbao_id` <!-- 分享订单 --> |
| | | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <if test="state != null"> |
| | | AND co.`co_state` = ${state} |
| | | </if> |
| | | |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_settle_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_settle_time`) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(co.`co_settle_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)WQ |
| | | |
| | | UNION ALL |
| | | <!-- 邀请订单 --> |
| | | SELECT 0 AS self,0 AS shared,IFNULL(COUNT(ho_id),0) AS invite |
| | | FROM (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho |
| | | LEFT JOIN ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_uid`= ${uid} |
| | | AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 |
| | | OR v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) |
| | | ) hbp ON hbp.hb_pid=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hbp.hb_id IS NOT NULL |
| | | <if test="state != null"> |
| | | AND co.`co_state` = ${state} |
| | | </if> |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_settle_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_settle_time`) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(co.`co_settle_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)SX |
| | | )A |
| | | </select> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserInfoExtraMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserInfoExtra"> |
| | | <id column="uie_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="userInfo" column="uie_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="uie_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="userRank" column="uie_rank_id" javaType="com.yeshi.fanli.entity.bus.user.UserRank"> |
| | | <id column="uie_rank_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <resultMap id="VOResultMap" type="com.yeshi.fanli.vo.user.UserInfoExtraVO"> |
| | | <id column="uie_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="uie_rank_source" property="rankSource" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_order_num" property="rankOrderNum" jdbcType="INTEGER"/> |
| | | <result column="uie_rank_update_time" property="rankUpdateTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="uie_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <association property="userInfo" column="uie_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> |
| | | |
| | | <association property="userRank" column="uie_rank_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.user.UserRankMapper.BaseResultMap"/> |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_create_time,uie_update_time</sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_info_extra where uie_id = #{id,jdbcType=BIGINT}</delete> |
| | | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra (uie_id,uie_uid,uie_rank_id,uie_rank_source,uie_rank_order_num,uie_rank_update_time,uie_create_time,uie_update_time) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{userRank.id,jdbcType=BIGINT},#{rankSource,jdbcType=INTEGER},#{rankOrderNum,jdbcType=INTEGER},#{rankUpdateTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_info_extra |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">uie_id,</if> |
| | | <if test="userInfo != null">uie_uid,</if> |
| | | <if test="userRank != null">uie_rank_id,</if> |
| | | <if test="rankSource != null">uie_rank_source,</if> |
| | | <if test="rankOrderNum != null">uie_rank_order_num,</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time,</if> |
| | | <if test="createTime != null">uie_create_time,</if> |
| | | <if test="updateTime != null">uie_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="userRank != null">#{userRank.id,jdbcType=BIGINT},</if> |
| | | <if test="rankSource != null">#{rankSource,jdbcType=INTEGER},</if> |
| | | <if test="rankOrderNum != null">#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra set uie_uid = #{userInfo.id,jdbcType=BIGINT},uie_rank_id = #{userRank.id,jdbcType=BIGINT},uie_rank_source = #{rankSource,jdbcType=INTEGER},uie_rank_order_num = #{rankOrderNum,jdbcType=INTEGER},uie_rank_update_time = #{rankUpdateTime,jdbcType=TIMESTAMP},uie_create_time = #{createTime,jdbcType=TIMESTAMP},uie_update_time = #{updateTime,jdbcType=TIMESTAMP} where uie_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfoExtra">update yeshi_ec_user_info_extra |
| | | <set> |
| | | <if test="userInfo != null">uie_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="userRank != null">uie_rank_id=#{userRank.id,jdbcType=BIGINT},</if> |
| | | <if test="rankSource != null">uie_rank_source=#{rankSource,jdbcType=INTEGER},</if> |
| | | <if test="rankOrderNum != null">uie_rank_order_num=#{rankOrderNum,jdbcType=INTEGER},</if> |
| | | <if test="rankUpdateTime != null">uie_rank_update_time=#{rankUpdateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">uie_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">uie_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where uie_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getInfoExtraByUid" resultMap="BaseResultMap"> |
| | | SELECT * |
| | | FROM yeshi_ec_user_info_extra |
| | | WHERE uie_uid = #{uid} |
| | | </select> |
| | | |
| | | <select id="getInfoExtraVOByUid" resultMap="VOResultMap"> |
| | | SELECT u.`id`,u.`nick_name`,u.`portrait`,ue.*,rk.* |
| | | FROM yeshi_ec_user_info_extra ue |
| | | LEFT JOIN yeshi_ec_user u ON ue.`uie_uid` = u.`id` |
| | | LEFT JOIN yeshi_ec_user_rank rk ON rk.`ur_id` = ue.`uie_rank_id` |
| | | WHERE u.id = #{uid} |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserRankMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserRank"> |
| | | <id column="ur_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="ur_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="ur_picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="ur_icon" property="icon" jdbcType="VARCHAR"/> |
| | | <result column="ur_rebate_num" property="rebateNum" jdbcType="INTEGER"/> |
| | | <result column="ur_share_num" property="shareNum" jdbcType="INTEGER"/> |
| | | <result column="ur_invite_num" property="inviteNum" jdbcType="INTEGER"/> |
| | | <result column="ur_orderby" property="orderby" jdbcType="INTEGER"/> |
| | | <result column="ur_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="ur_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">ur_id,ur_name,ur_picture,ur_icon,ur_rebate_num,ur_share_num,ur_invite_num,ur_orderby,ur_create_time,ur_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_rank where ur_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_rank where ur_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserRank" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_rank (ur_id,ur_name,ur_picture,ur_icon,ur_rebate_num,ur_share_num,ur_invite_num,ur_orderby,ur_create_time,ur_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{rebateNum,jdbcType=INTEGER},#{shareNum,jdbcType=INTEGER},#{inviteNum,jdbcType=INTEGER},#{orderby,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRank" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_rank |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ur_id,</if> |
| | | <if test="name != null">ur_name,</if> |
| | | <if test="picture != null">ur_picture,</if> |
| | | <if test="icon != null">ur_icon,</if> |
| | | <if test="rebateNum != null">ur_rebate_num,</if> |
| | | <if test="shareNum != null">ur_share_num,</if> |
| | | <if test="inviteNum != null">ur_invite_num,</if> |
| | | <if test="orderby != null">ur_orderby,</if> |
| | | <if test="createTime != null">ur_create_time,</if> |
| | | <if test="updateTime != null">ur_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="rebateNum != null">#{rebateNum,jdbcType=INTEGER},</if> |
| | | <if test="shareNum != null">#{shareNum,jdbcType=INTEGER},</if> |
| | | <if test="inviteNum != null">#{inviteNum,jdbcType=INTEGER},</if> |
| | | <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserRank">update yeshi_ec_user_rank set ur_name = #{name,jdbcType=VARCHAR},ur_picture = #{picture,jdbcType=VARCHAR},ur_icon = #{icon,jdbcType=VARCHAR},ur_rebate_num = #{rebateNum,jdbcType=INTEGER},ur_share_num = #{shareNum,jdbcType=INTEGER},ur_invite_num = #{inviteNum,jdbcType=INTEGER},ur_orderby = #{orderby,jdbcType=INTEGER},ur_create_time = #{createTime,jdbcType=TIMESTAMP},ur_update_time = #{updateTime,jdbcType=TIMESTAMP} where ur_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRank">update yeshi_ec_user_rank |
| | | <set> |
| | | <if test="name != null">ur_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">ur_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">ur_icon=#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="rebateNum != null">ur_rebate_num=#{rebateNum,jdbcType=INTEGER},</if> |
| | | <if test="shareNum != null">ur_share_num=#{shareNum,jdbcType=INTEGER},</if> |
| | | <if test="inviteNum != null">ur_invite_num=#{inviteNum,jdbcType=INTEGER},</if> |
| | | <if test="orderby != null">ur_orderby=#{orderby,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">ur_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">ur_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where ur_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <select id="getAllRank" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List"/>from yeshi_ec_user_rank ORDER BY ur_orderby |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.user.UserRankRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.UserRankRecord"> |
| | | <id column="urd_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="urd_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="urd_rank_id" property="rankId" jdbcType="BIGINT"/> |
| | | <result column="urd_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">urd_id,urd_uid,urd_rank_id,urd_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_rank_record where urd_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_rank_record where urd_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_rank_record (urd_id,urd_uid,urd_rank_id,urd_create_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{rankId,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_rank_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">urd_id,</if> |
| | | <if test="uid != null">urd_uid,</if> |
| | | <if test="rankId != null">urd_rank_id,</if> |
| | | <if test="createTime != null">urd_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="rankId != null">#{rankId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord">update yeshi_ec_user_rank_record set urd_uid = #{uid,jdbcType=BIGINT},urd_rank_id = #{rankId,jdbcType=BIGINT},urd_create_time = #{createTime,jdbcType=TIMESTAMP} where urd_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserRankRecord">update yeshi_ec_user_rank_record |
| | | <set> |
| | | <if test="uid != null">urd_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="rankId != null">urd_rank_id=#{rankId,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">urd_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where urd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Map<String, Object> countOrderNumberBySettleTime(Long uid, Integer state, Integer day) {
|
| | | return commonOrderCountMapper.countOrderNumberBySettleTime(uid, state, day);
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 根据结算时间筛选 上个月已结算的订订单数量
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public Map<String, Object> lastMonthSettleOrderNumber(Long uid) {
|
| | | return countOrderNumberBySettleTime(uid, 2, 4); // 根据
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | private UserCustomSettingsMapper userCustomSettingsMapper;
|
| | |
|
| | | @Override
|
| | | public void saveModuleState(Long uid, Integer type, Integer state) throws UserCustomSettingsException{
|
| | | public void saveModuleState(Long uid, String type, Integer state) throws UserCustomSettingsException{
|
| | | if (uid == null || type == null || state == null || state > 1 || state < 0) {
|
| | | throw new UserCustomSettingsException(1, "传递参数不正确");
|
| | | }
|
| | |
|
| | | String typeNum = null;
|
| | | UserSettingTypeEnum mineTypeNum = null;
|
| | |
|
| | | switch(type) {
|
| | | case 1:
|
| | | typeNum = UserSettingTypeEnum.cancelNotice.name();
|
| | | mineTypeNum = UserSettingTypeEnum.cancelNotice;
|
| | | break;
|
| | | case 2:
|
| | | typeNum = UserSettingTypeEnum.noNewsRedDot.name();
|
| | | mineTypeNum = UserSettingTypeEnum.noNewsRedDot;
|
| | | break;
|
| | | case 3:
|
| | | typeNum = UserSettingTypeEnum.noBonusCount.name();
|
| | | mineTypeNum = UserSettingTypeEnum.noBonusCount;
|
| | | break;
|
| | | case 4:
|
| | | typeNum = UserSettingTypeEnum.noShareRecordAndStorage.name();
|
| | | mineTypeNum = UserSettingTypeEnum.noShareRecordAndStorage;
|
| | | break;
|
| | | case 5:
|
| | | typeNum = UserSettingTypeEnum.noInvitationBonus.name();
|
| | | mineTypeNum = UserSettingTypeEnum.noInvitationBonus;
|
| | | break;
|
| | | default:
|
| | | throw new UserCustomSettingsException(1, "参数类型不匹配"); |
| | | UserSettingTypeEnum mineTypeNum = null;
|
| | | if (type.equals(UserSettingTypeEnum.cancelNotice.name())) {
|
| | | mineTypeNum = UserSettingTypeEnum.cancelNotice;
|
| | | } else if (type.equals(UserSettingTypeEnum.noNewsRedDot.name())) {
|
| | | mineTypeNum = UserSettingTypeEnum.noNewsRedDot;
|
| | | } else if (type.equals(UserSettingTypeEnum.noBonusCount.name())) {
|
| | | mineTypeNum = UserSettingTypeEnum.noBonusCount;
|
| | | } else if (type.equals(UserSettingTypeEnum.noShareRecordAndStorage.name())) {
|
| | | mineTypeNum = UserSettingTypeEnum.noShareRecordAndStorage;
|
| | | } else if (type.equals(UserSettingTypeEnum.noInvitationBonus.name())) {
|
| | | mineTypeNum = UserSettingTypeEnum.noInvitationBonus;
|
| | | } else {
|
| | | throw new UserCustomSettingsException(1, "参数类型不匹配"); |
| | | }
|
| | |
|
| | | UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid, typeNum);
|
| | | if (settings == null) { // 插入
|
| | | |
| | | UserCustomSettings settings = userCustomSettingsMapper.getSettingsByUidAndType(uid, type);
|
| | | if (settings != null) { |
| | | // 更新
|
| | | UserCustomSettings record = new UserCustomSettings();
|
| | | record.setId(settings.getId());
|
| | | record.setState(state);
|
| | | record.setUpdateTime(new Date());
|
| | | userCustomSettingsMapper.updateByPrimaryKeySelective(record);
|
| | | } else { |
| | | // 插入
|
| | | settings = new UserCustomSettings();
|
| | | settings.setState(state);
|
| | | settings.setType(mineTypeNum);
|
| | |
| | | settings.setUpdateTime(new Date());
|
| | | settings.setCreateTime(new Date());
|
| | | userCustomSettingsMapper.insertSelective(settings);
|
| | | } else { // 更新
|
| | | UserCustomSettings record = new UserCustomSettings();
|
| | | record.setId(settings.getId());
|
| | | record.setState(state);
|
| | | record.setType(mineTypeNum);
|
| | | record.setUpdateTime(new Date());
|
| | | userCustomSettingsMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserInfoExtraMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserRankRecordMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRankRecord;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderCountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class UserInfoExtraServiceImpl implements UserInfoExtraService {
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraMapper userInfoExtraMapper;
|
| | | |
| | | @Resource
|
| | | private UserRankRecordMapper userRankRecordMapper;
|
| | |
|
| | | @Resource
|
| | | private UserRankService userRankService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Override
|
| | | public UserInfoExtraVO getRankInfo(Long uid) throws UserInfoExtraException, Exception {
|
| | |
|
| | | UserInfoExtraVO extraVO = userInfoExtraMapper.getInfoExtraVOByUid(uid);
|
| | | if (extraVO == null) {
|
| | | throw new UserInfoExtraException(1, "用户附加信息不存在");
|
| | | }
|
| | |
|
| | | // 等级列表
|
| | | List<UserRank> listRank = userRankService.getAllRank();
|
| | | if (listRank == null || listRank.size() == 0) {
|
| | | throw new UserInfoExtraException(1, "系统等级不存在");
|
| | | }
|
| | | extraVO.setListRank(listRank);
|
| | |
|
| | | // 特别提醒
|
| | | String rankTip = configService.get("user_rank_tip");
|
| | | extraVO.setRankTip(rankTip);
|
| | |
|
| | | Integer rankOrderNum = extraVO.getRankOrderNum();
|
| | | if (rankOrderNum != null && rankOrderNum > 0) {
|
| | | String rankMsg = null;
|
| | | Integer rankSource = extraVO.getRankSource();
|
| | | switch (rankSource) {
|
| | | case Constant.TYPE_REBATE:
|
| | | rankMsg = "返利订单";
|
| | | break;
|
| | | case Constant.TYPE_SHAER:
|
| | | rankMsg = "分享订单";
|
| | | break;
|
| | | case Constant.TYPE_INVITE:
|
| | | rankMsg = "邀请订单";
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | |
|
| | | List<Object> listMsg = new ArrayList<Object>();
|
| | |
|
| | | if (rankMsg != null) {
|
| | | String color_red = "#E5005C";
|
| | | String color_black = "#333333";
|
| | |
|
| | | Map<String, String> map1 = new HashMap<String, String>();
|
| | | map1.put("content", "上月");
|
| | | map1.put("color", color_black);
|
| | | listMsg.add(map1);
|
| | |
|
| | | Map<String, String> map2 = new HashMap<String, String>();
|
| | | map2.put("content", rankMsg);
|
| | | map2.put("color", color_red);
|
| | | listMsg.add(map2);
|
| | |
|
| | | Map<String, String> map3 = new HashMap<String, String>();
|
| | | map3.put("content", "达到了");
|
| | | map3.put("color", color_black);
|
| | | listMsg.add(map3);
|
| | |
|
| | | Map<String, String> map4 = new HashMap<String, String>();
|
| | | map4.put("content", rankOrderNum + "");
|
| | | map4.put("color", color_red);
|
| | | listMsg.add(map4);
|
| | |
|
| | | Map<String, String> map5 = new HashMap<String, String>();
|
| | | map5.put("content", "单");
|
| | | map5.put("color", color_black);
|
| | | listMsg.add(map5);
|
| | | extraVO.setGalaMsg(listMsg);
|
| | | }
|
| | | }
|
| | |
|
| | | return extraVO;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserInfoExtra updateUserRankByUid(Long uid) throws UserInfoExtraException{
|
| | | |
| | | boolean isupdateRank = true;
|
| | | |
| | | UserInfoExtra userInfoExtra = userInfoExtraMapper.getInfoExtraByUid(uid);
|
| | | if (userInfoExtra != null && userInfoExtra.getId() != null) {
|
| | | // 判断当月是否已更新
|
| | | Date rankUpdateTime = userInfoExtra.getRankUpdateTime();
|
| | | if (rankUpdateTime != null && DateUtil.isSameMonth(rankUpdateTime, new Date())) {
|
| | | isupdateRank = false;
|
| | | } |
| | | } else {
|
| | | userInfoExtra = new UserInfoExtra();
|
| | | userInfoExtra.setUserInfo(new UserInfo(uid));
|
| | | }
|
| | | |
| | | // 更新等级
|
| | | if (isupdateRank) {
|
| | | updateRank(userInfoExtra);
|
| | | }
|
| | | |
| | | return userInfoExtra;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public UserInfoExtra updateRank(UserInfoExtra userInfoExtra) throws UserInfoExtraException {
|
| | | UserInfo userInfo = userInfoExtra.getUserInfo();
|
| | | if (userInfo == null ) {
|
| | | throw new UserInfoExtraException(1, "用户不存在");
|
| | | }
|
| | | |
| | | Long uid = userInfo.getId();
|
| | | if (uid == null ) {
|
| | | throw new UserInfoExtraException(1, "用户ID不存在");
|
| | | } |
| | | |
| | | List<UserRank> listRank = userRankService.getAllRank();
|
| | | if (listRank == null || listRank.size() == 0) {
|
| | | throw new UserInfoExtraException(1, "系统等级不存在");
|
| | | }
|
| | |
|
| | | int selfOrderNum = 0;
|
| | | int sharedOrderNum = 0;
|
| | | int inviteOrderNum = 0;
|
| | | Map<String, Object> map = commonOrderCountService.lastMonthSettleOrderNumber(uid);
|
| | | if (map != null) {
|
| | | // 返利订单
|
| | | if (map.get("totalSelf") != null) {
|
| | | selfOrderNum = Integer.parseInt(map.get("totalSelf").toString());
|
| | | }
|
| | |
|
| | | // 分享订单
|
| | | if (map.get("totalShared") != null) {
|
| | | sharedOrderNum = Integer.parseInt(map.get("totalShared").toString());
|
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | if (map.get("totalInvite") != null) {
|
| | | inviteOrderNum = Integer.parseInt(map.get("totalInvite").toString());
|
| | | }
|
| | | }
|
| | |
|
| | | UserRank rank = null;
|
| | | for (UserRank userRank : listRank) {
|
| | | // 邀请满足
|
| | | Integer inviteNum = userRank.getInviteNum();
|
| | | if (inviteOrderNum >= inviteNum) {
|
| | | rank = userRank;
|
| | | userInfoExtra.setRankOrderNum(inviteOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_INVITE);
|
| | | }
|
| | |
|
| | | // 分享满足
|
| | | int shareNum = userRank.getShareNum();
|
| | | if (sharedOrderNum >= shareNum) {
|
| | | rank = userRank;
|
| | | userInfoExtra.setRankOrderNum(sharedOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_SHAER);
|
| | | }
|
| | |
|
| | | // 返利满足
|
| | | int directNum = userRank.getRebateNum();
|
| | | if (selfOrderNum >= directNum) {
|
| | | rank = userRank;
|
| | | userInfoExtra.setRankOrderNum(selfOrderNum);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_REBATE);
|
| | | }
|
| | |
|
| | | |
| | | if (rank != null) {
|
| | | userInfoExtra.setUserRank(rank);
|
| | | } else {
|
| | | rank = userRank;
|
| | | // 默认最低等级:青铜
|
| | | userInfoExtra.setUserRank(rank);
|
| | | userInfoExtra.setRankOrderNum(0);
|
| | | userInfoExtra.setRankSource(Constant.TYPE_REBATE);
|
| | | break;
|
| | | }
|
| | | }
|
| | | // 等级更新时间
|
| | | userInfoExtra.setRankUpdateTime(new Date());
|
| | | // 保存信息并返回
|
| | | saveUserInfoExtra(userInfoExtra);
|
| | | |
| | | UserRankRecord userRankRecord = new UserRankRecord();
|
| | | userRankRecord.setUid(uid);
|
| | | userRankRecord.setRankId(rank.getId());
|
| | | userRankRecord.setCreateTime(new Date());
|
| | | userRankRecordMapper.insertSelective(userRankRecord);
|
| | | |
| | | return userInfoExtra;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserInfoExtra saveUserInfoExtra(UserInfoExtra userInfoExtra) throws UserInfoExtraException {
|
| | |
|
| | | if (userInfoExtra == null) {
|
| | | throw new UserInfoExtraException(1, "附加信息不能为空");
|
| | | }
|
| | |
|
| | | Long extraId = userInfoExtra.getId();
|
| | | if (extraId != null) {
|
| | | userInfoExtra.setUpdateTime(new Date());
|
| | | userInfoExtraMapper.updateByPrimaryKeySelective(userInfoExtra);
|
| | | } else {
|
| | | UserInfo userInfo = userInfoExtra.getUserInfo();
|
| | | if (userInfo == null || userInfo.getId() == null) {
|
| | | throw new UserInfoExtraException(1, "用户不存在");
|
| | | }
|
| | |
|
| | | Long uid = userInfo.getId();
|
| | | UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
|
| | | if (extra != null && extra.getId() != null) {
|
| | | userInfoExtra.setId(extra.getId());
|
| | | userInfoExtra.setUpdateTime(new Date());
|
| | | userInfoExtraMapper.updateByPrimaryKeySelective(userInfoExtra);
|
| | | } else {
|
| | | userInfoExtra.setCreateTime(new Date());
|
| | | userInfoExtra.setUpdateTime(new Date());
|
| | | userInfoExtraMapper.insertSelective(userInfoExtra);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | return userInfoExtra;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.UserRankMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankService;
|
| | |
|
| | | @Service
|
| | | public class UserRankServiceImpl implements UserRankService {
|
| | | |
| | | @Resource
|
| | | private UserRankMapper userRankMapper;
|
| | | |
| | | @Override
|
| | | public List<UserRank> getAllRank(){
|
| | | return userRankMapper.getAllRank();
|
| | | }
|
| | | }
|
| | |
| | | public List<Map<String, Object>> countWeiQaunOrderNumber(Integer dateType, String year, String startTime, String endTime)
|
| | | throws Exception;
|
| | |
|
| | | /**
|
| | | * 根据结算时间统计
|
| | | * @param uid
|
| | | * @param state
|
| | | * @param day
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public Map<String, Object> countOrderNumberBySettleTime(Long uid, Integer state, Integer day);
|
| | |
|
| | | /**
|
| | | * 根据结算时间筛选 上个月已结算的订订单数量
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public Map<String, Object> lastMonthSettleOrderNumber(Long uid);
|
| | |
|
| | |
|
| | | }
|
| | |
| | | * @param state
|
| | | * @throws UserCustomSettingsException
|
| | | */
|
| | | public void saveModuleState(Long uid, Integer typeNum, Integer state) throws UserCustomSettingsException;
|
| | | public void saveModuleState(Long uid, String type, Integer state) throws UserCustomSettingsException;
|
| | |
|
| | |
|
| | | /**
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | | public interface UserInfoExtraService {
|
| | |
|
| | | /**
|
| | | * 获取用户等级一级其他附加信息
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public UserInfoExtraVO getRankInfo(Long uid) throws UserInfoExtraException, Exception;
|
| | |
|
| | | /**
|
| | | * 保存用户额外信息-新增或更新
|
| | | * @param userInfoExtra
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public UserInfoExtra saveUserInfoExtra(UserInfoExtra userInfoExtra) throws UserInfoExtraException;
|
| | |
|
| | | /**
|
| | | * 更新用户等级
|
| | | * @param uid 用户id
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public UserInfoExtra updateUserRankByUid(Long uid) throws UserInfoExtraException;
|
| | |
|
| | | /**
|
| | | * 根据订单更新
|
| | | * @param userInfoExtra
|
| | | * @return
|
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public UserInfoExtra updateRank(UserInfoExtra userInfoExtra) throws UserInfoExtraException;
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | |
|
| | | public interface UserRankService {
|
| | |
|
| | | /**
|
| | | * 获取所有等级
|
| | | * @return
|
| | | */
|
| | | public List<UserRank> getAllRank();
|
| | | |
| | | }
|
| | |
| | | public class Constant {
|
| | | public static boolean IS_TASK = false;
|
| | | // 外网环境
|
| | | public static boolean IS_OUTNET = true;
|
| | | public static boolean IS_OUTNET = false;
|
| | |
|
| | | public static boolean IS_TEST = false;
|
| | | public static boolean IS_TEST = true;
|
| | |
|
| | | public static int PAGE_SIZE = 20;
|
| | | public static int[] TASK_TYPE = { 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008// 微信任务类型编号
|
| | |
| | | public static final String MYLIKE = "mylike";
|
| | | public static final String MYDYNAMIC = "mydynamic";
|
| | |
|
| | | // 来源
|
| | | |
| | | // 来源-淘宝
|
| | | public static final int SOURCE_TYPE_TAOBAO = 1;
|
| | | // 来源-京东
|
| | | public static final int SOURCE_TYPE_JD = 2;
|
| | | |
| | | // 自购-返利
|
| | | public static final int TYPE_REBATE= 1;
|
| | | // 分享
|
| | | public static final int TYPE_SHAER = 2;
|
| | | // 邀请
|
| | | public static final int TYPE_INVITE = 3;
|
| | | |
| | | |
| | |
|
| | | public static WXGZConfig wxGZConfig;
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.vo.user;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | |
|
| | | public class UserInfoExtraVO extends UserInfoExtra implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | |
| | | // 系统等级列表
|
| | | @Expose
|
| | | private List<UserRank> listRank;
|
| | | // 系统特别提醒
|
| | | @Expose
|
| | | private String rankTip;
|
| | | // 等级返回恭喜
|
| | | @Expose
|
| | | private List<Object> galaMsg;
|
| | | |
| | | // 返利数量
|
| | | private int orderNumSelf;
|
| | | // 分享数量
|
| | | private int orderNumShared;
|
| | | // 邀请数量
|
| | | private int orderNumInvite;
|
| | |
|
| | | public List<Object> getGalaMsg() {
|
| | | return galaMsg;
|
| | | }
|
| | |
|
| | | public void setGalaMsg(List<Object> galaMsg) {
|
| | | this.galaMsg = galaMsg;
|
| | | }
|
| | |
|
| | | public List<UserRank> getListRank() {
|
| | | return listRank;
|
| | | }
|
| | |
|
| | | public void setListRank(List<UserRank> listRank) {
|
| | | this.listRank = listRank;
|
| | | }
|
| | |
|
| | | public int getOrderNumSelf() {
|
| | | return orderNumSelf;
|
| | | }
|
| | |
|
| | | public void setOrderNumSelf(int orderNumSelf) {
|
| | | this.orderNumSelf = orderNumSelf;
|
| | | }
|
| | |
|
| | | public int getOrderNumShared() {
|
| | | return orderNumShared;
|
| | | }
|
| | |
|
| | | public void setOrderNumShared(int orderNumShared) {
|
| | | this.orderNumShared = orderNumShared;
|
| | | }
|
| | |
|
| | | public int getOrderNumInvite() {
|
| | | return orderNumInvite;
|
| | | }
|
| | |
|
| | | public void setOrderNumInvite(int orderNumInvite) {
|
| | | this.orderNumInvite = orderNumInvite;
|
| | | }
|
| | |
|
| | | public String getRankTip() {
|
| | | return rankTip;
|
| | | }
|
| | |
|
| | | public void setRankTip(String rankTip) {
|
| | | this.rankTip = rankTip;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return false;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 验证是否属于同一天
|
| | | * |
| | | * @param Date1
|
| | | * @param Date2
|
| | | * @return
|
| | | */
|
| | | public static boolean isSameMonth(Date date1, Date date2) {
|
| | | if (date1 != null && date2 != null) {
|
| | | Calendar cal1 = Calendar.getInstance();
|
| | | cal1.setTime(date1);
|
| | | Calendar cal2 = Calendar.getInstance();
|
| | | cal2.setTime(date2);
|
| | | return isSameMonth(cal1, cal2);
|
| | | } else {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 验证是否属于同年同月
|
| | | * |
| | | * @param cal1
|
| | | * @param cal2
|
| | | * @return
|
| | | */
|
| | | public static boolean isSameMonth(Calendar cal1, Calendar cal2) {
|
| | | if (cal1 != null && cal2 != null) {
|
| | | return cal1.get(0) == cal2.get(0) && cal1.get(1) == cal2.get(1) && cal1.get(6) == cal2.get(6);
|
| | | } else {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 指定日期加上天数后的日期
|