Commit 023f1d40 authored by unset's avatar unset

会员分成记录信息

parent 9bd06b53
......@@ -106,6 +106,11 @@ public class ResultCode {
// 用户已存在
public static int USER_EXIST_CODE = Integer.valueOf(SystemProperty.getResultConfig("USER_EXIST_CODE"));
// 会员等级信息不存在
public static int USER_MEMBER_INFO_NOT_EXIST_CODE = Integer.valueOf(SystemProperty.getResultConfig("USER_MEMBER_INFO_NOT_EXIST_CODE"));
// 手机号已绑定人脸
public static int WX_BIND_CODE = Integer.valueOf(SystemProperty.getResultConfig("WX_BIND_CODE"));
......
......@@ -107,6 +107,10 @@ USER_NOTEXIST_CODE=5002
USER_EXIST_CODE=5003
5003=用户不存在
USER_MEMBER_INFO_NOT_EXIST_CODE = 5004
5004 = 会员等级信息不存在
ORG_INSERT_FAILED_CODE=6001
6001=新增组织失败
......
......@@ -19,4 +19,6 @@ public class MemberShareCountRecordDto extends PageParam {
private String startDate;
private String endDate;
private String name;
}
......@@ -77,6 +77,12 @@ public class MemberShareCountRecord implements Serializable {
@ApiModelProperty(value = "会员等级")
private Integer memberLevel;
@Column(name = "count_day")
@ApiModelProperty(value = "统计日期")
private String countDay;
private Integer issue;
@Transient
private String levelName;
}
......@@ -197,6 +197,8 @@ public class MemberShareRecordBiz extends BaseBiz<MemberShareRecordMapper, Membe
memberShareCountRecord.setAmount(entry.getValue());
memberShareCountRecord.setMemberLevel(level);
memberShareCountRecord.setCountMonth(dateTime.toString("yyyy-MM"));
memberShareCountRecord.setCountDay(dateTime.toString("dd"));
memberShareCountRecord.setIssue(0);
memberShareCountRecord.setCrtTime(System.currentTimeMillis());
memberShareCountRecord.setUpdTime(System.currentTimeMillis());
memberShareCountRecordList.add(memberShareCountRecord);
......@@ -303,13 +305,23 @@ public class MemberShareRecordBiz extends BaseBiz<MemberShareRecordMapper, Membe
}
if (list.size() == 0) {
Map<String, Object> map = new HashMap<String, Object>();
writer.addHeaderAlias("countMonth", "统计月份");
writer.addHeaderAlias("userId", "用户id");
writer.addHeaderAlias("realName", "真实姓名");
writer.addHeaderAlias("orderNo", "订单编号");
writer.addHeaderAlias("payUser", "下单用户");
writer.addHeaderAlias("payTime", "支付时间");
writer.addHeaderAlias("orderAmount", "订单金额");
writer.addHeaderAlias("totalAmount", "总分红");
writer.addHeaderAlias("userNum", "分红人数");
writer.addHeaderAlias("realName", "分红人");
writer.addHeaderAlias("levelName", "等级");
writer.addHeaderAlias("amount", "金额");
map.put("userId", "");
map.put("orderNo", "");
map.put("payUser", "");
map.put("payTime", "");
map.put("orderAmount", "");
map.put("totalAmount", "");
map.put("userNum", "");
map.put("realName", "");
map.put("countMonth", "");
map.put("levelName", "");
map.put("amount", "");
list.add(map);
}
......
......@@ -5,12 +5,16 @@ import com.github.wxiaoqi.security.admin.dto.MemberShareRecordDto;
import com.github.wxiaoqi.security.admin.entity.MemberShareRecord;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("memberShareRecord")
@Slf4j
public class MemberShareRecordController extends BaseController<MemberShareRecordBiz, MemberShareRecord> {
/**
......@@ -30,4 +34,16 @@ public class MemberShareRecordController extends BaseController<MemberShareRecor
public void generateData() {
baseBiz.generateData();
}
@GetMapping(value = "export")
public ObjectRestResponse export(HttpServletResponse response, MemberShareRecordDto memberShareRecordDto) {
try {
baseBiz.exportRecordList(response, memberShareRecordDto);
} catch (Exception e) {
log.error("{}", e);
return ObjectRestResponse.createDefaultFail();
}
return ObjectRestResponse.succ();
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.MemberShareCountRecordMapper">
<insert id="batchSave" parameterType="list">
insert into member_share_count_record ( user_id, real_name, count_month, amount, crt_time, upd_time, member_level)
insert into member_share_count_record ( user_id, real_name, count_month, amount, crt_time, upd_time, member_level, issue, count_day)
VALUES
<foreach collection="list" item="emp" index="index" separator=",">
(
......@@ -14,7 +14,9 @@
#{emp.amount,jdbcType=DECIMAL},
#{emp.crtTime,jdbcType=TIMESTAMP},
#{emp.updTime,jdbcType=TIMESTAMP},
#{emp.memberLevel,jdbcType=INTEGER}
#{emp.memberLevel,jdbcType=INTEGER},
#{emp.issue,jdbcType=INTEGER},
#{emp.countDay,jdbcType=VARCHAR}
)
</foreach>
ON DUPLICATE KEY UPDATE
......@@ -24,7 +26,9 @@
amount = values(amount),
crt_time = values(crt_time),
upd_time = values(upd_time),
member_level = values(member_level)
member_level = values(member_level),
issue = values(issue),
count_day = values(count_day)
</insert>
<select id="selectList" resultType="com.github.wxiaoqi.security.admin.entity.MemberShareCountRecord">
......@@ -35,6 +39,9 @@
<if test="userId != null">
and msr.user_id = #{userId}
</if>
<if test="name != null">
and aud.realname like concat('%', #{name}, '%')
</if>
<if test="startDate != null and startDate != ''">
and msr.count_month between #{startDate} and #{endDate}
</if>
......
package com.xxfc.platform.order.pojo.order;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderMemberDetail;
import com.xxfc.platform.order.entity.OrderTourDetail;
import com.xxfc.platform.order.entity.inter.OrderDetail;
import com.xxfc.platform.tour.entity.TourGood;
import com.xxfc.platform.tour.entity.TourUser;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -41,4 +36,6 @@ public class MemberBO extends OrderMemberDetail implements OrderDetail {
* 订单子项
*/
List<OrderItem> items;
}
......@@ -3,6 +3,7 @@ package com.xxfc.platform.order.pojo.order.add;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.format.DateTimeFormatter;
@Data
......@@ -21,4 +22,18 @@ public class AddMemberDTO extends AddOrderCommonDTO{
@ApiModelProperty(value = "优惠卷卷号")
private String tickerNos;
/**
* 用户手机号
*/
private String phone;
/**
* 下单时间
*/
private Long payTime;
/**
* 订单金额
*/
private BigDecimal orderAmount;
}
package com.xxfc.platform.order.biz;
import org.springframework.stereotype.Service;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderMemberDetail;
import com.xxfc.platform.order.mapper.OrderMemberDetailMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.pojo.order.add.AddMemberDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
/**
*
......@@ -15,4 +25,39 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class OrderMemberDetailBiz extends BaseBiz<OrderMemberDetailMapper,OrderMemberDetail> {
@Autowired
UserFeign userFeign;
@Autowired
BaseOrderBiz baseOrderBiz;
/**
* 后台创建订单
* @param dto
*/
public void createOrder(AddMemberDTO dto) {
AppUserLogin appUserLogin = userFeign.one(dto.getPhone());
if (appUserLogin != null) {
List<BaseUserMemberLevel> baseUserMemberLevelList = userFeign.levels();
if (baseUserMemberLevelList != null && baseUserMemberLevelList.size() > 0) {
BaseOrder baseOrder = new BaseOrder();
AtomicReference<BaseUserMemberLevel> currentLevel = null;
baseUserMemberLevelList.parallelStream().forEach(baseUserMemberLevel -> {
if (dto.getMemberLevel().equals(baseUserMemberLevel.getLevel())) {
currentLevel.set(baseUserMemberLevel);
}
});
if (currentLevel != null && currentLevel.get() != null) {
}
} else {
throw new BaseException(ResultCode.getMsg(ResultCode.USER_MEMBER_INFO_NOT_EXIST_CODE));
}
} else {
throw new BaseException(ResultCode.getMsg(ResultCode.USER_NOTEXIST_CODE));
}
}
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.biz.OrderMemberDetailBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderMemberDetail;
......@@ -61,6 +60,14 @@ public class OrderMemberController extends BaseController<OrderMemberDetailBiz,
//return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "为了更好地为您提供会员服务,请联系在线客服(或拨打客服电话:4000-369-369)");
}
@RequestMapping(value = "/baseOrder/createOrder", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "后台添加会员订单")
public ObjectRestResponse<BaseOrder> createOrder(@RequestBody AddMemberDTO dto) {
baseBiz.createOrder(dto);
return ObjectRestResponse.succ();
}
/**
* 会员订单列表
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment