Merge remote-tracking branch 'origin/div' into div
| | |
| | | /target/
|
| | | /.settings/
|
| | | druid.properties
|
| | | .classpath
|
| | | .project
|
| | | Constant.java |
| | | /error.log |
| | | /.gitignore |
| | |
| | | KEY = Constant.systemCommonConfig.getSignKey();
|
| | | }
|
| | |
|
| | | // @Around(EDP)
|
| | | @Around(EDP)
|
| | | public Object testAround(ProceedingJoinPoint joinPoint) throws IOException {
|
| | | Object[] args = joinPoint.getArgs();
|
| | | PrintWriter out = null;
|
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.File;
|
| | | import java.io.FileOutputStream;
|
| | | import java.io.FileReader;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.OutputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLDecoder;
|
| | | import java.net.URLEncoder;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.bind.annotation.RequestParam;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.yeshi.utils.CsvUtil;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.entity.wx.RedPackRecord;
|
| | | import org.yeshi.utils.wx.WXUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | |
| | | import com.yeshi.fanli.service.inter.push.PushRecordService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | @RequestMapping(value = "downAutoExtractTxt")
|
| | | public void downAutoExtractTxt(String callback, HttpServletResponse response, PrintWriter out) {
|
| | | try {
|
| | | List<String> list = extractService.getAutoExtractOpenIds();
|
| | | if (list == null || list.size() <= 1) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
|
| | | return;
|
| | | }
|
| | | |
| | | String filepath = "自动提现OpenId "+ java.lang.System.currentTimeMillis() + ".txt";
|
| | | response.reset();
|
| | | response.setContentType("application/octet-stream");
|
| | | String fileName= URLDecoder.decode(filepath,"utf-8");
|
| | | response.addHeader("Content-Disposition","attachment;"+ "filename=\"" +URLEncoder.encode(fileName, "utf-8") + "\"");
|
| | | |
| | | StringBuilder sb = new StringBuilder();
|
| | | for(String t:list){
|
| | | sb.append(t+"\r\n");
|
| | | }
|
| | | |
| | | OutputStream os = response.getOutputStream();
|
| | | byte[] byt = sb.toString().getBytes();
|
| | | os.write(byt);
|
| | | os.flush();
|
| | | os.close();
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @RequestMapping(value = "uploadExcel", method = RequestMethod.POST)
|
| | | public void uploadExcel(@RequestParam("file") CommonsMultipartFile file, PrintWriter out) {
|
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件不能为空!"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<RedPackRecord> list = CsvUtil.getCsvData(file, RedPackRecord.class);
|
| | | extractService.updateManualExtractRecord(list);
|
| | | out.print(JsonUtil.loadTrueResult("上传成功"));
|
| | | } catch (ExtractException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult("上传失败"));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | } else {
|
| | | List<GoodsPicture> imgs = dynamicInfo.getImgs();
|
| | | if (imgs == null || imgs.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("所有商品已抢光"));
|
| | | return;
|
| | | }
|
| | | |
| | | int count = 0;
|
| | | for (GoodsPicture goodsPicture: imgs) {
|
| | | if (goodsPicture.getGoodState() == 1) {
|
| | | count ++;
|
| | | continue;
|
| | | } |
| | | |
| | | TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods();
|
| | | if (goods == null) {
|
| | | count ++;
|
| | | continue;
|
| | | }
|
| | | |
| | | if (goods.getState() != null && goods.getState() == 1) {
|
| | | count ++;
|
| | | continue;
|
| | | }
|
| | | |
| | | if (!goods.isCoupon()) {
|
| | | count ++;
|
| | | continue;
|
| | | }
|
| | | }
|
| | | |
| | | if (count >= imgs.size()) {
|
| | | out.print(JsonUtil.loadFalseResult("所有商品已抢光"));
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | // 分享文字
|
| | |
| | | if (!StringUtil.isNullOrEmpty(jdId)) {
|
| | | JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(jdId));
|
| | | if (goods != null) {
|
| | | commonGoods = CommonGoodsFactory.create(goods);
|
| | | // 高级接口 -- 信息更完整
|
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(Long.parseLong(jdId)); |
| | | if (jdGoods != null) {
|
| | | commonGoods = CommonGoodsFactory.create(jdGoods);
|
| | | } else {
|
| | | commonGoods = CommonGoodsFactory.create(goods);
|
| | | }
|
| | | } else {
|
| | | type = 4;
|
| | | goods = JDUtil.getSimpleGoodsInfo(jdId);
|
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord; |
| | | |
| | | public interface ExtractWeiXinRecordMapper extends BaseMapper<ExtractWeiXinRecord> { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据openid、发放方式查询 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | ExtractWeiXinRecord getByOpenIdAndType(@Param("openId")String openId, @Param("type") Integer type); |
| | | |
| | | |
| | | /** |
| | | * 查询满足条件的用户id |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<Long> getValidUsers(@Param("list")List<Long> list,@Param("receivedDate") String receivedDate, |
| | | @Param("refundDate") String refundDate); |
| | | } |
| | |
| | | List<UserInfo> listByClosed(@Param("appId") String appId, @Param("phone") String phone);
|
| | |
|
| | | long countAvaiableUser();
|
| | | |
| | | |
| | | /**
|
| | | * 查询满足自动提现用户
|
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<Long> getAutoExtractUserIds(@Param("start") int start, @Param("count") int count, @Param("money") BigDecimal money);
|
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.elme; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap; |
| | | |
| | | public interface ElmeHongBaoOrderMapMapper extends BaseMapper<ElmeHongBaoOrderMap> { |
| | | |
| | | /** |
| | | * 根据红包ID检索 |
| | | * |
| | | * @param hongBaoId |
| | | * @return |
| | | */ |
| | | ElmeHongBaoOrderMap selectByHongBaoId(Long hongBaoId); |
| | | |
| | | /** |
| | | * 根据订单号检索 |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | ElmeHongBaoOrderMap selectByOrderId(Long orderId); |
| | | |
| | | /** |
| | | * |
| | | * @param uid |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<ElmeHongBaoOrderMap> listByHongBaoUid(@Param("uid") Long uid, @Param("start") long start, |
| | | @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据红包用户ID计数 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countByHongBaoUid(Long uid); |
| | | |
| | | package com.yeshi.fanli.dao.mybatis.elme;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap;
|
| | |
|
| | | public interface ElmeHongBaoOrderMapMapper extends BaseMapper<ElmeHongBaoOrderMap> {
|
| | |
|
| | | /**
|
| | | * 根据红包ID检索
|
| | | * |
| | | * @param hongBaoId
|
| | | * @return
|
| | | */
|
| | | ElmeHongBaoOrderMap selectByHongBaoId(Long hongBaoId);
|
| | |
|
| | | /**
|
| | | * 根据订单号检索
|
| | | * |
| | | * @param orderId
|
| | | * @return
|
| | | */
|
| | | ElmeHongBaoOrderMap selectByOrderId(Long orderId);
|
| | |
|
| | | /**
|
| | | * |
| | | * @param uid
|
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<ElmeHongBaoOrderMap> listByHongBaoUid(@Param("uid") Long uid, @Param("start") long start,
|
| | | @Param("count") int count);
|
| | |
|
| | | /**
|
| | | * 根据红包用户ID计数
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long countByHongBaoUid(Long uid);
|
| | |
|
| | | } |
| | |
| | | ""), buyScore("购买积分", "http://img.flqapp.com/resource/money_detail/icon_score.png", ""), extract("提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png",
|
| | | ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励金","http://img.flqapp.com/resource/money_detail/icon_order_reward.png",""),repeatStatistic("重复统计返利/奖金扣除","http://img.flqapp.com/resource/money_detail/icon_fanli.png",""), |
| | | elmeFanli("饿了么返利到账","http://img.flqapp.com/resource/money_detail/icon_fanli.png",""),
|
| | | |
| | | extractAutoWX("自动提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png", "");
|
| | | extractAutoWX("自动提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractAutoWXRefund("自动提现失败", "http://img.flqapp.com/resource/money_detail/icon_extract.png", "");
|
| | | |
| | |
|
| | | private final String desc;
|
| | | private final String picture;
|
| | | private final String helpUrl;
|
| | |
| | | /**
|
| | | * 每两个小时进行更新品牌商品信息
|
| | | */
|
| | | @Scheduled(cron = "0 0 1/2 * * ? ")
|
| | | // @Scheduled(cron = "0 0 1/2 * * ? ")
|
| | | public void updateGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | |
| | | <result column="aer_status" property="status" jdbcType="VARCHAR"/> |
| | | <result column="aer_send_time" property="sendTime" jdbcType="TIMESTAMP"/> |
| | | <result column="aer_rcv_time" property="rcvTime" jdbcType="TIMESTAMP"/> |
| | | <result column="aer_send_type" property="sendType" jdbcType="VARCHAR"/> |
| | | <result column="aer_hb_type" property="hbType" jdbcType="VARCHAR"/> |
| | | <result column="aer_total_num" property="totalNum" jdbcType="INTEGER"/> |
| | | <result column="aer_type" property="type" jdbcType="INTEGER"/> |
| | | <result column="aer_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="aer_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_create_time,aer_update_time</sql> |
| | | <sql id="Base_Column_List">aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_send_type,aer_hb_type,aer_total_num,aer_type,aer_create_time,aer_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_extract_weixin_record where aer_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_extract_weixin_record where aer_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_weixin_record (aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_create_time,aer_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{openId,jdbcType=VARCHAR},#{unionId,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{billno,jdbcType=VARCHAR},#{detailno,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR},#{sendTime,jdbcType=TIMESTAMP},#{rcvTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_weixin_record (aer_id,aer_uid,aer_open_id,aer_union_id,aer_money,aer_billno,aer_detailno,aer_status,aer_send_time,aer_rcv_time,aer_send_type,aer_hb_type,aer_total_num,aer_type,aer_create_time,aer_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{openId,jdbcType=VARCHAR},#{unionId,jdbcType=VARCHAR},#{money,jdbcType=DECIMAL},#{billno,jdbcType=VARCHAR},#{detailno,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR},#{sendTime,jdbcType=TIMESTAMP},#{rcvTime,jdbcType=TIMESTAMP},#{sendType,jdbcType=VARCHAR},#{hbType,jdbcType=VARCHAR},#{totalNum,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_extract_weixin_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">aer_id,</if> |
| | |
| | | <if test="status != null">aer_status,</if> |
| | | <if test="sendTime != null">aer_send_time,</if> |
| | | <if test="rcvTime != null">aer_rcv_time,</if> |
| | | <if test="sendType != null">aer_send_type,</if> |
| | | <if test="hbType != null">aer_hb_type,</if> |
| | | <if test="totalNum != null">aer_total_num,</if> |
| | | <if test="type != null">aer_type,</if> |
| | | <if test="createTime != null">aer_create_time,</if> |
| | | <if test="updateTime != null">aer_update_time,</if> |
| | | </trim>values |
| | |
| | | <if test="status != null">#{status,jdbcType=VARCHAR},</if> |
| | | <if test="sendTime != null">#{sendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="rcvTime != null">#{rcvTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="sendType != null">#{sendType,jdbcType=VARCHAR},</if> |
| | | <if test="hbType != null">#{hbType,jdbcType=VARCHAR},</if> |
| | | <if test="totalNum != null">#{totalNum,jdbcType=INTEGER},</if> |
| | | <if test="type != null">#{type,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.ExtractWeiXinRecord">update yeshi_ec_extract_weixin_record set aer_uid = #{uid,jdbcType=BIGINT},aer_open_id = #{openId,jdbcType=VARCHAR},aer_union_id = #{unionId,jdbcType=VARCHAR},aer_money = #{money,jdbcType=DECIMAL},aer_billno = #{billno,jdbcType=VARCHAR},aer_detailno = #{detailno,jdbcType=VARCHAR},aer_status = #{status,jdbcType=VARCHAR},aer_send_time = #{sendTime,jdbcType=TIMESTAMP},aer_rcv_time = #{rcvTime,jdbcType=TIMESTAMP},aer_create_time = #{createTime,jdbcType=TIMESTAMP},aer_update_time = #{updateTime,jdbcType=TIMESTAMP} where aer_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord">update yeshi_ec_extract_weixin_record set aer_uid = #{uid,jdbcType=BIGINT},aer_open_id = #{openId,jdbcType=VARCHAR},aer_union_id = #{unionId,jdbcType=VARCHAR},aer_money = #{money,jdbcType=DECIMAL},aer_billno = #{billno,jdbcType=VARCHAR},aer_detailno = #{detailno,jdbcType=VARCHAR},aer_status = #{status,jdbcType=VARCHAR},aer_send_time = #{sendTime,jdbcType=TIMESTAMP},aer_rcv_time = #{rcvTime,jdbcType=TIMESTAMP},aer_send_type = #{sendType,jdbcType=VARCHAR},aer_hb_type = #{hbType,jdbcType=VARCHAR},aer_total_num = #{totalNum,jdbcType=INTEGER},aer_type = #{type,jdbcType=INTEGER},aer_create_time = #{createTime,jdbcType=TIMESTAMP},aer_update_time = #{updateTime,jdbcType=TIMESTAMP} where aer_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord">update yeshi_ec_extract_weixin_record |
| | | <set> |
| | | <if test="uid != null">aer_uid=#{uid,jdbcType=BIGINT},</if> |
| | |
| | | <if test="status != null">aer_status=#{status,jdbcType=VARCHAR},</if> |
| | | <if test="sendTime != null">aer_send_time=#{sendTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="rcvTime != null">aer_rcv_time=#{rcvTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="sendType != null">aer_send_type=#{sendType,jdbcType=VARCHAR},</if> |
| | | <if test="hbType != null">aer_hb_type=#{hbType,jdbcType=VARCHAR},</if> |
| | | <if test="totalNum != null">aer_total_num=#{totalNum,jdbcType=INTEGER},</if> |
| | | <if test="type != null">aer_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">aer_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">aer_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where aer_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getValidUsers" resultType="Long"> |
| | | SELECT DISTINCT A.uid |
| | | FROM (SELECT t.uid,d.`aer_uid` AS existUid,cc.aer_uid FROM ( |
| | | <foreach collection="list" item="item" index="index"> |
| | | <if test="index != 0">UNION</if> SELECT #{item} AS uid |
| | | </foreach> |
| | | )t |
| | | LEFT JOIN `yeshi_ec_extract_weixin_record` d ON d.aer_uid = t.uid |
| | | LEFT JOIN (SELECT DISTINCT d.aer_uid FROM `yeshi_ec_extract_weixin_record` d |
| | | WHERE IF(d.`aer_status` = 'RECEIVED',d.`aer_create_time` <![CDATA[<=]]> #{receivedDate}, FALSE) |
| | | OR IF(d.`aer_status` = 'REFUND',d.`aer_create_time` <![CDATA[<=]]> #{refundDate}, FALSE) |
| | | ORDER BY d.`aer_create_time` DESC |
| | | )cc ON cc.aer_uid = t.uid |
| | | WHERE IF (d.`aer_uid` IS NULL,TRUE, IFNULL(cc.aer_uid,FALSE)))A |
| | | </select> |
| | | |
| | | <select id="getByOpenIdAndType" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_extract_weixin_record` d |
| | | WHERE d.`aer_open_id` = #{openId} AND d.`aer_type` = #{type} |
| | | AND d.`aer_status`<![CDATA[<>]]> 'RECEIVED' AND d.`aer_status`<![CDATA[<>]]> 'REFUND' |
| | | ORDER BY d.`aer_create_time` DESC |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | yeshi_ec_user u
|
| | | where u.state=0
|
| | | </select>
|
| | | |
| | | <select id="getAutoExtractUserIds" resultType="java.lang.Long">
|
| | | SELECT u.`id` FROM `yeshi_ec_user_info_extra` t
|
| | | LEFT JOIN `yeshi_ec_user` u ON u.`id` = t.`uie_uid`
|
| | | WHERE t.`uie_auto_extract` = 1 AND u.`state` = 0 AND u.`my_hongBao` <![CDATA[>=]]> #{money} |
| | | AND u.`wx_open_id` IS NOT NULL
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | |
|
| | | </mapper>
|
| | |
| | | <?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.elme.ElmeHongBaoOrderMapMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap"> |
| | | <id column="eoh_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="eoh_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="elmeOrder" column="eoh_order_id" |
| | | javaType="com.yeshi.fanli.entity.elme.ElmeOrder" |
| | | select="com.yeshi.fanli.dao.mybatis.elme.ElmeOrderMapper.selectByPrimaryKey"> |
| | | </association> |
| | | <association property="hongBao" column="eoh_hongbao_id" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2" |
| | | select="com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper.selectByPrimaryKey"> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">eoh_id,eoh_order_id,eoh_hongbao_id,eoh_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order_hongbao where eoh_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByHongBaoId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order_hongbao where eoh_hongbao_id = #{0} |
| | | </select> |
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order_hongbao where eoh_order_id = #{0} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByHongBaoUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order_hongbao left join yeshi_ec_hongbao_v2 v on |
| | | v.hb_id=eoh_hongbao_id where v.hb_uid = #{uid} order by eoh_id desc limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countByHongBaoUid" resultType="java.lang.Long" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | count(eoh_id) |
| | | from yeshi_ec_elme_order_hongbao left |
| | | join yeshi_ec_hongbao_v2 v on |
| | | v.hb_id=eoh_hongbao_id where v.hb_uid = |
| | | #{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_elme_order_hongbao where eoh_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_elme_order_hongbao |
| | | (eoh_id,eoh_order_id,eoh_hongbao_id,eoh_create_time) values |
| | | (#{id,jdbcType=BIGINT},#{elmeOrder.id,jdbcType=BIGINT},#{hongBao.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_elme_order_hongbao |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">eoh_id,</if> |
| | | <if test="elmeOrder != null">eoh_order_id,</if> |
| | | <if test="hongBao != null">eoh_hongbao_id,</if> |
| | | <if test="createTime != null">eoh_create_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="elmeOrder != null">#{elmeOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="hongBao != null">#{hongBao.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap">update |
| | | yeshi_ec_elme_order_hongbao set eoh_order_id = |
| | | #{elmeOrder.id,jdbcType=BIGINT},eoh_hongbao_id = |
| | | #{hongBao.id,jdbcType=BIGINT},eoh_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} where eoh_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap"> |
| | | update yeshi_ec_elme_order_hongbao |
| | | <set> |
| | | <if test="elmeOrder != null">eoh_order_id=#{elmeOrder.id,jdbcType=BIGINT},</if> |
| | | <if test="hongBao != null">eoh_hongbao_id=#{hongBao.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">eoh_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where eoh_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | | <?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.elme.ElmeHongBaoOrderMapMapper">
|
| | | <resultMap id="BaseResultMap"
|
| | | type="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap">
|
| | | <id column="eoh_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="eoh_create_time" property="createTime"
|
| | | jdbcType="TIMESTAMP" />
|
| | | <association property="elmeOrder" column="eoh_order_id"
|
| | | javaType="com.yeshi.fanli.entity.elme.ElmeOrder"
|
| | | select="com.yeshi.fanli.dao.mybatis.elme.ElmeOrderMapper.selectByPrimaryKey">
|
| | | </association>
|
| | | <association property="hongBao" column="eoh_hongbao_id"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"
|
| | | select="com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper.selectByPrimaryKey">
|
| | | </association>
|
| | |
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">eoh_id,eoh_order_id,eoh_hongbao_id,eoh_create_time</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_elme_order_hongbao where eoh_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="selectByHongBaoId" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_elme_order_hongbao where eoh_hongbao_id = #{0}
|
| | | </select>
|
| | |
|
| | | <select id="selectByOrderId" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_elme_order_hongbao where eoh_order_id = #{0}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByHongBaoUid" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_elme_order_hongbao left join yeshi_ec_hongbao_v2 v on
|
| | | v.hb_id=eoh_hongbao_id where v.hb_uid = #{uid} order by eoh_id desc limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countByHongBaoUid" resultType="java.lang.Long"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | count(eoh_id)
|
| | | from yeshi_ec_elme_order_hongbao left
|
| | | join yeshi_ec_hongbao_v2 v on
|
| | | v.hb_id=eoh_hongbao_id where v.hb_uid =
|
| | | #{0}
|
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_elme_order_hongbao where eoh_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_elme_order_hongbao
|
| | | (eoh_id,eoh_order_id,eoh_hongbao_id,eoh_create_time) values
|
| | | (#{id,jdbcType=BIGINT},#{elmeOrder.id,jdbcType=BIGINT},#{hongBao.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_elme_order_hongbao
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">eoh_id,</if>
|
| | | <if test="elmeOrder != null">eoh_order_id,</if>
|
| | | <if test="hongBao != null">eoh_hongbao_id,</if>
|
| | | <if test="createTime != null">eoh_create_time,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="elmeOrder != null">#{elmeOrder.id,jdbcType=BIGINT},</if>
|
| | | <if test="hongBao != null">#{hongBao.id,jdbcType=BIGINT},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap">update
|
| | | yeshi_ec_elme_order_hongbao set eoh_order_id =
|
| | | #{elmeOrder.id,jdbcType=BIGINT},eoh_hongbao_id =
|
| | | #{hongBao.id,jdbcType=BIGINT},eoh_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP} where eoh_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap">
|
| | | update yeshi_ec_elme_order_hongbao
|
| | | <set>
|
| | | <if test="elmeOrder != null">eoh_order_id=#{elmeOrder.id,jdbcType=BIGINT},</if>
|
| | | <if test="hongBao != null">eoh_hongbao_id=#{hongBao.id,jdbcType=BIGINT},</if>
|
| | | <if test="createTime != null">eoh_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where eoh_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | </mapper>
|
| | |
| | | <?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.elme.ElmeOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.elme.ElmeOrder"> |
| | | <id column="eo_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="eo_channel_id" property="channelId" jdbcType="VARCHAR" /> |
| | | <result column="eo_channel_name" property="channelName" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="eo_track_pid" property="trackPid" jdbcType="VARCHAR" /> |
| | | <result column="eo_rid" property="rid" jdbcType="VARCHAR" /> |
| | | <result column="eo_order_date" property="orderDate" jdbcType="TIMESTAMP" /> |
| | | <result column="eo_order_id" property="orderId" jdbcType="VARCHAR" /> |
| | | <result column="eo_pay_money" property="payMoney" jdbcType="DECIMAL" /> |
| | | <result column="eo_city" property="city" jdbcType="VARCHAR" /> |
| | | <result column="eo_coupon_money" property="couponMoney" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="eo_newer_first_order" property="newerFirstOrder" |
| | | jdbcType="INTEGER" /> |
| | | <result column="eo_newer_repay_order" property="newerRepayOrder" |
| | | jdbcType="INTEGER" /> |
| | | <result column="eo_taoke_hongbao" property="taokeHongBao" |
| | | jdbcType="INTEGER" /> |
| | | <result column="eo_shop_click" property="shopClick" jdbcType="INTEGER" /> |
| | | <result column="eo_recieve_coupon_7day_first_order" property="recieveCoupon7DayFirstOrder" |
| | | jdbcType="INTEGER" /> |
| | | <result column="eo_settle" property="isSettle" jdbcType="BOOLEAN" /> |
| | | <result column="eo_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="eo_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">eo_id,eo_channel_id,eo_channel_name,eo_track_pid,eo_rid,eo_order_date,eo_order_id,eo_pay_money,eo_city,eo_coupon_money,eo_newer_first_order,eo_newer_repay_order,eo_taoke_hongbao,eo_shop_click,eo_recieve_coupon_7day_first_order,eo_settle,eo_create_time,eo_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order where eo_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order where eo_order_id = #{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_elme_order where eo_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.elme.ElmeOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_elme_order |
| | | (eo_id,eo_channel_id,eo_channel_name,eo_track_pid,eo_rid,eo_order_date,eo_order_id,eo_pay_money,eo_city,eo_coupon_money,eo_newer_first_order,eo_newer_repay_order,eo_taoke_hongbao,eo_shop_click,eo_recieve_coupon_7day_first_order,eo_settle,eo_create_time,eo_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{channelId,jdbcType=VARCHAR},#{channelName,jdbcType=VARCHAR},#{trackPid,jdbcType=VARCHAR},#{rid,jdbcType=VARCHAR},#{orderDate,jdbcType=TIMESTAMP},#{orderId,jdbcType=VARCHAR},#{payMoney,jdbcType=DECIMAL},#{city,jdbcType=VARCHAR},#{couponMoney,jdbcType=DECIMAL},#{newerFirstOrder,jdbcType=INTEGER},#{newerRepayOrder,jdbcType=INTEGER},#{taokeHongBao,jdbcType=INTEGER},#{shopClick,jdbcType=INTEGER},#{recieveCoupon7DayFirstOrder,jdbcType=INTEGER},#{isSettle,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.elme.ElmeOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_elme_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">eo_id,</if> |
| | | <if test="channelId != null">eo_channel_id,</if> |
| | | <if test="channelName != null">eo_channel_name,</if> |
| | | <if test="trackPid != null">eo_track_pid,</if> |
| | | <if test="rid != null">eo_rid,</if> |
| | | <if test="orderDate != null">eo_order_date,</if> |
| | | <if test="orderId != null">eo_order_id,</if> |
| | | <if test="payMoney != null">eo_pay_money,</if> |
| | | <if test="city != null">eo_city,</if> |
| | | <if test="couponMoney != null">eo_coupon_money,</if> |
| | | <if test="newerFirstOrder != null">eo_newer_first_order,</if> |
| | | <if test="newerRepayOrder != null">eo_newer_repay_order,</if> |
| | | <if test="taokeHongBao != null">eo_taoke_hongbao,</if> |
| | | <if test="shopClick != null">eo_shop_click,</if> |
| | | <if test="recieveCoupon7DayFirstOrder != null">eo_recieve_coupon_7day_first_order,</if> |
| | | <if test="isSettle != null">eo_settle,</if> |
| | | <if test="createTime != null">eo_create_time,</if> |
| | | <if test="updateTime != null">eo_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="channelId != null">#{channelId,jdbcType=VARCHAR},</if> |
| | | <if test="channelName != null">#{channelName,jdbcType=VARCHAR},</if> |
| | | <if test="trackPid != null">#{trackPid,jdbcType=VARCHAR},</if> |
| | | <if test="rid != null">#{rid,jdbcType=VARCHAR},</if> |
| | | <if test="orderDate != null">#{orderDate,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if> |
| | | <if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if> |
| | | <if test="city != null">#{city,jdbcType=VARCHAR},</if> |
| | | <if test="couponMoney != null">#{couponMoney,jdbcType=DECIMAL},</if> |
| | | <if test="newerFirstOrder != null">#{newerFirstOrder,jdbcType=INTEGER},</if> |
| | | <if test="newerRepayOrder != null">#{newerRepayOrder,jdbcType=INTEGER},</if> |
| | | <if test="taokeHongBao != null">#{taokeHongBao,jdbcType=INTEGER},</if> |
| | | <if test="shopClick != null">#{shopClick,jdbcType=INTEGER},</if> |
| | | <if test="recieveCoupon7DayFirstOrder != null">#{recieveCoupon7DayFirstOrder,jdbcType=INTEGER},</if> |
| | | <if test="isSettle != null">#{isSettle,jdbcType=BOOLEAN},</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.elme.ElmeOrder">update |
| | | yeshi_ec_elme_order set eo_channel_id = |
| | | #{channelId,jdbcType=VARCHAR},eo_channel_name = |
| | | #{channelName,jdbcType=VARCHAR},eo_track_pid = |
| | | #{trackPid,jdbcType=VARCHAR},eo_rid = |
| | | #{rid,jdbcType=VARCHAR},eo_order_date = |
| | | #{orderDate,jdbcType=TIMESTAMP},eo_order_id = |
| | | #{orderId,jdbcType=VARCHAR},eo_pay_money = |
| | | #{payMoney,jdbcType=DECIMAL},eo_city = |
| | | #{city,jdbcType=VARCHAR},eo_coupon_money = |
| | | #{couponMoney,jdbcType=DECIMAL},eo_newer_first_order = |
| | | #{newerFirstOrder,jdbcType=INTEGER},eo_newer_repay_order = |
| | | #{newerRepayOrder,jdbcType=INTEGER},eo_taoke_hongbao = |
| | | #{taokeHongBao,jdbcType=INTEGER},eo_shop_click = |
| | | #{shopClick,jdbcType=INTEGER},eo_recieve_coupon_7day_first_order = |
| | | #{recieveCoupon7DayFirstOrder,jdbcType=INTEGER},eo_settle = |
| | | #{isSettle,jdbcType=BOOLEAN},eo_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},eo_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where eo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.elme.ElmeOrder"> |
| | | update yeshi_ec_elme_order |
| | | <set> |
| | | <if test="channelId != null">eo_channel_id=#{channelId,jdbcType=VARCHAR},</if> |
| | | <if test="channelName != null">eo_channel_name=#{channelName,jdbcType=VARCHAR},</if> |
| | | <if test="trackPid != null">eo_track_pid=#{trackPid,jdbcType=VARCHAR},</if> |
| | | <if test="rid != null">eo_rid=#{rid,jdbcType=VARCHAR},</if> |
| | | <if test="orderDate != null">eo_order_date=#{orderDate,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderId != null">eo_order_id=#{orderId,jdbcType=VARCHAR},</if> |
| | | <if test="payMoney != null">eo_pay_money=#{payMoney,jdbcType=DECIMAL},</if> |
| | | <if test="city != null">eo_city=#{city,jdbcType=VARCHAR},</if> |
| | | <if test="couponMoney != null">eo_coupon_money=#{couponMoney,jdbcType=DECIMAL},</if> |
| | | <if test="newerFirstOrder != null">eo_newer_first_order=#{newerFirstOrder,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="newerRepayOrder != null">eo_newer_repay_order=#{newerRepayOrder,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="taokeHongBao != null">eo_taoke_hongbao=#{taokeHongBao,jdbcType=INTEGER},</if> |
| | | <if test="shopClick != null">eo_shop_click=#{shopClick,jdbcType=INTEGER},</if> |
| | | <if test="recieveCoupon7DayFirstOrder != null">eo_recieve_coupon_7day_first_order=#{recieveCoupon7DayFirstOrder,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="isSettle != null">eo_settle=#{isSettle,jdbcType=BOOLEAN},</if> |
| | | <if test="createTime != null">eo_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">eo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where eo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | | <?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.elme.ElmeOrderMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.elme.ElmeOrder">
|
| | | <id column="eo_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="eo_channel_id" property="channelId" jdbcType="VARCHAR" />
|
| | | <result column="eo_channel_name" property="channelName"
|
| | | jdbcType="VARCHAR" />
|
| | | <result column="eo_track_pid" property="trackPid" jdbcType="VARCHAR" />
|
| | | <result column="eo_rid" property="rid" jdbcType="VARCHAR" />
|
| | | <result column="eo_order_date" property="orderDate" jdbcType="TIMESTAMP" />
|
| | | <result column="eo_order_id" property="orderId" jdbcType="VARCHAR" />
|
| | | <result column="eo_pay_money" property="payMoney" jdbcType="DECIMAL" />
|
| | | <result column="eo_city" property="city" jdbcType="VARCHAR" />
|
| | | <result column="eo_coupon_money" property="couponMoney"
|
| | | jdbcType="DECIMAL" />
|
| | | <result column="eo_newer_first_order" property="newerFirstOrder"
|
| | | jdbcType="INTEGER" />
|
| | | <result column="eo_newer_repay_order" property="newerRepayOrder"
|
| | | jdbcType="INTEGER" />
|
| | | <result column="eo_taoke_hongbao" property="taokeHongBao"
|
| | | jdbcType="INTEGER" />
|
| | | <result column="eo_shop_click" property="shopClick" jdbcType="INTEGER" />
|
| | | <result column="eo_recieve_coupon_7day_first_order" property="recieveCoupon7DayFirstOrder"
|
| | | jdbcType="INTEGER" />
|
| | | <result column="eo_settle" property="isSettle" jdbcType="BOOLEAN" />
|
| | | <result column="eo_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="eo_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">eo_id,eo_channel_id,eo_channel_name,eo_track_pid,eo_rid,eo_order_date,eo_order_id,eo_pay_money,eo_city,eo_coupon_money,eo_newer_first_order,eo_newer_repay_order,eo_taoke_hongbao,eo_shop_click,eo_recieve_coupon_7day_first_order,eo_settle,eo_create_time,eo_update_time
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_elme_order where eo_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.String">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_elme_order where eo_order_id = #{0}
|
| | | </select>
|
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_elme_order where eo_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.elme.ElmeOrder"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_elme_order
|
| | | (eo_id,eo_channel_id,eo_channel_name,eo_track_pid,eo_rid,eo_order_date,eo_order_id,eo_pay_money,eo_city,eo_coupon_money,eo_newer_first_order,eo_newer_repay_order,eo_taoke_hongbao,eo_shop_click,eo_recieve_coupon_7day_first_order,eo_settle,eo_create_time,eo_update_time)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{channelId,jdbcType=VARCHAR},#{channelName,jdbcType=VARCHAR},#{trackPid,jdbcType=VARCHAR},#{rid,jdbcType=VARCHAR},#{orderDate,jdbcType=TIMESTAMP},#{orderId,jdbcType=VARCHAR},#{payMoney,jdbcType=DECIMAL},#{city,jdbcType=VARCHAR},#{couponMoney,jdbcType=DECIMAL},#{newerFirstOrder,jdbcType=INTEGER},#{newerRepayOrder,jdbcType=INTEGER},#{taokeHongBao,jdbcType=INTEGER},#{shopClick,jdbcType=INTEGER},#{recieveCoupon7DayFirstOrder,jdbcType=INTEGER},#{isSettle,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.elme.ElmeOrder"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_elme_order
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">eo_id,</if>
|
| | | <if test="channelId != null">eo_channel_id,</if>
|
| | | <if test="channelName != null">eo_channel_name,</if>
|
| | | <if test="trackPid != null">eo_track_pid,</if>
|
| | | <if test="rid != null">eo_rid,</if>
|
| | | <if test="orderDate != null">eo_order_date,</if>
|
| | | <if test="orderId != null">eo_order_id,</if>
|
| | | <if test="payMoney != null">eo_pay_money,</if>
|
| | | <if test="city != null">eo_city,</if>
|
| | | <if test="couponMoney != null">eo_coupon_money,</if>
|
| | | <if test="newerFirstOrder != null">eo_newer_first_order,</if>
|
| | | <if test="newerRepayOrder != null">eo_newer_repay_order,</if>
|
| | | <if test="taokeHongBao != null">eo_taoke_hongbao,</if>
|
| | | <if test="shopClick != null">eo_shop_click,</if>
|
| | | <if test="recieveCoupon7DayFirstOrder != null">eo_recieve_coupon_7day_first_order,</if>
|
| | | <if test="isSettle != null">eo_settle,</if>
|
| | | <if test="createTime != null">eo_create_time,</if>
|
| | | <if test="updateTime != null">eo_update_time,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="channelId != null">#{channelId,jdbcType=VARCHAR},</if>
|
| | | <if test="channelName != null">#{channelName,jdbcType=VARCHAR},</if>
|
| | | <if test="trackPid != null">#{trackPid,jdbcType=VARCHAR},</if>
|
| | | <if test="rid != null">#{rid,jdbcType=VARCHAR},</if>
|
| | | <if test="orderDate != null">#{orderDate,jdbcType=TIMESTAMP},</if>
|
| | | <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
|
| | | <if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="city != null">#{city,jdbcType=VARCHAR},</if>
|
| | | <if test="couponMoney != null">#{couponMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="newerFirstOrder != null">#{newerFirstOrder,jdbcType=INTEGER},</if>
|
| | | <if test="newerRepayOrder != null">#{newerRepayOrder,jdbcType=INTEGER},</if>
|
| | | <if test="taokeHongBao != null">#{taokeHongBao,jdbcType=INTEGER},</if>
|
| | | <if test="shopClick != null">#{shopClick,jdbcType=INTEGER},</if>
|
| | | <if test="recieveCoupon7DayFirstOrder != null">#{recieveCoupon7DayFirstOrder,jdbcType=INTEGER},</if>
|
| | | <if test="isSettle != null">#{isSettle,jdbcType=BOOLEAN},</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.elme.ElmeOrder">update
|
| | | yeshi_ec_elme_order set eo_channel_id =
|
| | | #{channelId,jdbcType=VARCHAR},eo_channel_name =
|
| | | #{channelName,jdbcType=VARCHAR},eo_track_pid =
|
| | | #{trackPid,jdbcType=VARCHAR},eo_rid =
|
| | | #{rid,jdbcType=VARCHAR},eo_order_date =
|
| | | #{orderDate,jdbcType=TIMESTAMP},eo_order_id =
|
| | | #{orderId,jdbcType=VARCHAR},eo_pay_money =
|
| | | #{payMoney,jdbcType=DECIMAL},eo_city =
|
| | | #{city,jdbcType=VARCHAR},eo_coupon_money =
|
| | | #{couponMoney,jdbcType=DECIMAL},eo_newer_first_order =
|
| | | #{newerFirstOrder,jdbcType=INTEGER},eo_newer_repay_order =
|
| | | #{newerRepayOrder,jdbcType=INTEGER},eo_taoke_hongbao =
|
| | | #{taokeHongBao,jdbcType=INTEGER},eo_shop_click =
|
| | | #{shopClick,jdbcType=INTEGER},eo_recieve_coupon_7day_first_order =
|
| | | #{recieveCoupon7DayFirstOrder,jdbcType=INTEGER},eo_settle =
|
| | | #{isSettle,jdbcType=BOOLEAN},eo_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP},eo_update_time =
|
| | | #{updateTime,jdbcType=TIMESTAMP} where eo_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.elme.ElmeOrder">
|
| | | update yeshi_ec_elme_order
|
| | | <set>
|
| | | <if test="channelId != null">eo_channel_id=#{channelId,jdbcType=VARCHAR},</if>
|
| | | <if test="channelName != null">eo_channel_name=#{channelName,jdbcType=VARCHAR},</if>
|
| | | <if test="trackPid != null">eo_track_pid=#{trackPid,jdbcType=VARCHAR},</if>
|
| | | <if test="rid != null">eo_rid=#{rid,jdbcType=VARCHAR},</if>
|
| | | <if test="orderDate != null">eo_order_date=#{orderDate,jdbcType=TIMESTAMP},</if>
|
| | | <if test="orderId != null">eo_order_id=#{orderId,jdbcType=VARCHAR},</if>
|
| | | <if test="payMoney != null">eo_pay_money=#{payMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="city != null">eo_city=#{city,jdbcType=VARCHAR},</if>
|
| | | <if test="couponMoney != null">eo_coupon_money=#{couponMoney,jdbcType=DECIMAL},</if>
|
| | | <if test="newerFirstOrder != null">eo_newer_first_order=#{newerFirstOrder,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="newerRepayOrder != null">eo_newer_repay_order=#{newerRepayOrder,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="taokeHongBao != null">eo_taoke_hongbao=#{taokeHongBao,jdbcType=INTEGER},</if>
|
| | | <if test="shopClick != null">eo_shop_click=#{shopClick,jdbcType=INTEGER},</if>
|
| | | <if test="recieveCoupon7DayFirstOrder != null">eo_recieve_coupon_7day_first_order=#{recieveCoupon7DayFirstOrder,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="isSettle != null">eo_settle=#{isSettle,jdbcType=BOOLEAN},</if>
|
| | | <if test="createTime != null">eo_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">eo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where eo_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | </mapper>
|
| | |
| | | <?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.HongBaoV2Mapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER" /> |
| | | <result column="hb_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="hb_type" property="type" jdbcType="INTEGER" /> |
| | | <result column="hb_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="hb_version" property="version" jdbcType="INTEGER" /> |
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" /> |
| | | <result column="hb_pre_get_time" property="preGetTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <association property="userInfo" column="hb_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="parent" column="hb_pid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <!-- <association property="userInfo" column="hb_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> --> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <resultMap id="BaseDTOResultMap" type="com.yeshi.fanli.dto.HongBaoDTO"> |
| | | <id column="hb_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER" /> |
| | | <result column="hb_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="hb_type" property="type" jdbcType="INTEGER" /> |
| | | <result column="hb_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="hb_version" property="version" jdbcType="INTEGER" /> |
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" /> |
| | | <result column="hb_pre_get_time" property="preGetTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <result column="orderId" property="orderId" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="payMoney" property="payMoney" jdbcType="DECIMAL" /> |
| | | |
| | | <result column="settlement" property="settlement" jdbcType="DECIMAL" /> |
| | | |
| | | <association property="userInfo" column="hb_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="parent" column="hb_pid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | |
| | | <sql id="Base_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} for |
| | | update |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listChildrenById" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_pid = #{0} |
| | | </select> |
| | | |
| | | |
| | | <select id="listCanBalanceHongBaoByType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_version`=2 AND |
| | | h.`hb_type`=#{type} AND (h.`hb_state`=2) AND |
| | | h.`hb_pre_get_time` IS NOT |
| | | NULL AND h.`hb_pre_get_time` |
| | | <![CDATA[ <]]> |
| | | NOW() order by hb_pre_get_time desc limit #{count} |
| | | </select> |
| | | |
| | | <!-- 获取用户奖金列表 --> |
| | | <select id="listJiangJinByUid" resultMap="BaseDTOResultMap"> |
| | | SELECT |
| | | hhh.*,co.`co_order_no` AS orderId,co.`co_payment` AS |
| | | payMoney,co.`co_settlement` AS settlement FROM |
| | | ( |
| | | SELECT |
| | | hh.*,IF(h.`hb_id` IS NOT NULL,h.`hb_id`,hh.hb_id) AS hid FROM |
| | | ( |
| | | SELECT |
| | | h.* FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{uid} and |
| | | (h.`hb_type`=6 OR h.`hb_type`=7 |
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22) AND |
| | | h.`hb_version`=2 ORDER BY h.`hb_create_time` DESC |
| | | limit #{start},#{count} |
| | | ) hh |
| | | LEFT JOIN yeshi_ec_hongbao_v2 h ON |
| | | hh.hb_pid IS NOT NULL AND |
| | | h.`hb_id`=hh.hb_pid |
| | | ) hhh LEFT JOIN |
| | | yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id`=hhh.hid |
| | | LEFT JOIN |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | </select> |
| | | |
| | | |
| | | <!-- 获取用户奖金列表 --> |
| | | <select id="countJiangJinByUid" resultType="java.lang.Long"> |
| | | SELECT count(h.hb_id) |
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{0} and (h.`hb_type`=6 OR |
| | | h.`hb_type`=7 |
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR h.`hb_type`=22) |
| | | AND |
| | | h.`hb_version`=2 |
| | | </select> |
| | | |
| | | <!-- 获取总的提成金额 --> |
| | | <select id="getTotalTiChengMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT |
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE |
| | | h.`hb_uid`=#{0} |
| | | AND h.`hb_state`=3 AND (h.`hb_type`=20 OR |
| | | h.`hb_type`=21 OR h.`hb_type`=22 OR |
| | | h.`hb_type`=6 OR h.`hb_type`=7)) a |
| | | </select> |
| | | |
| | | <!-- 获取总的提成笔数 --> |
| | | <select id="getTotalTiChengCount" resultType="java.lang.Integer" |
| | | parameterType="java.lang.Long"> |
| | | SELECT |
| | | count(*) FROM `yeshi_ec_hongbao_v2` h |
| | | WHERE |
| | | h.`hb_uid`=#{0} AND (h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22 OR |
| | | h.`hb_type`=6 OR h.`hb_type`=7) |
| | | </select> |
| | | |
| | | <!-- 获取还未到账的提成金额 --> |
| | | <select id="getUnGetTiChengMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT |
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE |
| | | h.`hb_uid`=#{0} |
| | | AND (h.`hb_state`=1 OR h.hb_state=2 )AND |
| | | (h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22 OR h.`hb_type`=6 OR |
| | | h.`hb_type`=7)) a |
| | | </select> |
| | | |
| | | |
| | | <select id="getTotalFanLiMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND h.`hb_state`=3 |
| | | </select> |
| | | |
| | | <select id="getUnRecievedFanLiMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND (h.`hb_state`=1 OR |
| | | h.`hb_state`=2) |
| | | </select> |
| | | |
| | | |
| | | <select id="listUidCanBanlanceShareAndInvite" resultType="java.lang.Long" |
| | | parameterType="java.lang.Integer"> |
| | | |
| | | SELECT DISTINCT( h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE |
| | | (`hb_type`=6 OR |
| | | `hb_type`=7 OR `hb_type`=20 OR `hb_type`=21 OR |
| | | `hb_type`=22 ) AND |
| | | `hb_version`=2 AND (hb_state=1 OR hb_state=2) AND |
| | | hb_pre_get_time IS |
| | | NOT NULL AND hb_pre_get_time>0 AND |
| | | NOW()>=hb_pre_get_time limit #{0} |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="listCanBalanceHongBaoByTypeAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where `hb_version`=2 |
| | | <if test="uid!=null"> |
| | | and hb_uid=#{uid} |
| | | </if> |
| | | |
| | | <foreach collection="types" item="type" open=" and (" |
| | | separator=" or " close=")"> |
| | | hb_type = |
| | | #{type} |
| | | </foreach> |
| | | |
| | | and |
| | | (hb_state=1 or hb_state=2) and |
| | | hb_pre_get_time IS NOT NULL AND |
| | | hb_pre_get_time>0 AND |
| | | NOW()>=hb_pre_get_time limit |
| | | #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countCanBalanceHongBaoByTypeAndUid" resultType="java.lang.Long"> |
| | | select |
| | | count(hb_id) |
| | | from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and |
| | | `hb_version`=2 |
| | | |
| | | <foreach collection="types" item="type" open=" and (" |
| | | separator=" or " close=")"> |
| | | hb_type = |
| | | #{type} |
| | | </foreach> |
| | | |
| | | and |
| | | (hb_state=1 or hb_state=2) and |
| | | hb_pre_get_time IS NOT NULL AND |
| | | hb_pre_get_time>0 AND |
| | | NOW()>=hb_pre_get_time |
| | | </select> |
| | | |
| | | |
| | | <select id="countInviteOrderCountByUidAndSettleTime" resultType="java.lang.Long"> |
| | | SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN |
| | | yeshi_ec_hongbao_order ho ON h.`hb_pid`=ho.`ho_hongbao_id` LEFT JOIN |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE |
| | | h.`hb_uid`=#{uid} and (h.`hb_type`=6 or h.`hb_type`=7 OR |
| | | h.`hb_type`=21 OR h.`hb_type`=22) and co.`co_state`=#{state} and |
| | | co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate} |
| | | and #{maxDate}>co.`co_settle_time`; |
| | | </select> |
| | | |
| | | |
| | | <select id="countShareOrderCountByUidAndSettleTime" resultType="java.lang.Long"> |
| | | SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN |
| | | yeshi_ec_hongbao_order ho ON h.`hb_id`=ho.`ho_hongbao_id` LEFT JOIN |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE |
| | | h.`hb_uid`=#{uid} and h.`hb_type`=20 and co.`co_state`=#{state} and |
| | | co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate} |
| | | and #{maxDate}>co.`co_settle_time`; |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getUnRecievedMoneyWithCreateTime" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} |
| | | AND (h.`hb_state`=1 OR |
| | | h.`hb_state`=2) and hb_create_time>=#{minDate} |
| | | and #{maxDate} > hb_create_time |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getUnRecievedMoneyWithPreGetTime" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} |
| | | AND (h.`hb_state`=1 OR |
| | | h.`hb_state`=2) and hb_pre_get_time is not null |
| | | and hb_pre_get_time>=#{minDate} |
| | | and #{maxDate} > hb_pre_get_time |
| | | </select> |
| | | |
| | | |
| | | <select id="countByUidAndState" resultType="java.lang.Long"> |
| | | SELECT |
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} |
| | | AND h.`hb_state`=#{state} |
| | | </select> |
| | | |
| | | |
| | | <select id="computeMoneyByUidAndState" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE |
| | | h.`hb_uid`=#{uid} |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" |
| | | separator=" or " close=")"> |
| | | hb_state=#{state} |
| | | </foreach> |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="getUidByNear30DayShareSucceed" resultType="java.lang.Long"> |
| | | SELECT v2.`hb_uid` FROM yeshi_ec_hongbao_v2 v2 |
| | | WHERE v2.`hb_type` = 20 |
| | | AND v2.`hb_state`<![CDATA[<>]]> |
| | | 4 |
| | | AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[<=]]>DATE(v2.`hb_create_time`) |
| | | GROUP BY v2.`hb_uid` |
| | | ORDER BY v2.`hb_create_time`; |
| | | </select> |
| | | |
| | | |
| | | <select id="listByParentUidAndTypeAndState" resultMap="BaseResultMap"> |
| | | SELECT v.* FROM yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_v2 p |
| | | ON v.`hb_pid`=p.`hb_id` WHERE p.`hb_uid`=#{uid} |
| | | <if test="typeList!=null"> |
| | | <foreach collection="typeList" item="type" open=" and (" |
| | | separator=" or " close=")"> |
| | | v.hb_type=#{type} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" |
| | | separator=" or " close=")"> |
| | | v.hb_state=#{state} |
| | | </foreach> |
| | | </if> |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countByParentUidAndTypeAndState" resultType="java.lang.Long"> |
| | | SELECT count(v.hb_id) FROM yeshi_ec_hongbao_v2 v LEFT JOIN |
| | | yeshi_ec_hongbao_v2 p |
| | | ON v.`hb_pid`=p.`hb_id` WHERE p.`hb_uid`=#{uid} |
| | | <if test="typeList!=null"> |
| | | <foreach collection="typeList" item="type" open=" and (" |
| | | separator=" or " close=")"> |
| | | v.hb_type=#{type} |
| | | </foreach> |
| | | </if> |
| | | <if test="stateList!=null"> |
| | | <foreach collection="stateList" item="state" open=" and (" |
| | | separator=" or " close=")"> |
| | | v.hb_state=#{state} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listBySourceTypeAndTradeIdListAndUid" resultMap="BaseResultMap"> |
| | | SELECT a.* FROM |
| | | ( |
| | | SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`=#{uid} |
| | | ) a |
| | | LEFT JOIN |
| | | ( |
| | | SELECT ho.`ho_hongbao_id` AS hbId FROM yeshi_ec_hongbao_order ho LEFT JOIN |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE |
| | | co.`co_source_type`=#{sourceType} |
| | | <if test="tradeIdList!=null"> |
| | | <foreach collection="tradeIdList" open=" and (" close=")" |
| | | separator=" or " item="tradeId"> |
| | | co.co_trade_id=#{tradeId} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | b |
| | | ON a.hb_id=b.hbId OR a.hb_pid=b.hbId WHERE b.hbId >0 |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_v2 |
| | | (hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{urank,jdbcType=INTEGER},#{parent.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{version,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{preGetTime,jdbcType=TIMESTAMP},#{getTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_hongbao_v2 |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">hb_id,</if> |
| | | <if test="userInfo != null">hb_uid,</if> |
| | | <if test="urank != null">hb_urank,</if> |
| | | <if test="parent != null">hb_pid,</if> |
| | | <if test="money != null">hb_money,</if> |
| | | <if test="type != null">hb_type,</if> |
| | | <if test="state != null">hb_state,</if> |
| | | <if test="version != null">hb_version,</if> |
| | | <if test="beizhu != null">hb_beizhu,</if> |
| | | <if test="preGetTime != null">hb_pre_get_time,</if> |
| | | <if test="getTime != null">hb_get_time,</if> |
| | | <if test="createTime != null">hb_create_time,</if> |
| | | <if test="updateTime != null">hb_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="urank != null">#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">#{getTime,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.HongBaoV2">update |
| | | yeshi_ec_hongbao_v2 set hb_uid = |
| | | #{userInfo.id,jdbcType=BIGINT},hb_urank = |
| | | #{urank,jdbcType=INTEGER},hb_pid = |
| | | #{parent.id,jdbcType=BIGINT},hb_money = |
| | | #{money,jdbcType=DECIMAL},hb_type = #{type,jdbcType=INTEGER},hb_state |
| | | = #{state,jdbcType=INTEGER},hb_version = |
| | | #{version,jdbcType=INTEGER},hb_beizhu = |
| | | #{beizhu,jdbcType=VARCHAR},hb_pre_get_time = |
| | | #{preGetTime,jdbcType=TIMESTAMP},hb_get_time = |
| | | #{getTime,jdbcType=TIMESTAMP},hb_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},hb_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where hb_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | update yeshi_ec_hongbao_v2 |
| | | <set> |
| | | <if test="userInfo != null">hb_uid=#{userInfo.id,jdbcType=BIGINT},</if> |
| | | <if test="urank != null">hb_urank=#{urank,jdbcType=INTEGER},</if> |
| | | <if test="parent != null">hb_pid=#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="money != null">hb_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="type != null">hb_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="state != null">hb_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="version != null">hb_version=#{version,jdbcType=INTEGER},</if> |
| | | <if test="beizhu != null">hb_beizhu=#{beizhu,jdbcType=VARCHAR},</if> |
| | | <if test="preGetTime != null">hb_pre_get_time=#{preGetTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="getTime != null">hb_get_time=#{getTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">hb_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">hb_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where hb_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | | <?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.HongBaoV2Mapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.HongBaoV2">
|
| | | <id column="hb_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER" />
|
| | | <result column="hb_money" property="money" jdbcType="DECIMAL" />
|
| | | <result column="hb_type" property="type" jdbcType="INTEGER" />
|
| | | <result column="hb_state" property="state" jdbcType="INTEGER" />
|
| | | <result column="hb_version" property="version" jdbcType="INTEGER" />
|
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" />
|
| | | <result column="hb_pre_get_time" property="preGetTime"
|
| | | jdbcType="TIMESTAMP" />
|
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" />
|
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
| | |
|
| | | <association property="userInfo" column="hb_uid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | <association property="parent" column="hb_pid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2">
|
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | <!-- <association property="userInfo" column="hb_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> -->
|
| | | </resultMap>
|
| | |
|
| | |
|
| | |
|
| | | <resultMap id="BaseDTOResultMap" type="com.yeshi.fanli.dto.HongBaoDTO">
|
| | | <id column="hb_id" property="id" jdbcType="BIGINT" />
|
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER" />
|
| | | <result column="hb_money" property="money" jdbcType="DECIMAL" />
|
| | | <result column="hb_type" property="type" jdbcType="INTEGER" />
|
| | | <result column="hb_state" property="state" jdbcType="INTEGER" />
|
| | | <result column="hb_version" property="version" jdbcType="INTEGER" />
|
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" />
|
| | | <result column="hb_pre_get_time" property="preGetTime"
|
| | | jdbcType="TIMESTAMP" />
|
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" />
|
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
| | |
|
| | | <result column="orderId" property="orderId" jdbcType="VARCHAR" />
|
| | |
|
| | | <result column="payMoney" property="payMoney" jdbcType="DECIMAL" />
|
| | |
|
| | | <result column="settlement" property="settlement" jdbcType="DECIMAL" />
|
| | |
|
| | | <association property="userInfo" column="hb_uid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | <association property="parent" column="hb_pid"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2">
|
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | </resultMap>
|
| | |
|
| | |
|
| | | <sql id="Base_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} for
|
| | | update
|
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | | <select id="listChildrenById" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_hongbao_v2 where hb_pid = #{0}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listCanBalanceHongBaoByType" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_version`=2 AND
|
| | | h.`hb_type`=#{type} AND (h.`hb_state`=2) AND
|
| | | h.`hb_pre_get_time` IS NOT
|
| | | NULL AND h.`hb_pre_get_time`
|
| | | <![CDATA[ <]]>
|
| | | NOW() order by hb_pre_get_time desc limit #{count}
|
| | | </select>
|
| | |
|
| | | <!-- 获取用户奖金列表 -->
|
| | | <select id="listJiangJinByUid" resultMap="BaseDTOResultMap">
|
| | | SELECT
|
| | | hhh.*,co.`co_order_no` AS orderId,co.`co_payment` AS
|
| | | payMoney,co.`co_settlement` AS settlement FROM
|
| | | (
|
| | | SELECT
|
| | | hh.*,IF(h.`hb_id` IS NOT NULL,h.`hb_id`,hh.hb_id) AS hid FROM
|
| | | (
|
| | | SELECT
|
| | | h.* FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{uid} and
|
| | | (h.`hb_type`=6 OR h.`hb_type`=7
|
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR
|
| | | h.`hb_type`=22) AND
|
| | | h.`hb_version`=2 ORDER BY h.`hb_create_time` DESC
|
| | | limit #{start},#{count}
|
| | | ) hh
|
| | | LEFT JOIN yeshi_ec_hongbao_v2 h ON
|
| | | hh.hb_pid IS NOT NULL AND
|
| | | h.`hb_id`=hh.hb_pid
|
| | | ) hhh LEFT JOIN
|
| | | yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id`=hhh.hid
|
| | | LEFT JOIN
|
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id`
|
| | | </select>
|
| | |
|
| | |
|
| | | <!-- 获取用户奖金列表 -->
|
| | | <select id="countJiangJinByUid" resultType="java.lang.Long">
|
| | | SELECT count(h.hb_id)
|
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{0} and (h.`hb_type`=6 OR
|
| | | h.`hb_type`=7
|
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR h.`hb_type`=22)
|
| | | AND
|
| | | h.`hb_version`=2
|
| | | </select>
|
| | |
|
| | | <!-- 获取总的提成金额 -->
|
| | | <select id="getTotalTiChengMoney" resultType="java.math.BigDecimal"
|
| | | parameterType="java.lang.Long">
|
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT
|
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE
|
| | | h.`hb_uid`=#{0}
|
| | | AND h.`hb_state`=3 AND (h.`hb_type`=20 OR
|
| | | h.`hb_type`=21 OR h.`hb_type`=22 OR
|
| | | h.`hb_type`=6 OR h.`hb_type`=7)) a
|
| | | </select>
|
| | |
|
| | | <!-- 获取总的提成笔数 -->
|
| | | <select id="getTotalTiChengCount" resultType="java.lang.Integer"
|
| | | parameterType="java.lang.Long">
|
| | | SELECT
|
| | | count(*) FROM `yeshi_ec_hongbao_v2` h
|
| | | WHERE
|
| | | h.`hb_uid`=#{0} AND (h.`hb_type`=20 OR h.`hb_type`=21 OR
|
| | | h.`hb_type`=22 OR
|
| | | h.`hb_type`=6 OR h.`hb_type`=7)
|
| | | </select>
|
| | |
|
| | | <!-- 获取还未到账的提成金额 -->
|
| | | <select id="getUnGetTiChengMoney" resultType="java.math.BigDecimal"
|
| | | parameterType="java.lang.Long">
|
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT
|
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE
|
| | | h.`hb_uid`=#{0}
|
| | | AND (h.`hb_state`=1 OR h.hb_state=2 )AND
|
| | | (h.`hb_type`=20 OR h.`hb_type`=21 OR
|
| | | h.`hb_type`=22 OR h.`hb_type`=6 OR
|
| | | h.`hb_type`=7)) a
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="getTotalFanLiMoney" resultType="java.math.BigDecimal"
|
| | | parameterType="java.lang.Long">
|
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h
|
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND h.`hb_state`=3
|
| | | </select>
|
| | |
|
| | | <select id="getUnRecievedFanLiMoney" resultType="java.math.BigDecimal"
|
| | | parameterType="java.lang.Long">
|
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h
|
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND (h.`hb_state`=1 OR
|
| | | h.`hb_state`=2)
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listUidCanBanlanceShareAndInvite" resultType="java.lang.Long"
|
| | | parameterType="java.lang.Integer">
|
| | |
|
| | | SELECT DISTINCT( h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h
|
| | | WHERE
|
| | | (`hb_type`=6 OR
|
| | | `hb_type`=7 OR `hb_type`=20 OR `hb_type`=21 OR
|
| | | `hb_type`=22 ) AND
|
| | | `hb_version`=2 AND (hb_state=1 OR hb_state=2) AND
|
| | | hb_pre_get_time IS
|
| | | NOT NULL AND hb_pre_get_time>0 AND
|
| | | NOW()>=hb_pre_get_time limit #{0}
|
| | |
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listCanBalanceHongBaoByTypeAndUid" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_hongbao_v2 where `hb_version`=2
|
| | | <if test="uid!=null">
|
| | | and hb_uid=#{uid}
|
| | | </if>
|
| | |
|
| | | <foreach collection="types" item="type" open=" and ("
|
| | | separator=" or " close=")">
|
| | | hb_type =
|
| | | #{type}
|
| | | </foreach>
|
| | |
|
| | | and
|
| | | (hb_state=1 or hb_state=2) and
|
| | | hb_pre_get_time IS NOT NULL AND
|
| | | hb_pre_get_time>0 AND
|
| | | NOW()>=hb_pre_get_time limit
|
| | | #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="countCanBalanceHongBaoByTypeAndUid" resultType="java.lang.Long">
|
| | | select
|
| | | count(hb_id)
|
| | | from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and
|
| | | `hb_version`=2
|
| | |
|
| | | <foreach collection="types" item="type" open=" and ("
|
| | | separator=" or " close=")">
|
| | | hb_type =
|
| | | #{type}
|
| | | </foreach>
|
| | |
|
| | | and
|
| | | (hb_state=1 or hb_state=2) and
|
| | | hb_pre_get_time IS NOT NULL AND
|
| | | hb_pre_get_time>0 AND
|
| | | NOW()>=hb_pre_get_time
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countInviteOrderCountByUidAndSettleTime" resultType="java.lang.Long">
|
| | | SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN
|
| | | yeshi_ec_hongbao_order ho ON h.`hb_pid`=ho.`ho_hongbao_id` LEFT JOIN
|
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE
|
| | | h.`hb_uid`=#{uid} and (h.`hb_type`=6 or h.`hb_type`=7 OR
|
| | | h.`hb_type`=21 OR h.`hb_type`=22) and co.`co_state`=#{state} and
|
| | | co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate}
|
| | | and #{maxDate}>co.`co_settle_time`;
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countShareOrderCountByUidAndSettleTime" resultType="java.lang.Long">
|
| | | SELECT COUNT(h.hb_id) FROM yeshi_ec_hongbao_v2 h LEFT JOIN
|
| | | yeshi_ec_hongbao_order ho ON h.`hb_id`=ho.`ho_hongbao_id` LEFT JOIN
|
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE
|
| | | h.`hb_uid`=#{uid} and h.`hb_type`=20 and co.`co_state`=#{state} and
|
| | | co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate}
|
| | | and #{maxDate}>co.`co_settle_time`;
|
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | <select id="getUnRecievedMoneyWithCreateTime" resultType="java.math.BigDecimal">
|
| | | SELECT
|
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h
|
| | | WHERE h.`hb_uid`=#{uid}
|
| | | AND (h.`hb_state`=1 OR
|
| | | h.`hb_state`=2) and hb_create_time>=#{minDate}
|
| | | and #{maxDate} > hb_create_time
|
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | | <select id="getUnRecievedMoneyWithPreGetTime" resultType="java.math.BigDecimal">
|
| | | SELECT
|
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h
|
| | | WHERE h.`hb_uid`=#{uid}
|
| | | AND (h.`hb_state`=1 OR
|
| | | h.`hb_state`=2) and hb_pre_get_time is not null
|
| | | and hb_pre_get_time>=#{minDate}
|
| | | and #{maxDate} > hb_pre_get_time
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countByUidAndState" resultType="java.lang.Long">
|
| | | SELECT
|
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h
|
| | | WHERE h.`hb_uid`=#{uid}
|
| | | AND h.`hb_state`=#{state}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="computeMoneyByUidAndState" resultType="java.math.BigDecimal">
|
| | | SELECT
|
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h
|
| | | WHERE
|
| | | h.`hb_uid`=#{uid}
|
| | | <if test="stateList!=null">
|
| | | <foreach collection="stateList" item="state" open=" and ("
|
| | | separator=" or " close=")">
|
| | | hb_state=#{state}
|
| | | </foreach>
|
| | | </if>
|
| | |
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="getUidByNear30DayShareSucceed" resultType="java.lang.Long">
|
| | | SELECT v2.`hb_uid` FROM yeshi_ec_hongbao_v2 v2
|
| | | WHERE v2.`hb_type` = 20
|
| | | AND v2.`hb_state`<![CDATA[<>]]>
|
| | | 4
|
| | | AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[<=]]>DATE(v2.`hb_create_time`)
|
| | | GROUP BY v2.`hb_uid`
|
| | | ORDER BY v2.`hb_create_time`;
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByParentUidAndTypeAndState" resultMap="BaseResultMap">
|
| | | SELECT v.* FROM yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_v2 p
|
| | | ON v.`hb_pid`=p.`hb_id` WHERE p.`hb_uid`=#{uid}
|
| | | <if test="typeList!=null">
|
| | | <foreach collection="typeList" item="type" open=" and ("
|
| | | separator=" or " close=")">
|
| | | v.hb_type=#{type}
|
| | | </foreach>
|
| | | </if>
|
| | |
|
| | | <if test="stateList!=null">
|
| | | <foreach collection="stateList" item="state" open=" and ("
|
| | | separator=" or " close=")">
|
| | | v.hb_state=#{state}
|
| | | </foreach>
|
| | | </if>
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | | <select id="countByParentUidAndTypeAndState" resultType="java.lang.Long">
|
| | | SELECT count(v.hb_id) FROM yeshi_ec_hongbao_v2 v LEFT JOIN
|
| | | yeshi_ec_hongbao_v2 p
|
| | | ON v.`hb_pid`=p.`hb_id` WHERE p.`hb_uid`=#{uid}
|
| | | <if test="typeList!=null">
|
| | | <foreach collection="typeList" item="type" open=" and ("
|
| | | separator=" or " close=")">
|
| | | v.hb_type=#{type}
|
| | | </foreach>
|
| | | </if>
|
| | | <if test="stateList!=null">
|
| | | <foreach collection="stateList" item="state" open=" and ("
|
| | | separator=" or " close=")">
|
| | | v.hb_state=#{state}
|
| | | </foreach>
|
| | | </if>
|
| | | </select>
|
| | |
|
| | | <select id="listBySourceTypeAndTradeIdListAndUid" resultMap="BaseResultMap">
|
| | | SELECT a.* FROM
|
| | | (
|
| | | SELECT * FROM yeshi_ec_hongbao_v2 v WHERE v.`hb_uid`=#{uid}
|
| | | ) a |
| | | LEFT JOIN
|
| | | (
|
| | | SELECT ho.`ho_hongbao_id` AS hbId FROM yeshi_ec_hongbao_order ho LEFT JOIN
|
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE
|
| | | co.`co_source_type`=#{sourceType}
|
| | | <if test="tradeIdList!=null">
|
| | | <foreach collection="tradeIdList" open=" and (" close=")"
|
| | | separator=" or " item="tradeId">
|
| | | co.co_trade_id=#{tradeId}
|
| | | </foreach>
|
| | | </if>
|
| | | )
|
| | | b
|
| | | ON a.hb_id=b.hbId OR a.hb_pid=b.hbId WHERE b.hbId >0
|
| | | </select>
|
| | |
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_v2
|
| | | (hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{urank,jdbcType=INTEGER},#{parent.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{version,jdbcType=INTEGER},#{beizhu,jdbcType=VARCHAR},#{preGetTime,jdbcType=TIMESTAMP},#{getTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | | insert into yeshi_ec_hongbao_v2
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">hb_id,</if>
|
| | | <if test="userInfo != null">hb_uid,</if>
|
| | | <if test="urank != null">hb_urank,</if>
|
| | | <if test="parent != null">hb_pid,</if>
|
| | | <if test="money != null">hb_money,</if>
|
| | | <if test="type != null">hb_type,</if>
|
| | | <if test="state != null">hb_state,</if>
|
| | | <if test="version != null">hb_version,</if>
|
| | | <if test="beizhu != null">hb_beizhu,</if>
|
| | | <if test="preGetTime != null">hb_pre_get_time,</if>
|
| | | <if test="getTime != null">hb_get_time,</if>
|
| | | <if test="createTime != null">hb_create_time,</if>
|
| | | <if test="updateTime != null">hb_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="urank != null">#{urank,jdbcType=INTEGER},</if>
|
| | | <if test="parent != null">#{parent.id,jdbcType=BIGINT},</if>
|
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if>
|
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if>
|
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if>
|
| | | <if test="version != null">#{version,jdbcType=INTEGER},</if>
|
| | | <if test="beizhu != null">#{beizhu,jdbcType=VARCHAR},</if>
|
| | | <if test="preGetTime != null">#{preGetTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="getTime != null">#{getTime,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.HongBaoV2">update
|
| | | yeshi_ec_hongbao_v2 set hb_uid =
|
| | | #{userInfo.id,jdbcType=BIGINT},hb_urank =
|
| | | #{urank,jdbcType=INTEGER},hb_pid =
|
| | | #{parent.id,jdbcType=BIGINT},hb_money =
|
| | | #{money,jdbcType=DECIMAL},hb_type = #{type,jdbcType=INTEGER},hb_state
|
| | | = #{state,jdbcType=INTEGER},hb_version =
|
| | | #{version,jdbcType=INTEGER},hb_beizhu =
|
| | | #{beizhu,jdbcType=VARCHAR},hb_pre_get_time =
|
| | | #{preGetTime,jdbcType=TIMESTAMP},hb_get_time =
|
| | | #{getTime,jdbcType=TIMESTAMP},hb_create_time =
|
| | | #{createTime,jdbcType=TIMESTAMP},hb_update_time =
|
| | | #{updateTime,jdbcType=TIMESTAMP} where hb_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2">
|
| | | update yeshi_ec_hongbao_v2
|
| | | <set>
|
| | | <if test="userInfo != null">hb_uid=#{userInfo.id,jdbcType=BIGINT},</if>
|
| | | <if test="urank != null">hb_urank=#{urank,jdbcType=INTEGER},</if>
|
| | | <if test="parent != null">hb_pid=#{parent.id,jdbcType=BIGINT},</if>
|
| | | <if test="money != null">hb_money=#{money,jdbcType=DECIMAL},</if>
|
| | | <if test="type != null">hb_type=#{type,jdbcType=INTEGER},</if>
|
| | | <if test="state != null">hb_state=#{state,jdbcType=INTEGER},</if>
|
| | | <if test="version != null">hb_version=#{version,jdbcType=INTEGER},</if>
|
| | | <if test="beizhu != null">hb_beizhu=#{beizhu,jdbcType=VARCHAR},</if>
|
| | | <if test="preGetTime != null">hb_pre_get_time=#{preGetTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="getTime != null">hb_get_time=#{getTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="createTime != null">hb_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">hb_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </set>
|
| | | where hb_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | </mapper>
|
| | |
| | | </select> |
| | | |
| | | <select id="countValidOrderByDate" resultType="Long"> |
| | | SELECT IFNULL(COUNT(co.`co_id`),0) FROM yeshi_ec_common_order co |
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON co.`co_id`=ho.`ho_order_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id=ho.`ho_hongbao_id` |
| | | WHERE co.`co_uid` = #{uid} AND v2.`hb_type` = 1 AND v2.`hb_state` = 3 |
| | | AND co.`co_third_create_time` > #{dateTime} |
| | | SELECT IFNULL(COUNT(co_order_no),0) FROM |
| | | (SELECT DISTINCT co.co_order_no FROM yeshi_ec_common_order co |
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON co.`co_id`=ho.`ho_order_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 v2 ON v2.hb_id=ho.`ho_hongbao_id` |
| | | WHERE co.`co_uid` = #{uid} AND v2.`hb_type` = 1 |
| | | AND v2.`hb_state` = 3 AND AND co.`co_third_create_time` <![CDATA[>]]> #{dateTime})A |
| | | </select> |
| | | </mapper> |
| | |
| | | continue;
|
| | | }
|
| | |
|
| | | Integer state = oldExtra.getState();
|
| | | if (state != null && state == 1) {
|
| | | continue;
|
| | | }
|
| | | /*
|
| | | * Integer state = oldExtra.getState(); if (state != null && state == 1) {
|
| | | * continue; }
|
| | | */
|
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | try {
|
| | |
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.math.BigDecimal;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.Iterator;
|
| | |
| | | import org.dom4j.Element;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.entity.wx.RedPackParams;
|
| | | import org.yeshi.utils.entity.wx.RedPackRecord;
|
| | | import org.yeshi.utils.wx.WXPayUtil;
|
| | |
|
| | | import com.alipay.api.AlipayApiException;
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public void downAutoOpenIdFile() {
|
| | | @Override
|
| | | public List<String> getAutoExtractOpenIds() throws Exception {
|
| | | int page = 0;
|
| | | int pageSize = 100;
|
| | | int maxSize = 300;
|
| | | Date nowDate = new Date();
|
| | | // 条件3:距离上一次成功领取微信红包已经超过了30天时间,可在第31天再次下发;
|
| | | String receivedDate = DateUtil.reduceDayTostring(30, nowDate);
|
| | | // 条件4:距离上一次未成功领取微信红包已经超过了15天时间,可在第16天再次下发;
|
| | | String refundDate = DateUtil.reduceDayTostring(15, nowDate);
|
| | |
|
| | | // 提现金额
|
| | | BigDecimal money = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MONEY);
|
| | | // 余额最低限制
|
| | | BigDecimal minSurplus = BigDecimal.valueOf(Constant.AUTO_EXTRACT_MIN_SURPLUS);
|
| | |
|
| | | List<String> listOpendIDs = new ArrayList<String>();
|
| | | // 首行appID
|
| | | listOpendIDs.add(Constant.getWXAccount(null, null).getAppId());
|
| | |
|
| | | while (true) {
|
| | | // 查询满足条件 1、2 的uid
|
| | | List<Long> listId = userInfoService.getAutoExtractUserIds(page * pageSize, pageSize, minSurplus);
|
| | | if (listId == null || listId.isEmpty())
|
| | | break;
|
| | | |
| | | // 查询记录是否满足
|
| | | List<Long> listValid = extractWeiXinRecordService.getValidUsers(listId, receivedDate, refundDate);
|
| | | if (listValid == null || listValid.isEmpty()) {
|
| | | page ++;
|
| | | continue;
|
| | | }
|
| | | |
| | | for (Long uid: listValid) {
|
| | | UserInfo userInfo = subHongBaoByUid(uid, money, minSurplus);
|
| | | if (userInfo != null) {
|
| | | listOpendIDs.add(userInfo.getWxOpenId());
|
| | | if (listOpendIDs.size() >= maxSize)
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | if (listOpendIDs.size() >= maxSize)
|
| | | break;
|
| | | |
| | | page ++;
|
| | | }
|
| | | return listOpendIDs;
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private UserInfo subHongBaoByUid(Long uid, BigDecimal money, BigDecimal minSurplus) {
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo != null && userInfo.getMyHongBao().compareTo(minSurplus) >= 0) {
|
| | | // 微信提现记录
|
| | | ExtractWeiXinRecord extractRecord = new ExtractWeiXinRecord();
|
| | | extractRecord.setUid(uid);
|
| | | extractRecord.setOpenId(userInfo.getWxOpenId());
|
| | | extractRecord.setUnionId(userInfo.getWxUnionId());
|
| | | extractRecord.setMoney(money);
|
| | | extractRecord.setStatus(ExtractWeiXinRecord.SENDING);
|
| | | extractRecord.setType(ExtractWeiXinRecord.TYPE_MANUAL);
|
| | | extractRecord.setCreateTime(new Date());
|
| | | extractRecord.setUpdateTime(new Date());
|
| | | extractWeiXinRecordService.insertSelective(extractRecord);
|
| | | // 记录id
|
| | | Long recordId = extractRecord.getId();
|
| | | |
| | | // 资金明细
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractAutoWX.name() + ":" + recordId));
|
| | | detail.setMoney(new BigDecimal("-"+ money.toString()));
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractAutoWX.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractAutoWX);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(userInfo);
|
| | | |
| | | // 资金计算
|
| | | userMoneyService.subUserMoney(userInfo.getId(), money, detail);
|
| | |
|
| | | // 4、发送消息通知
|
| | | String desc = "为保障你的账户余额安全,自动提现金额将不会高于5元";
|
| | | String beizu = "账户中剩余余额请在本App内完成提现";
|
| | | userMoneyMsgNotificationService.extractAuto(extractRecord, "未领取-提现中", desc, beizu);
|
| | | |
| | | // 满足条件返回信息
|
| | | return userInfo;
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void updateManualExtractRecord(List<RedPackRecord> list) throws ExtractException{
|
| | | if (list == null || list.isEmpty())
|
| | | throw new ExtractException(1, "红包记录信息为空");
|
| | |
|
| | | for (RedPackRecord redPackRecord: list) {
|
| | | updateWeiXinRecord(redPackRecord);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | private void updateWeiXinRecord(RedPackRecord redPackRecord){
|
| | | if (StringUtil.isNullOrEmpty(redPackRecord.getOpenId()))
|
| | | return;
|
| | |
|
| | | ExtractWeiXinRecord record = extractWeiXinRecordService.getByOpenIdAndType(redPackRecord.getOpenId(), ExtractWeiXinRecord.TYPE_MANUAL);
|
| | | if (record == null)
|
| | | return;
|
| | | |
| | | // 状态过滤
|
| | | String statusOld = record.getStatus();
|
| | | if (StringUtil.isNullOrEmpty(statusOld) ||ExtractWeiXinRecord.REFUND.equals(statusOld) |
| | | || ExtractWeiXinRecord.RFUND_ING.equals(statusOld)) |
| | | return;
|
| | | |
| | | ExtractWeiXinRecord updeteRecord = new ExtractWeiXinRecord();
|
| | | updeteRecord.setId(record.getId());
|
| | | updeteRecord.setUpdateTime(new Date());
|
| | | |
| | | String billno = redPackRecord.getBillno();
|
| | | if (!StringUtil.isNullOrEmpty(billno)) {
|
| | | updeteRecord.setBillno(billno.replace("`", ""));
|
| | | }
|
| | | |
| | | String detailno = redPackRecord.getDetailno();
|
| | | if (!StringUtil.isNullOrEmpty(detailno)) {
|
| | | updeteRecord.setDetailno(detailno.replace("`", ""));
|
| | | }
|
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
|
| | | String rcvTime = redPackRecord.getRcvTime();
|
| | | if (!StringUtil.isNullOrEmpty(rcvTime)) {
|
| | | try {
|
| | | updeteRecord.setRcvTime(sdf.parse(rcvTime));
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | String sendTime = redPackRecord.getSendTime();
|
| | | if (!StringUtil.isNullOrEmpty(sendTime)) {
|
| | | try {
|
| | | updeteRecord.setSendTime(sdf.parse(sendTime));
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | String status = redPackRecord.getStatus();
|
| | | if (!StringUtil.isNullOrEmpty(status)) {
|
| | | switch (status) {
|
| | | case "已发放待领取":
|
| | | status = ExtractWeiXinRecord.SENT;
|
| | | break;
|
| | | case "过期未领退款":
|
| | | status = ExtractWeiXinRecord.REFUND;
|
| | | break;
|
| | | case "已领取":
|
| | | status = ExtractWeiXinRecord.RECEIVED;
|
| | | break;
|
| | | default:
|
| | | status = null;
|
| | | break;
|
| | | } |
| | | }
|
| | | updeteRecord.setStatus(status);
|
| | | |
| | | // 更新红包记录
|
| | | extractWeiXinRecordService.updateByPrimaryKeySelective(updeteRecord);
|
| | | |
| | | if (!ExtractWeiXinRecord.REFUND.equals(status))
|
| | | return;
|
| | | |
| | | // 资金明细
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.extractAutoWXRefund.name() + ":" + record.getId()));
|
| | | detail.setMoney(record.getMoney());
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.extractAutoWXRefund.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.extractAutoWXRefund);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(record.getUid()));
|
| | | |
| | | // 资金计算
|
| | | userMoneyService.addUserMoney(record.getUid(), record.getMoney(), detail);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.money.extract;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
| | | public void updateByPrimaryKeySelective(ExtractWeiXinRecord record) {
|
| | | extractWeiXinRecordMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<Long> getValidUsers(List<Long> list, String receivedDate, String refundDate) {
|
| | | return extractWeiXinRecordMapper.getValidUsers(list, receivedDate, refundDate);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ExtractWeiXinRecord getByOpenIdAndType(String openId, Integer type) {
|
| | | return extractWeiXinRecordMapper.getByOpenIdAndType(openId, type);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extractAutoWX) {
|
| | | if (detail.getMoney() == null || detail.getUser() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setRead(false);
|
| | | msgMoneyDetailMapper.insertSelective(detail);
|
| | | }
|
| | |
|
| | | userMsgReadStateService.addMoneyMsgUnReadCount(detail.getUser().getId(), 1);
|
| | |
| | | userInfo.setNickName(nickName);
|
| | | userInfoMapper.updateByPrimaryKeySelective(userInfo);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<Long> getAutoExtractUserIds(int start, int count, BigDecimal minSurplus) {
|
| | | return userInfoMapper.getAutoExtractUserIds(start, count, minSurplus);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.yeshi.utils.entity.wx.RedPackRecord;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | * @param user
|
| | | */
|
| | | public void autoExtract(UserInfo user);
|
| | | |
| | |
|
| | |
|
| | | /**
|
| | | * 获取自动提现openid
|
| | | * @return
|
| | | */
|
| | | public List<String> getAutoExtractOpenIds() throws Exception;
|
| | |
|
| | | /**
|
| | | * 更新手动微信提现红包记录
|
| | | * @param list
|
| | | * @throws ExtractException
|
| | | */
|
| | | public void updateManualExtractRecord(List<RedPackRecord> list) throws ExtractException;
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.money.extract;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord;
|
| | |
|
| | | public interface ExtractWeiXinRecordService {
|
| | |
| | | public void insertSelective(ExtractWeiXinRecord record);
|
| | |
|
| | | public void updateByPrimaryKeySelective(ExtractWeiXinRecord record);
|
| | |
|
| | | /**
|
| | | * 查询有效用户ID
|
| | | */
|
| | | public List<Long> getValidUsers(List<Long> list, String receivedDate, String refundDate);
|
| | |
|
| | | /**
|
| | | * 根据openid、发放方式
|
| | | * @param openId
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public ExtractWeiXinRecord getByOpenIdAndType(String openId, Integer type);
|
| | |
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.InviteUser;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.user.UserInfoException;
|
| | | import com.yeshi.fanli.vo.user.UserInfoVO;
|
| | |
| | | */
|
| | | public void saveUserInfo(String nickName, Long uid) throws UserInfoException;
|
| | |
|
| | | |
| | | /**
|
| | | * 获取可提现用户列表
|
| | | * @param page
|
| | | * @param count
|
| | | */
|
| | | public List<Long> getAutoExtractUserIds(int page, int count, BigDecimal minSurplus);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | // 微信自动提现金额
|
| | | public static final int AUTO_EXTRACT_MONEY = 1;
|
| | | // 微信自动提现最低余额
|
| | | public static final int AUTO_EXTRACT_MIN_SURPLUS = 2;
|
| | |
|
| | | public static WXGZConfig wxGZConfig;
|
| | |
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(filterMoney(msg.getMoney()) + "元", COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | if (!StringUtil.isNullOrEmpty(isFreeShipping)) {
|
| | | goods.setIsFreeShipping(Integer.parseInt(isFreeShipping));
|
| | | }
|
| | |
|
| | | String inOrderCount = json.optString("inOrderCount");
|
| | | if (!StringUtil.isNullOrEmpty(isFreeShipping)) {
|
| | | goods.setInOrderCount30Days(Long.parseLong(inOrderCount));
|
| | | }
|
| | | |
| | | goods.setCouponInfo(null);
|
| | | goods.setGoodCommentsShare(null);
|
| | | List<String> imageList = new ArrayList<>();
|
| | | imageList.add(json.optString("imgUrl"));
|
| | | goods.setPicUrl(json.optString("imgUrl"));
|
| | | goods.setImageList(imageList);
|
| | | goods.setInOrderCount30Days(0L);
|
| | | goods.setIsHot(null);
|
| | | goods.setMaterialUrl(json.optString("materialUrl"));
|
| | | goods.setOwner(null);
|
| | |
| | | <?xml version="1.0"?> |
| | | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <groupId>com.yeshi</groupId> |
| | | <artifactId>FanLiMain</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.yeshi</groupId> |
| | | <artifactId>utils</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>utils</name> |
| | | <url>http://maven.apache.org</url> |
| | | <properties> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | </properties> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <version>3.8.1</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
| | | <?xml version="1.0"?>
|
| | | <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
| | | <modelVersion>4.0.0</modelVersion>
|
| | | <parent>
|
| | | <groupId>com.yeshi</groupId>
|
| | | <artifactId>FanLiMain</artifactId>
|
| | | <version>0.0.1-SNAPSHOT</version>
|
| | | </parent>
|
| | | <groupId>com.yeshi</groupId>
|
| | | <artifactId>utils</artifactId>
|
| | | <version>0.0.1-SNAPSHOT</version>
|
| | | <name>utils</name>
|
| | | <url>http://maven.apache.org</url>
|
| | | <properties>
|
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
| | | </properties>
|
| | | <dependencies>
|
| | | <dependency>
|
| | | <groupId>junit</groupId>
|
| | | <artifactId>junit</artifactId>
|
| | | <version>3.8.1</version>
|
| | | <scope>test</scope>
|
| | | </dependency>
|
| | | |
| | | <!-- csv文件解析依赖 -->
|
| | | <dependency>
|
| | | <groupId>com.opencsv</groupId>
|
| | | <artifactId>opencsv</artifactId>
|
| | | <version>4.3.2</version>
|
| | | </dependency>
|
| | |
|
| | | </dependencies>
|
| | | </project>
|
New file |
| | |
| | | package org.yeshi.utils;
|
| | |
|
| | | import java.io.InputStreamReader;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import com.opencsv.bean.CsvToBean;
|
| | | import com.opencsv.bean.CsvToBeanBuilder;
|
| | | import com.opencsv.bean.HeaderColumnNameMappingStrategy;
|
| | |
|
| | | public class CsvUtil {
|
| | |
|
| | | /**
|
| | | * 解析csv文件并转成bean
|
| | | * |
| | | * @param file csv文件
|
| | | * @param clazz 类
|
| | | * @param <T> 泛型
|
| | | * @return 泛型bean集合
|
| | | */
|
| | | public static <T> List<T> getCsvData(MultipartFile file, Class<T> clazz) {
|
| | | InputStreamReader in = null;
|
| | | try {
|
| | | in = new InputStreamReader(file.getInputStream(), "gbk");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | HeaderColumnNameMappingStrategy<T> strategy = new HeaderColumnNameMappingStrategy<>();
|
| | | strategy.setType(clazz);
|
| | |
|
| | | CsvToBean<T> csvToBean = new CsvToBeanBuilder<T>(in).withSeparator(',').withQuoteChar('\'')
|
| | | .withMappingStrategy(strategy).build();
|
| | | return csvToBean.parse();
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | return ca.getTime();
|
| | | }
|
| | | |
| | | /**
|
| | | * 指定日期减去天数后的日期
|
| | | * |
| | | * @param num 减去的天数
|
| | | * @param nowDate 创建时间
|
| | | * @return
|
| | | * @throws ParseException
|
| | | */
|
| | | public static String reduceDayTostring(int num, Date date) throws ParseException {
|
| | | // 设置要获取到什么样的时间
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
| | | // 获取String类型的时间
|
| | | String date_str = format.format(date);
|
| | | Date currdate = format.parse(date_str);
|
| | |
|
| | | Calendar ca = Calendar.getInstance();
|
| | | ca.setTime(currdate);
|
| | | ca.add(Calendar.DATE, -num); // 日期减 如果不够减会将月变动
|
| | | return format.format(ca.getTime());
|
| | | }
|
| | |
|
| | | /**
|
| | | * 计算两个日期之间相差的天数
|
New file |
| | |
| | | package org.yeshi.utils.entity.wx;
|
| | |
|
| | | import com.opencsv.bean.CsvBindByName;
|
| | |
|
| | | /**
|
| | | * 微信自动提现记录
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class RedPackRecord {
|
| | | // openId
|
| | | @CsvBindByName(column = "用户openid", required = true)
|
| | | private String openId;
|
| | | // 交易订单号
|
| | | @CsvBindByName(column = "商户订单号")
|
| | | private String billno;
|
| | | |
| | | // 红包订单-微信
|
| | | @CsvBindByName(column = "红包订单号")
|
| | | private String detailno;
|
| | |
|
| | | // 红包状态-微信
|
| | | @CsvBindByName(column = "红包状态")
|
| | | private String status;
|
| | | |
| | | // 发出时间-微信
|
| | | @CsvBindByName(column = "发送时间")
|
| | | private String sendTime;
|
| | | |
| | | // 接收时间-微信
|
| | | @CsvBindByName(column = "更新(领取/退款)时间")
|
| | | private String rcvTime;
|
| | | |
| | |
|
| | | public String getOpenId() {
|
| | | return openId;
|
| | | }
|
| | |
|
| | | public void setOpenId(String openId) {
|
| | | this.openId = openId;
|
| | | }
|
| | |
|
| | | public String getBillno() {
|
| | | return billno;
|
| | | }
|
| | |
|
| | | public void setBillno(String billno) {
|
| | | this.billno = billno;
|
| | | }
|
| | |
|
| | | public String getDetailno() {
|
| | | return detailno;
|
| | | }
|
| | |
|
| | | public void setDetailno(String detailno) {
|
| | | this.detailno = detailno;
|
| | | }
|
| | |
|
| | | public String getStatus() {
|
| | | return status;
|
| | | }
|
| | |
|
| | | public void setStatus(String status) {
|
| | | this.status = status;
|
| | | }
|
| | |
|
| | | public String getSendTime() {
|
| | | return sendTime;
|
| | | }
|
| | |
|
| | | public void setSendTime(String sendTime) {
|
| | | this.sendTime = sendTime;
|
| | | }
|
| | |
|
| | | public String getRcvTime() {
|
| | | return rcvTime;
|
| | | }
|
| | |
|
| | | public void setRcvTime(String rcvTime) {
|
| | | this.rcvTime = rcvTime;
|
| | | }
|
| | | }
|