fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java
@@ -17,6 +17,7 @@ import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum; import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState; import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; import com.yeshi.fanli.entity.common.JumpDetailV2; import com.yeshi.fanli.entity.config.AppHomeFloatImg; import com.yeshi.fanli.entity.taobao.ClientTBPid; @@ -30,13 +31,16 @@ import com.yeshi.fanli.service.inter.user.TBPidService; import com.yeshi.fanli.service.inter.user.UserActiveLogService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; import com.yeshi.fanli.util.AESUtil; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TaoBaoConstant; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.jd.JDUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.vo.homemodule.FloatImgDetailVO; import net.sf.json.JSONObject; @@ -80,6 +84,12 @@ @Resource private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService; @Resource private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; @Resource private RedisManager redisManager; /** * s 首页配置信息 @@ -167,9 +177,10 @@ for (int i = 0; i < listAD.size(); i++) { FloatAD floatAD = listAD.get(i); FloatADTypeEnum typeEnum = floatAD.getTypeEnum(); if (typeEnum == FloatADTypeEnum.newUserRedPack && (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()) if (typeEnum == FloatADTypeEnum.newUserRedPack && (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()) || !userTaoLiJinNewbiesService.verifyHasReward(uid, acceptData.getDevice()))) { listAD.remove(i); i--; continue; @@ -480,9 +491,30 @@ */ @RequestMapping(value = "getElemeLink") public void getElemeLink(AcceptData acceptData, Long uid, String callback, PrintWriter out) { UserExtraTaoBaoInfo userInfoExtra = userExtraTaoBaoInfoService.getByUid(uid); if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getRelationId())) { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "请绑定淘宝"))); return; } String elmeLink = redisManager.getCommonString("elme-link-" + uid); if (StringUtil.isNullOrEmpty(elmeLink)) { elmeLink = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3], "1571715733668", userInfoExtra.getRelationId()); if (!StringUtil.isNullOrEmpty(elmeLink)) { redisManager.cacheCommonString("elme-link-" + uid, elmeLink, 60 * 60);// 缓存1个小时 } } JSONObject data = new JSONObject(); data.put("hongBao", configService.get("eleme_hongbao_link").replace("{用户ID}", uid + "")); data.put("goods", configService.get("eleme_goods_link").replace("{用户ID}", uid + "")); // data.put("hongBao", // configService.get("eleme_hongbao_link").replace("{用户ID}", uid + "")); // data.put("goods", // configService.get("eleme_goods_link").replace("{用户ID}", uid + "")); data.put("hongBao", elmeLink); data.put("goods", elmeLink); ClientTBPid clientTBPid1 = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_ELEME_PID, null, TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3]); fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -361,7 +361,8 @@ GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); goodsDetail.getMoneyInfo().setShareMoney("¥"+ TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPShareRate())); goodsDetail.getMoneyInfo().setShareMoney( "¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPShareRate())); } if (TaoBaoUtil.isYUShou(goods)) { @@ -519,8 +520,10 @@ RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1 = new JSONObject(); if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) params1.put("url", configService.get("special_guide_reward_coupon_link")); else params1.put("url", configService.get("vip_link")); rewardCoupon .setMaxMoney("¥" + TaoBaoUtil.getGoodsHongBaoMoney(goods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { @@ -615,7 +618,8 @@ GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); goodsDetail.getMoneyInfo().setShareMoney("¥"+ JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPShareRate())); goodsDetail.getMoneyInfo() .setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPShareRate())); } // 附加信息 @@ -654,7 +658,10 @@ rewardCoupon.setMaxMoneyPlus(maxMoneyPlus); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1 = new JSONObject(); if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) params1.put("url", configService.get("special_guide_reward_coupon_link")); else params1.put("url", configService.get("vip_link")); rewardCoupon.setMaxMoney("¥" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPFanLiRate())); if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { @@ -807,7 +814,8 @@ GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) { goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney()); goodsDetail.getMoneyInfo().setShareMoney("¥"+ PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPShareRate())); goodsDetail.getMoneyInfo().setShareMoney( "¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPShareRate())); } // 附加信息 @@ -815,7 +823,10 @@ RewardCouponVO rewardCoupon = new RewardCouponVO(); rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); JSONObject params1 = new JSONObject(); if (!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) params1.put("url", configService.get("special_guide_reward_coupon_link")); else params1.put("url", configService.get("vip_link")); rewardCoupon .setMaxMoney("¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPFanLiRate())); fanli/src/main/java/com/yeshi/fanli/dao/mybatis/homemodule/AdActivityVersionControlMapper.java
New file @@ -0,0 +1,40 @@ package com.yeshi.fanli.dao.mybatis.homemodule; import java.util.List; import com.yeshi.fanli.dao.BaseMapper; import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl; import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType; public interface AdActivityVersionControlMapper extends BaseMapper<AdActivityVersionControl> { /** * 根据内容ID与版本ID查询 * * @param sourceId * @param type * @param versionId * @return */ AdActivityVersionControl selectBySourceIdAndTypeAndVersion(Long sourceId, AdActivityType type, Long versionId); /** * * @param type * @param sourceId * @return */ List<AdActivityVersionControl> listByTypeAndSourceId(AdActivityType type, Long sourceId); /** * 根据内容与版本ID检索 * * @param sourceIdList * @param type * @param appVersionId * @return */ List<AdActivityVersionControl> listByVersionAndSourceId(List<Long> sourceIdList, AdActivityType type, Long appVersionId); } fanli/src/main/java/com/yeshi/fanli/entity/AppVersionInfo.java
@@ -15,6 +15,7 @@ public class AppVersionInfo { public final static String PLATFORM_ANDROID = "android"; public final static String PLATFORM_IOS = "ios"; public final static String PLATFORM_XCX = "小程序"; @Column(name = "avcm_id") private Long id; fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/AdActivityVersionControl.java
New file @@ -0,0 +1,74 @@ package com.yeshi.fanli.entity.bus.homemodule; import java.util.Date; import org.yeshi.utils.mybatis.Column; import org.yeshi.utils.mybatis.Table; import com.yeshi.fanli.entity.AppVersionInfo; /** * 广告活动版本控制(包含 Banner与专题) * * @author Administrator * */ @Table("yeshi_ec_ad_activity_version_control") public class AdActivityVersionControl { public enum AdActivityType { banner// 轮播图 , special// 专题 } @Column(name = "vc_id") private Long id; @Column(name = "vc_type") private AdActivityType type;// 广告活动类型 @Column(name = "vc_source_id") private Long sourceId;// 轮播图ID或者专题Id @Column(name = "vc_version") private AppVersionInfo version;// 版本号 @Column(name = "vc_create_time") private Date createTime; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public AdActivityType getType() { return type; } public void setType(AdActivityType type) { this.type = type; } public Long getSourceId() { return sourceId; } public void setSourceId(Long sourceId) { this.sourceId = sourceId; } public AppVersionInfo getVersion() { return version; } public void setVersion(AppVersionInfo version) { this.version = version; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } } fanli/src/main/java/com/yeshi/fanli/entity/order/UserOrderWeiQuanRecord.java
New file @@ -0,0 +1,98 @@ package com.yeshi.fanli.entity.order; import java.math.BigDecimal; import java.util.Date; import org.yeshi.utils.mybatis.Column; import org.yeshi.utils.mybatis.Table; /** * 用户订单维权记录(包含返利,分享,邀请) * * @author Administrator * */ @Table("yeshi_ec_user_order_weiquan_record") public class UserOrderWeiQuanRecord { @Column(name = "wr_id") private Long id; @Column(name = "wr_source_type") private Integer sourceType; @Column(name = "wr_trade_id") private String tradeId; @Column(name = "wr_uid") private Long uid; @Column(name = "wr_money") private BigDecimal money; @Column(name = "wr_state") private Integer state;// 0-未扣款 1-已扣款 @Column(name = "wr_create_time") private Date createTime; @Column(name = "wr_update_time") private Date updateTime; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getSourceType() { return sourceType; } public void setSourceType(Integer sourceType) { this.sourceType = sourceType; } public String getTradeId() { return tradeId; } public void setTradeId(String tradeId) { this.tradeId = tradeId; } public Long getUid() { return uid; } public void setUid(Long uid) { this.uid = uid; } public BigDecimal getMoney() { return money; } public void setMoney(BigDecimal money) { this.money = money; } public Integer getState() { return state; } public void setState(Integer state) { this.state = state; } 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; } } fanli/src/main/java/com/yeshi/fanli/mapping/homemodule/AdActivityVersionControlMapper.xml
New file @@ -0,0 +1,70 @@ <?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.homemodule.AdActivityVersionControlMapper"> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl"> <id column="vc_id" property="id" jdbcType="BIGINT" /> <result column="vc_type" property="type" jdbcType="VARCHAR" /> <result column="vc_source_id" property="sourceId" jdbcType="BIGINT" /> <result column="vc_version" property="version" jdbcType="VARCHAR" /> <result column="vc_create_time" property="createTime" jdbcType="TIMESTAMP" /> </resultMap> <sql id="Base_Column_List">vc_id,vc_type,vc_source_id,vc_version,vc_create_time</sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_ad_activity_version_control where vc_id = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_ad_activity_version_control where vc_id = #{id,jdbcType=BIGINT}</delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_ad_activity_version_control (vc_id,vc_type,vc_source_id,vc_version,vc_create_time) values (#{id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{sourceId,jdbcType=BIGINT},#{version,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl" useGeneratedKeys="true" keyProperty="id"> insert into yeshi_ec_ad_activity_version_control <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">vc_id,</if> <if test="type != null">vc_type,</if> <if test="sourceId != null">vc_source_id,</if> <if test="version != null">vc_version,</if> <if test="createTime != null">vc_create_time,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="type != null">#{type,jdbcType=VARCHAR},</if> <if test="sourceId != null">#{sourceId,jdbcType=BIGINT},</if> <if test="version != null">#{version,jdbcType=VARCHAR},</if> <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl">update yeshi_ec_ad_activity_version_control set vc_type = #{type,jdbcType=VARCHAR},vc_source_id = #{sourceId,jdbcType=BIGINT},vc_version = #{version,jdbcType=VARCHAR},vc_create_time = #{createTime,jdbcType=TIMESTAMP} where vc_id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl"> update yeshi_ec_ad_activity_version_control <set> <if test="type != null">vc_type=#{type,jdbcType=VARCHAR},</if> <if test="sourceId != null">vc_source_id=#{sourceId,jdbcType=BIGINT},</if> <if test="version != null">vc_version=#{version,jdbcType=VARCHAR},</if> <if test="createTime != null">vc_create_time=#{createTime,jdbcType=TIMESTAMP},</if> </set> where vc_id = #{id,jdbcType=BIGINT} </update> </mapper> fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -24,6 +24,7 @@ <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> <result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" /> <result column="co_urank" property="urank" jdbcType="INTEGER" /> <association property="userInfo" column="co_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> <id column="co_uid" property="id" jdbcType="BIGINT" /> @@ -56,6 +57,7 @@ <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> <result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" /> <result column="co_urank" property="urank" jdbcType="INTEGER" /> <association property="userInfo" column="co_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> <id column="co_uid" property="id" jdbcType="BIGINT" /> @@ -97,23 +99,16 @@ <result column="userId" property="userId" jdbcType="VARCHAR" /> <result column="userName" property="userName" jdbcType="VARCHAR" /> <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" /> <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" /> <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> <result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" /> <result column="co_uid" property="userId" jdbcType="VARCHAR" /> <result column="co_urank" property="urank" jdbcType="INTEGER" /> <association property="userInfo" column="co_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" /> <association property="commonOrderGoods" column="co_order_goods_id" resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" /> </resultMap> <resultMap id="ThreeResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> <id column="co_id" property="id" jdbcType="BIGINT" /> <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> @@ -151,30 +146,25 @@ <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" /> <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> <result column="co_state_desc" property="stateDesc" jdbcType="VARCHAR" /> <result column="co_urank" property="urank" jdbcType="INTEGER" /> <association property="userInfo" column="co_uid" select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPrimaryKey" /> <association property="commonOrderGoods" column="co_order_goods_id" select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey" /> </resultMap> <resultMap id="OrderCountMap" type="com.yeshi.fanli.vo.order.OrderCountVO" > <result column="self" property="self" jdbcType="BIGINT" /> <result column="shared" property="shared" jdbcType="BIGINT" /> <result column="invite" property="invite" jdbcType="BIGINT" /> </resultMap> <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id,co_state_desc <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id,co_state_desc,co_urank </sql> <sql id="Order_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position, co_order_goods_id,co_count,co_state,co_state_whole_order, co_estimate,co_eIncome,co_payment,co_settlement, co_third_create_time, MAX(co_settle_time) AS co_settle_time, co_order_by, co_create_time, co_update_time,co_state_desc </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> select @@ -198,68 +188,42 @@ yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and co_order_no=#{orderNo} </select> <select id="selectBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * FROM yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and co_trade_id=#{tradeId} limit 1 FROM yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and co_trade_id=#{tradeId} limit 1 </select> <select id="listBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * FROM <select id="listBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * FROM yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and co_trade_id=#{tradeId} </select> <select id="listBySourceTypeAndTradeIdList" resultMap="BaseResultMap"> SELECT * FROM yeshi_ec_common_order co WHERE SELECT * FROM yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} <if test="tradeIdList!=null"> <foreach collection="tradeIdList" item="tradeId" open=" and (" close=")" separator=" or "> co.co_trade_id=#{tradeId} </foreach> close=")" separator=" or ">co.co_trade_id=#{tradeId}</foreach> </if> </select> <select id="listBySourceTypeAndStateAndThirdCrateTime" resultMap="BaseResultMap"> SELECT * FROM yeshi_ec_common_order co WHERE SELECT * FROM yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} <if test="state!=null"> and co_state=#{state} <if test="state!=null">and co_state=#{state}</if> <if test="minTime!=null">and UNIX_TIMESTAMP(co_third_create_time)*1000>=#{minTime}</if> <if test="maxTime!=null">and #{maxTime}> UNIX_TIMESTAMP(co_third_create_time)*1000 </if> <if test="minTime!=null"> and UNIX_TIMESTAMP(co_third_create_time)*1000>=#{minTime} </if> <if test="maxTime!=null"> and #{maxTime}> UNIX_TIMESTAMP(co_third_create_time)*1000 </if> order by co_id desc limit #{start},#{count} order by co_id desc limit #{start},#{count} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id,co_state_desc) (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id,co_state_desc,co_urank) values (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{stateDesc,jdbcType=VARCHAR}) (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{stateDesc,jdbcType=VARCHAR},#{urank,jdbcType=INTEGER}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder" useGeneratedKeys="true" keyProperty="id"> @@ -285,6 +249,7 @@ <if test="updateTime != null">co_update_time,</if> <if test="tradeId != null">co_trade_id,</if> <if test="stateDesc != null">co_state_desc,</if> <if test="urank != null">co_urank,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> @@ -307,7 +272,8 @@ <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if> <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR}</if> <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if> <if test="urank != null">#{urank,jdbcType=INTEGER}</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update @@ -330,7 +296,8 @@ #{createTime,jdbcType=TIMESTAMP},co_update_time = #{updateTime,jdbcType=TIMESTAMP} ,co_trade_id =#{tradeId,jdbcType=VARCHAR},co_state_desc =#{stateDesc,jdbcType=VARCHAR} where co_id = #{id,jdbcType=BIGINT} =#{stateDesc,jdbcType=VARCHAR} ,co_urank =#{urank,jdbcType=INTEGER} where co_id = #{id,jdbcType=BIGINT} </update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder"> update yeshi_ec_common_order @@ -359,6 +326,7 @@ <if test="id !=null">co_id =#{id,jdbcType=BIGINT},</if> <if test="tradeId !=null">co_trade_id =#{tradeId,jdbcType=VARCHAR},</if> <if test="stateDesc !=null">co_state_desc =#{stateDesc,jdbcType=VARCHAR},</if> <if test="urank !=null">co_urank =#{urank,jdbcType=INTEGER},</if> </set> where co_id = #{id,jdbcType=BIGINT} </update> @@ -396,33 +364,43 @@ </if> <if test="day == 3 or day == 10"> <!-- 本月 --> AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> <if test="day == 4"> <!-- 上月 --> AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 </if> <if test="day == 6"> <!-- 上月 --> AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1 AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1 </if> <if test="day == 11"> <!-- 近3个月产生 --> AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 3 MONTH) AND NOW() <if test="day == 11"> <!-- 近3个月产生 --> AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 3 MONTH) AND NOW() </if> <if test="day == 12"> <!-- 近半年产生 --> AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 6 MONTH) AND NOW() <if test="day == 12"> <!-- 近半年产生 --> AND co.`co_third_create_time` BETWEEN DATE_SUB(NOW(),INTERVAL 6 MONTH) AND NOW() </if> </sql> <sql id="SELECT_PARAM_HONGBAO_TYPE"> <if test="type != null and type == 1"> <!-- 自购订单 --> <if test="type != null and type == 1"> <!-- 自购订单 --> AND (v2.hb_type =1 or v2.hb_type =2) </if> <if test="type != null and type == 2"> <!-- 分享订单 --> <if test="type != null and type == 2"> <!-- 分享订单 --> AND v2.`hb_type` = 20 </if> <if test="type != null and type == 3"> <!-- 邀请订单 --> 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) <if test="type != null and type == 3"> <!-- 邀请订单 --> 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) </if> </sql> <sql id="SELECT_PARAM_HONGBAO_STATE"> @@ -442,26 +420,26 @@ <sql id="Hongbao_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_type,hb_state,hb_pre_get_time,hb_get_time,hb_version, IF(v2.`hb_state` = 4, 0, v2.hb_money)AS hb_money </sql> <select id="listUserOrder" resultMap="ResultMap"> <!-- 查询用户订单 --> SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, <include refid="Order_Column_List" /> FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT <include refid="Hongbao_Column_List" /> FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> <include refid="SELECT_PARAM_HONGBAO_TYPE" /> <if test="type == 2 and day == 5"> <!-- 本月月将要到账分享订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') <if test="type == 2 and day == 5"> <!-- 本月月将要到账分享订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> <if test="type == 3 and day == 5"> <!-- 本月将要到账邀请订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') <if test="type == 3 and day == 5"> <!-- 本月将要到账邀请订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> <!-- 红包类型 --> )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` @@ -475,26 +453,27 @@ <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} </select> <select id="countUserOrder" resultType="java.lang.Long"> <!-- 统计用户订单数量 --> SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT <include refid="Hongbao_Column_List" /> FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> <include refid="SELECT_PARAM_HONGBAO_TYPE" /> <!-- 红包类型 --> <if test="type == 2 and day == 5"> <!-- 本月月将要到账分享订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') <include refid="SELECT_PARAM_HONGBAO_TYPE" /> <!-- 红包类型 --> <if test="type == 2 and day == 5"> <!-- 本月月将要到账分享订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> <if test="type == 3 and day == 5"> <!-- 本月将要到账邀请订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') <if test="type == 3 and day == 5"> <!-- 本月将要到账邀请订单 --> AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 @@ -507,7 +486,6 @@ <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type` )A </select> <select id="listOrderGoodsInfo" resultMap="ResultMap" @@ -525,8 +503,6 @@ </foreach> GROUP BY tc.`co_order_no`,tc.`co_order_goods_id` </select> <select id="countHistoryOrder" resultType="java.util.HashMap"> <!-- 统计历史订单数量 --> SELECT SUM(A.self)AS totalSelf,SUM(A.shared)AS @@ -560,11 +536,7 @@ </if> <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)YX UNION ALL 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 * @@ -593,11 +565,7 @@ </if> <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)WQ UNION ALL 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 * @@ -627,64 +595,64 @@ </if> <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A </select> <sql id="OrderCountQuery"> WHERE co.`co_state_whole_order`<![CDATA[<>]]>3 <if test="day == 1"> <!-- 今天 --> <sql id="OrderCountQuery">WHERE co.`co_state_whole_order`<![CDATA[<>]]>3 <if test="day == 1"> <!-- 今天 --> AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) </if> <if test="day == 2"> <!-- 昨天 --> <if test="day == 2"> <!-- 昨天 --> AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1 </if> <if test="day == 3"> <!-- 本月 --> AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') <if test="day == 3"> <!-- 本月 --> AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> <if test="day == 4"> <!-- 上月 --> AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 <if test="day == 4"> <!-- 上月 --> AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_settle_time`, '%Y%m')) = 1 </if> <!-- 订单来源 --> <if test="source != null and source != 0">AND co.co_source_type = #{source}</if> </sql> <select id="getOrderCount" resultMap="OrderCountMap"> SELECT sum(self) as self,sum(shared) as shared,sum(invite) as invite from ( SELECT IFNULL(COUNT(co_order_no),0)AS self,0 AS shared,0 AS invite FROM (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 1)v2 LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` <include refid="OrderCountQuery"></include> GROUP BY co.`co_order_no`,co.`co_source_type`)A UNION ALL SELECT 0 AS self,IFNULL(COUNT(co_order_no),0)AS shared,0 AS invite FROM (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 20)v2 LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` <include refid="OrderCountQuery"></include> GROUP BY co.`co_order_no`,co.`co_source_type`)A UNION ALL SELECT 0 AS self,0 AS shared,IFNULL(COUNT(co_order_no),0)AS invite FROM (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22))v2 LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` <include refid="OrderCountQuery"></include> GROUP BY co.`co_order_no`,co.`co_source_type`)A )B SELECT sum(self) as self,sum(shared) as shared,sum(invite) as invite from ( SELECT IFNULL(COUNT(co_order_no),0)AS self,0 AS shared,0 AS invite FROM (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 1)v2 LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` <include refid="OrderCountQuery" /> GROUP BY co.`co_order_no`,co.`co_source_type`)A UNION ALL SELECT 0 AS self,IFNULL(COUNT(co_order_no),0)AS shared,0 AS invite FROM (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND v.`hb_type` = 20)v2 LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` <include refid="OrderCountQuery" /> GROUP BY co.`co_order_no`,co.`co_source_type`)A UNION ALL SELECT 0 AS self,0 AS shared,IFNULL(COUNT(co_order_no),0)AS invite FROM (SELECT co.`co_order_no` FROM (SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`= ${uid} AND (v.`hb_type` = 5 OR v.`hb_type` = 6 OR v.`hb_type` = 7 OR v.`hb_type` = 21 OR v.`hb_type` = 22))v2 LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id` = IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid) LEFT JOIN yeshi_ec_common_order co ON co.`co_id` = ho.`ho_order_id` <include refid="OrderCountQuery" /> GROUP BY co.`co_order_no`,co.`co_source_type`)A )B </select> <select id="countUserOrderToApp" resultType="Long"> <!-- 有效订单 --> SELECT IFNULL(COUNT(ho_id),0) 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} SELECT IFNULL(COUNT(ho_id),0) 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} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> <if test="state != null and state == 1"> <!-- 未到账 --> @@ -701,71 +669,51 @@ ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 <![CDATA[AND co.`co_state` <> 3]]> <if test="stateOrder == 1"> <!-- 有效订单 --> <if test="stateOrder == 1"> <!-- 有效订单 --> AND (co.`co_state_whole_order` =1 OR co.`co_state_whole_order` = 2) </if> <if test="stateOrder == 2"> <!-- 维权订单 --> <if test="stateOrder == 2"> <!-- 维权订单 --> AND co.`co_state` = 3 </if> <if test="stateOrder == 3"> <!-- 失效订单 --> <if test="stateOrder == 3"> <!-- 失效订单 --> AND co.`co_state_whole_order` = 3 </if> <!-- 订单时间 --> <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type` )A GROUP BY co.`co_order_no`, co.`co_source_type` )A </select> <!-- <select id="countByUidAndOrderState" resultType="java.util.HashMap"> SELECT SUM(A.valid)AS totalValid, SUM(A.proces)AS totalProces,SUM(A.Invalid)AS totalInvite FROM ( 有效订单 SELECT IFNULL(COUNT(ho_id),0) AS valid,0 AS proces,0 AS Invalid 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} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 <![CDATA[AND co.`co_state` <> 3]]> AND (co.`co_state_whole_order` =1 OR co.`co_state_whole_order` = 2) <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> 订单来源 <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)YX UNION ALL 维权订单 SELECT 0 AS valid,IFNULL(COUNT(ho_id),0) AS proces,0 AS Invalid 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} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 AND co.`co_state` = 3 <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> 订单来源 <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)WQ UNION ALL 失效订单 SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(ho_id),0) AS Invalid 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} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 AND co.`co_state_whole_order` = 3 <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> 订单来源 <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A </select> --> <!-- <select id="countByUidAndOrderState" resultType="java.util.HashMap"> SELECT SUM(A.valid)AS totalValid, SUM(A.proces)AS totalProces,SUM(A.Invalid)AS totalInvite FROM ( 有效订单 SELECT IFNULL(COUNT(ho_id),0) AS valid,0 AS proces,0 AS Invalid 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} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 <![CDATA[AND co.`co_state` <> 3]]> AND (co.`co_state_whole_order` =1 OR co.`co_state_whole_order` = 2) <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> 订单来源 <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)YX UNION ALL 维权订单 SELECT 0 AS valid,IFNULL(COUNT(ho_id),0) AS proces,0 AS Invalid 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} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 AND co.`co_state` = 3 <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> 订单来源 <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)WQ UNION ALL 失效订单 SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(ho_id),0) AS Invalid 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} <include refid="SELECT_PARAM_HONGBAO_TYPE" /> ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=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 AND co.`co_state_whole_order` = 3 <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> 订单来源 <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A </select> --> <select id="countBonusOrderNumber" resultType="java.lang.Long"> <!-- 奖金统计:订单数量 --> SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.`ho_id` FROM @@ -811,7 +759,8 @@ yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE hb.hb_id IS NOT NULL <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> <if test="day != null and day == 4">AND co.`co_state` = 2</if> <!-- 上月 :统计已收货 --> <if test="day != null and day == 4">AND co.`co_state` = 2</if> <!-- 上月 :统计已收货 --> <if test="source != null">AND co.co_source_type = #{source}</if> GROUP BY co.`co_order_no`, co.`co_source_type` )A </select> @@ -883,20 +832,17 @@ userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 <include refid="SELECT_PARAM_HONGBAO_TYPE" /> <!-- 红包类型 --> <include refid="SELECT_HONGBAO_STATE" /> <!-- 红包状态 --> )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` <if test="listShopId != null"> LEFT JOIN yeshi_ec_common_order_goods g ON co.`co_order_goods_id`=g.`cog_id` <if test="listShopId != null">LEFT JOIN yeshi_ec_common_order_goods g ON co.`co_order_goods_id`=g.`cog_id` </if> WHERE hb.hb_id IS NOT NULL <include refid="SELECT_PARAM_ORDER_STATE" /> <!-- 订单状态 --> @@ -911,39 +857,33 @@ <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> <if test="listGoodsId != null"> <foreach collection="listGoodsId" item="goodsId" open=" and (" separator=" or " close=")"> co.`co_order_goods_id` =#{goodsId} </foreach> <foreach collection="listGoodsId" item="goodsId" open=" and (" separator=" or " close=")">co.`co_order_goods_id` =#{goodsId}</foreach> </if> <if test="listShopId != null"> <foreach collection="listShopId" item="shopId" open=" and (" separator=" or " close=")"> g.`cog_shop_id` =#{shopId} </foreach> <foreach collection="listShopId" item="shopId" open=" and (" separator=" or " close=")">g.`cog_shop_id` =#{shopId}</foreach> </if> <if test="minTime != null"> <!-- 高风险订单 --> AND co.`co_third_create_time`>#{minTime} AND <![CDATA[ (co.`co_estimate`>= ${money} OR co.`co_eIncome`> ${money})]]> <if test="minTime != null"> <!-- 高风险订单 --> AND co.`co_third_create_time`>#{minTime} AND<![CDATA[ (co.`co_estimate`>= ${money} OR co.`co_eIncome`> ${money})]]> </if> ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT JOIN yeshi_ec_user u ON u.id = A.hb_uid </select> <select id="listQueryWithNoChild" resultMap="ThreeResultMap"> SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 <include refid="SELECT_PARAM_HONGBAO_TYPE" /> <!-- 红包类型 --> <include refid="SELECT_HONGBAO_STATE" /> <!-- 红包状态 --> )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 )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 <include refid="SELECT_PARAM_ORDER_STATE" /> <!-- 订单状态 --> <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> @@ -959,8 +899,6 @@ ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT JOIN yeshi_ec_user u ON u.id = A.hb_uid </select> <select id="countQuery" resultType="java.lang.Long"> SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 @@ -970,8 +908,8 @@ <!-- 红包状态 --> )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` <if test="listShopId != null"> LEFT JOIN yeshi_ec_common_order_goods g ON co.`co_order_goods_id`=g.`cog_id` <if test="listShopId != null">LEFT JOIN yeshi_ec_common_order_goods g ON co.`co_order_goods_id`=g.`cog_id` </if> WHERE hb.hb_id IS NOT NULL <include refid="SELECT_PARAM_ORDER_STATE" /> @@ -987,22 +925,18 @@ <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> <if test="listGoodsId != null"> <foreach collection="listGoodsId" item="goodsId" open=" and (" separator=" or " close=")"> co.`co_order_goods_id` =#{goodsId} </foreach> <foreach collection="listGoodsId" item="goodsId" open=" and (" separator=" or " close=")">co.`co_order_goods_id` =#{goodsId}</foreach> </if> <if test="listShopId != null"> <foreach collection="listShopId" item="shopId" open=" and (" separator=" or " close=")"> g.`cog_shop_id` =#{shopId} </foreach> <foreach collection="listShopId" item="shopId" open=" and (" separator=" or " close=")">g.`cog_shop_id` =#{shopId}</foreach> </if> <if test="minTime != null"> <!-- 高风险订单 --> AND co.`co_third_create_time`>#{minTime} AND <![CDATA[ (co.`co_estimate`>= ${money} OR co.`co_eIncome`> ${money})]]> <if test="minTime != null"> <!-- 高风险订单 --> AND co.`co_third_create_time`>#{minTime} AND<![CDATA[ (co.`co_estimate`>= ${money} OR co.`co_eIncome`> ${money})]]> </if> </select> <select id="countQueryWithNoChild" resultType="java.lang.Long"> SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 @@ -1010,10 +944,8 @@ <!-- 红包类型 --> <include refid="SELECT_HONGBAO_STATE" /> <!-- 红包状态 --> )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 )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 <include refid="SELECT_PARAM_ORDER_STATE" /> <!-- 订单状态 --> <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> @@ -1027,10 +959,6 @@ <!-- 订单来源 --> <if test="source != null">AND co.co_source_type = #{source}</if> </select> <select id="getCouponHongbaoByOrderNo" resultMap="ResultMap"> SELECT COALESCE(SUM(IF(hb.hb_type=1,hb.`hb_money`,0)),0)AS totalMoney, COALESCE(SUM(IF(hb.hb_type=10,hb.`hb_money`,0)),0)AS couponMoney, @@ -1064,76 +992,72 @@ </if> GROUP BY co.`co_order_no`, co.`co_source_type` </select> <select id="getByOrderNo" resultMap="BaseResultMap"> SELECT * FROM yeshi_ec_common_order co WHERE co_uid = #{uid} AND co_order_no=#{orderNo} <select id="getByOrderNo" resultMap="BaseResultMap">SELECT * FROM yeshi_ec_common_order co WHERE co_uid = #{uid} AND co_order_no=#{orderNo} </select> <select id="listByUid" resultMap="BaseResultMap"> SELECT * FROM yeshi_ec_common_order co WHERE co_uid = #{uid} SELECT * FROM yeshi_ec_common_order co WHERE co_uid = #{uid} <if test="stateList!=null"> <foreach collection="stateList" separator=" or " open="and (" item="state" close=")"> co_state=#{state} </foreach> item="state" close=")">co_state=#{state}</foreach> </if> limit #{start},#{count} </select> <select id="firstValidOrderByUid" resultMap="ResultMap"> SELECT co.*,v2.`hb_get_time` AS accountTime FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.hb_id IS NOT NULL AND v2.`hb_uid` = #{uid} AND v2.`hb_state` = 3 <if test="typeHB == 1"> <!-- 自购订单 --> SELECT co.*,v2.`hb_get_time` AS accountTime FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON IF(v2.hb_pid IS NULL,v2.hb_id,v2.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.hb_id IS NOT NULL AND v2.`hb_uid` = #{uid} AND v2.`hb_state` = 3 <if test="typeHB == 1"> <!-- 自购订单 --> AND (v2.hb_type =1 or v2.hb_type =2) </if> <if test="typeHB == 2"> <!-- 分享订单 --> <if test="typeHB == 2"> <!-- 分享订单 --> AND v2.`hb_type` = 20 </if> <if test="typeHB == 3"> <!-- 邀请订单 --> <if test="typeHB == 3"> <!-- 邀请订单 --> 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) </if> <if test="typeDate == 3"> <!-- 本月 --> AND DATE_FORMAT(co.`co_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') <if test="typeDate == 3"> <!-- 本月 --> AND DATE_FORMAT(co.`co_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') </if> <if test="typeDate == 4"> <!-- 上月 --> AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_create_time`, '%Y%m')) = 1 <if test="typeDate == 4"> <!-- 上月 --> AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'),DATE_FORMAT(co.`co_create_time`, '%Y%m')) = 1 </if> ORDER BY co.`co_id` LIMIT 1 ORDER BY co.`co_id` LIMIT 1 </select> <select id="getFirstShareOrderByUid" resultMap="BaseResultMap"> SELECT co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.`hb_uid` = #{uid} AND v2.`hb_type` = 20 ORDER BY co.`co_third_create_time` LIMIT 1 <select id="getFirstShareOrderByUid" resultMap="BaseResultMap">SELECT co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.`hb_uid` = #{uid} AND v2.`hb_type` = 20 ORDER BY co.`co_third_create_time` LIMIT 1 </select> <select id="getTotalRewardMoneyByOrderNoAndSourceType" resultType="BigDecimal"> SELECT SUM(hb_money) FROM(SELECT v2.`hb_money` FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.`hb_type` = 20 AND v2.`hb_state` = 3 AND co.`co_order_no` = #{orderNo} AND co.`co_source_type`= #{sourceType})A <select id="getTotalRewardMoneyByOrderNoAndSourceType" resultType="BigDecimal">SELECT SUM(hb_money) FROM(SELECT v2.`hb_money` FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.`hb_type` = 20 AND v2.`hb_state` = 3 AND co.`co_order_no` = #{orderNo} AND co.`co_source_type`= #{sourceType})A </select> <select id="count24HValidOrderByUid" resultType="Long"> SELECT IFNULL(COUNT(A.co_order_no),0) FROM (SELECT co.`co_order_no` FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.`hb_type` = 1 AND co.`co_state_whole_order`<![CDATA[<>]]> 3 AND co.`co_uid` = #{uid} AND co.co_third_create_time <![CDATA[>]]> #{minTime} AND co.`co_third_create_time` <![CDATA[<=]]> DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY co.`co_order_no`,co.`co_source_type`)A <select id="count24HValidOrderByUid" resultType="Long">SELECT IFNULL(COUNT(A.co_order_no),0) FROM (SELECT co.`co_order_no` FROM yeshi_ec_hongbao_order ho LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE v2.`hb_type` = 1 AND co.`co_state_whole_order`<![CDATA[<>]]> 3 AND co.`co_uid` = #{uid} AND co.co_third_create_time <![CDATA[>]]> #{minTime} AND co.`co_third_create_time` <![CDATA[<=]]> DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY co.`co_order_no`,co.`co_source_type`)A </select> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/AdActivityVersionControlServiceImpl.java
New file @@ -0,0 +1,69 @@ package com.yeshi.fanli.service.impl.homemodule; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.yeshi.fanli.dao.mybatis.homemodule.AdActivityVersionControlMapper; import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl; import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType; import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService; @Service public class AdActivityVersionControlServiceImpl implements AdActivityVersionControlService { @Resource private AdActivityVersionControlMapper adActivityVersionControlMapper; @Override public void addVersionControl(AdActivityVersionControl control) throws Exception { if (control == null || control.getSourceId() == null || control.getType() == null || control.getVersion() == null) throw new Exception("数据不完整"); AdActivityVersionControl oldControl = adActivityVersionControlMapper.selectBySourceIdAndTypeAndVersion( control.getSourceId(), control.getType(), control.getVersion().getId()); if (oldControl != null) throw new Exception("不能重复添加"); if (control.getCreateTime() == null) control.setCreateTime(new Date()); adActivityVersionControlMapper.insertSelective(control); } @Override public void deleteByPrimaryKey(Long id) { adActivityVersionControlMapper.deleteByPrimaryKey(id); } @Override public List<AdActivityVersionControl> listByTypeAndSourceId(AdActivityType type, Long sourceId) { if (type == null || sourceId == null) return null; return adActivityVersionControlMapper.listByTypeAndSourceId(type, sourceId); } @Override public List<Long> filterSourceIdByVersion(List<Long> sourceIdList, AdActivityType type, Long appVersionId) { if (sourceIdList == null || sourceIdList.size() == 0) return null; if (type == null || appVersionId == null) return null; List<AdActivityVersionControl> list = adActivityVersionControlMapper.listByVersionAndSourceId(sourceIdList, type, appVersionId); List<Long> resultList = new ArrayList<>(); if (list != null) for (AdActivityVersionControl control : list) if(control!=null&&control.getSourceId()!=null) resultList.add(control.getSourceId()); return resultList; } } fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java
@@ -52,6 +52,7 @@ import com.yeshi.fanli.service.inter.order.HongBaoOrderService; import com.yeshi.fanli.service.inter.order.HongBaoV2Service; import com.yeshi.fanli.service.inter.order.InviteOrderSubsidyService; import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService; import com.yeshi.fanli.service.inter.user.UserSystemCouponService; import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; @@ -121,6 +122,9 @@ @Resource private UserVIPInfoService userVIPInfoService; @Resource private UserInfoService userInfoService; // 奖励订单图片 public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png"; @@ -203,7 +207,6 @@ return listOrder; } /** * 订单信息加工 @@ -556,14 +559,14 @@ if (sourceType == null) { couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, null, uid, vip, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, acceptData); couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, uid, vip, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_JD) { couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, acceptData); couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, uid, vip, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_PDD) { couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip, acceptData); couponFactory(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, uid, vip, acceptData); } } @@ -576,7 +579,6 @@ } } /** * 订单: 免单标识 奖励标识 * @@ -586,8 +588,8 @@ * @param list * @param signList */ private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception{ private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData) throws Exception { // 是否免单商品 boolean freeOrder = false; @@ -804,7 +806,6 @@ rewardMap.put("jump", jump); order.setRewardDetail(rewardMap); } @Override public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day, Integer source) { @@ -1093,6 +1094,16 @@ if (oldCommonOrder == null)// 新增 { commonOrder.setCreateTime(new Date()); // 查询是否为vip boolean isVIP = userVIPInfoService.isVIP(commonOrder.getUserInfo().getId()); if (isVIP) commonOrder.setUrank(100);// VIP订单 else { UserInfo user = userInfoService.selectAvailableByPrimaryKey(commonOrder.getUserInfo().getId()); if (user != null) commonOrder.setUrank(user.getRank()); } commonOrderMapper.insertSelective(commonOrder); // 插入映射,保证交易ID的完整性 commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(), fanli/src/main/java/com/yeshi/fanli/service/impl/order/InviteOrderSubsidyServiceImpl.java
@@ -67,11 +67,6 @@ @Transactional private void addOrderSubsidy(InviteOrderSubsidy orderSubsidy) throws InviteOrderSubsidyException { // TODO 确定生效日期 机制2020年生效 if (System.currentTimeMillis() < TimeUtil.convertToTimeTemp("2020-01-01", "yyyy-MM-dd")&&!Constant.IS_TEST) { return; } if (orderSubsidy.getMoney() == null || StringUtil.isNullOrEmpty(orderSubsidy.getOrderNo()) || orderSubsidy.getSourceType() == null || orderSubsidy.getUid() == null) throw new InviteOrderSubsidyException(1, "数据不完整"); fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -51,6 +51,7 @@ import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig; import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack; import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder; import com.yeshi.fanli.exception.elme.ElmeOrderException; import com.yeshi.fanli.exception.money.OrderMoneySettleException; import com.yeshi.fanli.exception.money.UserMoneyDetailException; import com.yeshi.fanli.exception.order.CommonOrderException; @@ -202,6 +203,7 @@ Iterator<String> its = orders.keySet().iterator(); Map<String, List<TaoBaoOrder>> fanliOrderMap = new HashMap<>(); Map<String, List<TaoBaoOrder>> shareOrderMap = new HashMap<>(); Map<String, List<TaoBaoOrder>> elmeOrderMap = new HashMap<>(); while (its.hasNext()) { String orderId = its.next(); @@ -209,7 +211,12 @@ List<TaoBaoOrder> list = orders.get(orderId); String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), list.get(0).getSourceMediaId(), list.get(0).getAdPositionId()); if ("饿了么".equalsIgnoreCase(list.get(0).getOrderType())) { // 处理饿了么订单 elmeOrderMap.put(orderId, list); } else { if (!StringUtil.isNullOrEmpty(list.get(0).getSpecialId()) || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)) {// 设置渠道ID当做会员运营ID的位置ID fanliOrderMap.put(orderId, list); @@ -232,11 +239,52 @@ } } } } // 处理返利订单 processShopingFanliOrder(fanliOrderMap); // 处理分享赚订单 processShareGoodsOrder(shareOrderMap); // 处理饿了么订单 processElemeOrder(elmeOrderMap); } private ElmeOrder createElmeOrder(TaoBaoOrder taoBaoOrder) { ElmeOrder elmeOrder = new ElmeOrder(); elmeOrder.setChannelId(""); elmeOrder.setCreateTime(new Date()); elmeOrder .setOrderDate(new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getCreateTime(), "yyyy-MM-dd HH:mm:ss"))); elmeOrder.setOrderId(taoBaoOrder.getOrderId()); elmeOrder.setPayMoney(taoBaoOrder.getPayment()); elmeOrder.setRid(taoBaoOrder.getRelationId()); if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")) elmeOrder.setIsSettle(true); else elmeOrder.setIsSettle(false); elmeOrder.setTrackPid( String.format("mm_124933865_%s_%s", taoBaoOrder.getSourceMediaId(), taoBaoOrder.getAdPositionId())); if (!StringUtil.isNullOrEmpty(taoBaoOrder.getRelationId())) { UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByRelationId(taoBaoOrder.getRelationId()); if (extraInfo != null) elmeOrder.setUid(extraInfo.getUser().getId()); } return elmeOrder; } private void processElemeOrder(Map<String, List<TaoBaoOrder>> orders) { for (Iterator<String> its = orders.keySet().iterator(); its.hasNext();) { String orderId = its.next(); List<TaoBaoOrder> orderList = orders.get(orderId); for (TaoBaoOrder taoBaoOrder : orderList) { ElmeOrder elmeOrder = createElmeOrder(taoBaoOrder); try { elmeOrderService.addOrder(elmeOrder); } catch (ElmeOrderException e) { e.printStackTrace(); } } } } @Override @@ -533,9 +581,7 @@ } catch (OrderMoneySettleException e) { e.printStackTrace(); } if(1>0) return; // try { orderMoneySettleService.inviteSettleJD(uid); } catch (OrderMoneySettleException e) { @@ -1211,13 +1257,12 @@ @Transactional private void addHongBaoWithMQ(List<CommonOrderAddResultDTO> commonOrderList, String orderId, Long uid, int sourceType, int hongBaoType) { final List<CommonOrder> coList = convertCommonOrder(commonOrderList); int resultCode = 0; try { long time = TimeUtil.convertToTimeTemp("2019-12-06", "yyyy-MM-dd"); if (!Constant.IS_TEST) time = TimeUtil.convertToTimeTemp("2020-01-01", "yyyy-MM-dd"); time = TimeUtil.convertToTimeTemp("2019-12-20", "yyyy-MM-dd"); if (coList.get(0).getThirdCreateTime().getTime() < time) resultCode = hongBaoV2Service.addHongBao(coList, hongBaoType); fanli/src/main/java/com/yeshi/fanli/service/impl/shop/BanLiShopOrderPayServiceImpl.java
@@ -70,7 +70,7 @@ @Resource(name = "producer") private Producer producer; @Transactional @Transactional(rollbackFor = Exception.class) @Override public void payOrderByHongBao(Long orderId) throws BanLiShopOrderException, RedPackBalanceException { BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKeyForUpdate(orderId); @@ -287,7 +287,7 @@ } } @Transactional @Transactional(rollbackFor = Exception.class) @Override public void charge(Long orderId) throws BanLiShopOrderException { BanLiShopOrder order = banLiShopOrderService.selectByPrimaryKey(orderId); fanli/src/main/java/com/yeshi/fanli/service/inter/homemodule/AdActivityVersionControlService.java
New file @@ -0,0 +1,50 @@ package com.yeshi.fanli.service.inter.homemodule; import java.util.List; import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl; import com.yeshi.fanli.entity.bus.homemodule.AdActivityVersionControl.AdActivityType; /** * 获取广告版本映射服务(包含专题与横幅) * * @author Administrator * */ public interface AdActivityVersionControlService { /** * 添加 * * @param control * @throws Exception */ public void addVersionControl(AdActivityVersionControl control) throws Exception; /** * 主键删除 * * @param id */ public void deleteByPrimaryKey(Long id); /** * 根据类型与内容ID查询 * * @param type * @param sourceId * @return */ public List<AdActivityVersionControl> listByTypeAndSourceId(AdActivityType type, Long sourceId); /** * 过滤内容ID * * @param sourceIdList * @param type * @param appVersionId * @return */ public List<Long> filterSourceIdByVersion(List<Long> sourceIdList, AdActivityType type, Long appVersionId); } fanli/src/main/java/com/yeshi/fanli/service/manger/HongBaoV2AddManager.java
@@ -28,7 +28,6 @@ import com.yeshi.fanli.entity.order.HongBaoOrder; import com.yeshi.fanli.exception.order.HongBaoException; import com.yeshi.fanli.exception.user.UserAccountException; import com.yeshi.fanli.exception.user.UserInfoException; import com.yeshi.fanli.service.inter.order.CommonOrderService; import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService; @@ -78,32 +77,6 @@ @Resource private UserVIPInfoService userVIPInfoService; // 保存红包 public void saveHongBao1(CommonOrder commonOrder, int commonOrderType) throws HongBaoException, UserInfoException { // 查询上2级的信息 long uid = commonOrder.getUserInfo().getId(); UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid); if (user == null) throw new UserInfoException(1, "用户不存在"); UserInfo lastUser = threeSaleSerivce.getBoss(uid); UserInfo superLastUser = null; if (lastUser != null) { lastUser = userInfoService.selectAvailableByPrimaryKey(lastUser.getId()); if (lastUser != null) superLastUser = threeSaleSerivce.getBoss(lastUser.getId()); if (superLastUser != null) superLastUser = userInfoService.selectAvailableByPrimaryKey(superLastUser.getId()); } if (commonOrderType == CommonOrder.ORDER_TYPE_ZIGOU) { // 保存红包信息 } else if (commonOrderType == CommonOrder.ORDER_TYPE_SHARE) { } } /** * 添加红包信息 * @@ -123,7 +96,6 @@ boolean hasAdd = false; boolean hasUpdate = false; Set<Integer> stateSet = new HashSet<>();// 订单状态Set boolean isVIP = userVIPInfoService.isVIP(commonOrderList.get(0).getUserInfo().getId()); for (CommonOrder commonOrder : commonOrderList) { stateSet.add(commonOrder.getState()); goodsCount += commonOrder.getCount(); @@ -131,7 +103,7 @@ throw new HongBaoException(1, "订单信息不完整"); HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId()); if (hongBaoOrder == null) { saveHongBao(commonOrder, type, isVIP, notificationMap); saveHongBao(commonOrder, type, notificationMap); hasAdd = true; } else { boolean update = updateHongBao(hongBaoOrder, commonOrder, type, notificationMap); @@ -458,8 +430,10 @@ } @Transactional(rollbackFor = Exception.class) private void saveHongBao(CommonOrder commonOrder, int type, boolean vip, Map<Integer, HongBaoOrder> notificationMap) private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException, UserAccountException { boolean vip = commonOrder.getUrank() != null && commonOrder.getUrank() == 100; if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例 BigDecimal fanliRate = hongBaoManageService .getRate(new OrderHongBaoRateParams(0, type, false, vip, commonOrder.getThirdCreateTime())); fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java
@@ -26,7 +26,6 @@ return false; } public static boolean greaterThan_1_5_70(String platform, String versionCode) { if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 45)) || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 56))) @@ -51,8 +50,6 @@ return false; } public static boolean greaterThan_2_0(String platform, String versionCode) { if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 48)) || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 66))) @@ -60,7 +57,6 @@ else return false; } public static boolean greaterThan_2_0_1(String platform, String versionCode) { if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 50)) @@ -78,15 +74,13 @@ return false; } public static boolean greaterThan_2_1(String platform, String versionCode) { if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 52)) || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 75))) || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 73))) return true; else return false; } public static boolean smallerThan_1_5_1(String platform, String versionCode) { if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 36)) fanli/src/main/java/com/yeshi/fanli/util/charge/FuLuChargeApiUtil.java
@@ -22,19 +22,18 @@ * */ public class FuLuChargeApiUtil { // 测试 private final static String APP_KEY = "i4esv1l+76l/7NQCL3QudG90Fq+YgVfFGJAWgT+7qO1Bm9o/adG/1iwO2qXsAXNB"; private final static String APP_SECRET = "0a091b3aa4324435aab703142518a8f7"; // 正式 // 沙箱 // private final static String APP_KEY = // "CrtDnTh1E5eYY5D42T8uArVrl4GWq9AWR9ZrNC2qvXYIBMwOTuiJQy7YYaJSYlb6"; // "i4esv1l+76l/7NQCL3QudG90Fq+YgVfFGJAWgT+7qO1Bm9o/adG/1iwO2qXsAXNB"; // private final static String APP_SECRET = // "a5f6c827903e4b1eac6eb2ba2cf715be"; // "0a091b3aa4324435aab703142518a8f7"; // 正式 private final static String APP_KEY = "CrtDnTh1E5eYY5D42T8uArVrl4GWq9AWR9ZrNC2qvXYIBMwOTuiJQy7YYaJSYlb6"; private final static String APP_SECRET = "a5f6c827903e4b1eac6eb2ba2cf715be"; @SuppressWarnings("deprecation") private static String post(String url, String body) { HttpClient client = new HttpClient(); // client.getHostConfiguration().setProxy("192.168.1.122", 8888); PostMethod method = new PostMethod(url); method.addRequestHeader("Content-Type", "application/json;charset=UTF-8"); method.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); @@ -51,8 +50,8 @@ } private static void baseRequest(String method, JSONObject bizContent) throws FuLuChargeException { String url = "http://pre.openapi.fulu.com/api/getway"; // String url = "http://openapi.fulu.com/api/getway"; // String url = "http://pre.openapi.fulu.com/api/getway"; String url = "http://openapi.fulu.com/api/getway"; Map<String, String> params = new HashMap<>(); params.put("app_key", APP_KEY); params.put("method", method); @@ -90,7 +89,6 @@ */ public static void charge(String goodsNo, String orderId, String account) throws FuLuChargeException { JSONObject json = new JSONObject(); json.put("charge_type", "爱奇艺会员"); json.put("customer_order_no", orderId); json.put("product_id", goodsNo); json.put("charge_account", account); fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeOrderApiUtil.java
@@ -31,7 +31,6 @@ public static int TK_STATUS_SUCCESS = 14; public static int TK_STATUS_INVALID = 13; private static TaoBaoPunishOrder parsePunishOrder(JSONObject data) { TaoBaoPunishOrder order = new TaoBaoPunishOrder(); order.setPunishStatus(data.optString("punish_status")); @@ -209,8 +208,7 @@ JSONObject data = JSONObject.fromObject(response); try { JSONObject rootData=data.optJSONObject("tbk_order_details_get_response").optJSONObject("data"); array =rootData .optJSONObject("results") .optJSONArray("publisher_order_dto"); array = rootData.optJSONObject("results").optJSONArray("publisher_order_dto"); dto.setHasPre( rootData.optBoolean("has_pre")); dto.setPositionIndex(rootData.optString("position_index")); dto.setHasNext(rootData.optBoolean("has_next")); @@ -260,11 +258,14 @@ taoBaoOrder.setPayment(new BigDecimal(item.optString("alipay_total_price"))); else taoBaoOrder.setPayment(new BigDecimal(0)); if (StringUtil.isNullOrEmpty(item.optString("item_price"))) taoBaoOrder.setPrice(new BigDecimal(0)); else taoBaoOrder.setPrice(new BigDecimal(item.optString("item_price"))); if (!StringUtil.isNullOrEmpty(item.optString("pay_price"))) taoBaoOrder.setSettlement(new BigDecimal(item.optString("pay_price"))); else taoBaoOrder.setSettlement(new BigDecimal(0)); taoBaoOrder.setSettlement(taoBaoOrder.getPayment()); taoBaoOrder.setSettlementTime(item.optString("tk_earning_time")); taoBaoOrder.setShop(item.optString("seller_shop_title")); taoBaoOrder.setSourceMediaId(item.optString("site_id")); @@ -412,6 +413,14 @@ return getTaoBaoOrderList(startTime, endTime, queryType, 3); } /** * 淘宝渠道订单 * * @param startTime * @param endTime * @param queryType * @return */ public static List<TaoBaoOrder> getTaoBaoRelationOrderList(long startTime, long endTime, int queryType) { return getTaoBaoOrderList(startTime, endTime, queryType, 2); } @@ -419,7 +428,6 @@ public static List<TaoBaoOrder> getTaoBaoCommonOrderList(long startTime, long endTime, int queryType) { return getTaoBaoOrderList(startTime, endTime, queryType, 1); } public static List<TaoBaoOrder> getTaoBaoOrderList(long startTime, long endTime, int queryType,int orderScene) { List<TaoBaoOrder> orderList = new ArrayList<>(); @@ -438,10 +446,10 @@ TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"),null, queryType, orderScene); if (dto != null) orderList.addAll(dto.getOrderList()); while(dto.isHasNext()) { while (dto.isHasNext()) { dto=queryNewOrder(TimeUtil.getGernalTime(start, "yyyy-MM-dd HH:mm:ss"), TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"),dto.getPositionIndex(), queryType, orderScene); TimeUtil.getGernalTime(end, "yyyy-MM-dd HH:mm:ss"), dto.getPositionIndex(), queryType, orderScene); if (dto != null) orderList.addAll(dto.getOrderList()); } @@ -449,8 +457,19 @@ return orderList; } private static TaoBaoOrderResultDTO queryNewOrder(String startTime, String endTime,String positionIndex, int queryType, int orderScene) { /** * 淘宝订单查询 * * @param startTime * @param endTime * @param positionIndex * @param queryType * 1:按照订单淘客创建时间查询,2:按照订单淘客付款时间查询,3:按照订单淘客结算时间查询 * @param orderScene * @return */ private static TaoBaoOrderResultDTO queryNewOrder(String startTime, String endTime, String positionIndex, int queryType, int orderScene) { Map<String, String> params = new HashMap<>(); params.put("query_type", queryType + ""); params.put("page_size", "100"); fanli/src/test/java/org/fanli/MyBatisProduce.java
@@ -5,7 +5,7 @@ import org.yeshi.utils.mybatis.MyBatisMapperUtil; import com.yeshi.fanli.entity.bus.help.AppPageNotification; import com.yeshi.fanli.entity.bus.user.UserInfoExtra; import com.yeshi.fanli.entity.order.CommonOrder; //@Ignore public class MyBatisProduce { @@ -17,8 +17,8 @@ // @Test public void test1() { ColumnParseUtil.parseColumn(UserInfoExtra.class, "D:\\workspace\\fanli\\fanli-server\\fanli\\src\\main\\java\\com\\yeshi\\fanli\\mapping\\user\\UserInfoExtraMapper.xml"); ColumnParseUtil.parseColumn(CommonOrder.class, "D:/workspace/fanli/fanli-server/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml"); } } fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -35,8 +35,10 @@ import com.yeshi.fanli.util.BeanUtil; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TaoBaoConstant; import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -64,19 +66,26 @@ // e.printStackTrace(); // } // String link = TaoKeApiUtil.officialActivityConvert(87140050199L + "", "1571715733668", "513796574"); // String link = TaoKeApiUtil.officialActivityConvert(87140050199L + "", // "1571715733668", "513796574"); // System.out.println(link); // String link = TaoBaoUtil.getTaoBaoUnionAuthUrl(TaoBaoConstant.TAOBAO_AUTH_APPKEY, // "http://api.flqapp.com/fanli/client/v1/auth/callback/tb", 6396582L, "share"); // String link = // TaoBaoUtil.getTaoBaoUnionAuthUrl(TaoBaoConstant.TAOBAO_AUTH_APPKEY, // "http://api.flqapp.com/fanli/client/v1/auth/callback/tb", 6396582L, // "share"); // System.out.println(link); try { TaoKeApiUtil.searchGoodsDetail(608512721647L); } catch (TaobaoGoodsDownException e) { e.printStackTrace(); } // try { // TaoKeApiUtil.searchGoodsDetail(608512721647L); // } catch (TaobaoGoodsDownException e) { // e.printStackTrace(); // } List<TaoBaoOrder> list = TaoKeOrderApiUtil.getTaoBaoRelationOrderList( TimeUtil.convertToTimeTemp("2019-12-09 10:13:52", "yyyy-MM-dd HH:mm:ss"), TimeUtil.convertToTimeTemp("2019-12-09 10:14:53", "yyyy-MM-dd HH:mm:ss"), 1); System.out.println(list); } @Test