Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
2 files added
5 files modified
| | |
| | | import com.xzx.gc.common.request.BaseController; |
| | | import com.xzx.gc.entity.AccountInfo; |
| | | import com.xzx.gc.entity.RedPaperRule; |
| | | import com.xzx.gc.entity.UserHeadRelate; |
| | | import com.xzx.gc.model.JsonResult; |
| | | import com.xzx.gc.user.dto.*; |
| | | import com.xzx.gc.user.mapper.AccountMapper; |
| | | import com.xzx.gc.user.mapper.RedPaperRuleMapper; |
| | | import com.xzx.gc.user.mapper.UserHeadRelateMapper; |
| | | import com.xzx.gc.user.service.DistribService; |
| | | import com.xzx.gc.user.vo.*; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Autowired |
| | | private AccountMapper accountMapper; |
| | | |
| | | @Autowired |
| | | private UserHeadRelateMapper userHeadRelateMapper; |
| | | |
| | | /** |
| | | * 查看分銷系統设置详情 |
| | |
| | | || accountInfo.getIsProhibit() == "1"){ |
| | | return JsonResult.failMessage("账户已冻结!"); |
| | | } |
| | | //团员不能当团长 |
| | | String userId = accountInfo.getUserId(); |
| | | UserHeadRelate userHeadRelate = userHeadRelateMapper.selectMemberByUserId(userId); |
| | | if(ObjectUtil.isNotEmpty(userHeadRelate)){ |
| | | return JsonResult.failMessage("账户不能申请成为团长!"); |
| | | } |
| | | distribService.adddistrib(model); |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.USER_MODUL_NAME).operateAction("分銷系統管理--新增团长-"+id).build(); |
| | |
| | | return JsonResult.success("操作成功!"); |
| | | } |
| | | |
| | | @ApiOperation(value = "团长数据") |
| | | @ApiOperation(value = "团长数据--头部") |
| | | @ApiResponses( |
| | | @ApiResponse(code = 200, message = "success", response = DistribDataInfoVo.class) |
| | | ) |
| | | @PostMapping(value = Constants.ADMIN_VIEW_PREFIX + "/distrib/distribDataInfo.json") |
| | | public JsonResult<DistribDataInfoVo> distribDataInfo(@RequestBody DistribDataInfoDto distribDataInfoDto) { |
| | | return JsonResult.success(distribService.distribDataInfo(distribDataInfoDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "团长数据--列表") |
| | | @ApiResponses( |
| | | @ApiResponse(code = 200, message = "success", response = DistribDataListVo.class) |
| | | ) |
New file |
| | |
| | | package com.xzx.gc.user.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class DistribDataInfoDto { |
| | | } |
| | |
| | | @ApiModelProperty(value="结束时间") |
| | | private Date reserveTimeEnd; |
| | | |
| | | @ApiModelProperty(value = "是否禁用 0:未冻结,1:冻结") |
| | | private String isProhibit; |
| | | |
| | | @ApiModelProperty(value="第几页",required=true) |
| | | private int page; |
| | | |
| | |
| | | |
| | | List<JhyOrderItems> selectOrderById(@Param("orderId")Long orderId); |
| | | |
| | | List<DistribDataListVo> distribDataList(DistribDataListDto distribDataListDto); |
| | | List<DistribDataListVo> distribDataList(@Param("record")DistribDataListDto distribDataListDto); |
| | | |
| | | String selectOrderByHeadUserId(@Param("accountId")String accountId); |
| | | |
| | | String selectJDSLByHeadUserId(@Param("accountId")String id); |
| | | |
| | | DistribDataInfoVo selectDistribDataInfoVo(); |
| | | } |
| | | |
| | |
| | | viewSettingVo.setRegularPoint(StrUtil.isEmpty(shareRatios.get(2))?0:Integer.parseInt(shareRatios.get(2))); |
| | | viewSettingVo.setRegularMoneyPercent(StrUtil.isEmpty(shareRatios.get(3))?BigDecimal.ZERO:new BigDecimal(shareRatios.get(3))); |
| | | // viewSettingVo.setFinishOrderNum(StrUtil.isEmpty(shareRatios.get(4))?0:Integer.parseInt(shareRatios.get(4))); |
| | | viewSettingVo.setPointReward(StrUtil.isEmpty(shareRatios.get(5))?0:Integer.parseInt(shareRatios.get(5))); |
| | | viewSettingVo.setPointReward(StrUtil.isEmpty(shareRatios.get(4))?0:Integer.parseInt(shareRatios.get(4))); |
| | | viewSettingVo.setStatus(redPaperRule.getStatus()); |
| | | } |
| | | }else{ |
| | |
| | | stringBuffer.append(pointReward); |
| | | redPaperRule.setStatus((short) 0); |
| | | redPaperRule.setRuleName("分销规则"); |
| | | redPaperRule.setSharingProfitType("frist_reward,order_num_frist,regular_point,regular_money_percent,finish_order_num,point_reward"); |
| | | redPaperRule.setSharingProfitType("frist_reward,order_num_frist,regular_point,regular_money_percent,point_reward"); |
| | | redPaperRule.setShareRatio(stringBuffer.toString()); |
| | | redPaperRuleMapper.insert(redPaperRule); |
| | | } |
| | |
| | | int pointReward = ObjectUtil.isEmpty(model.getPointReward()) ? 0 : model.getPointReward(); |
| | | stringBuffer.append(pointReward); |
| | | redPaperRule.setStatus(model.getStatus()); |
| | | redPaperRule.setSharingProfitType("first_reward,order_num_first,regular_point,regular_money_percent,finish_order_num,point_reward"); |
| | | redPaperRule.setSharingProfitType("first_reward,order_num_first,regular_point,regular_money_percent,point_reward"); |
| | | redPaperRule.setShareRatio(stringBuffer.toString()); |
| | | redPaperRuleMapper.updateByPrimaryKey(redPaperRule); |
| | | } |
| | |
| | | if(CollUtil.isNotEmpty(distribDataListVos)){ |
| | | for(DistribDataListVo distribDataListVo : distribDataListVos){ |
| | | if(ObjectUtil.isNotEmpty(distribDataListVo)){ |
| | | String id = distribDataListVo.getId(); |
| | | String kg = accountMapper.selectOrderByHeadUserId(id); |
| | | distribDataListVo.setKg(kg); |
| | | String jdsl = accountMapper.selectJDSLByHeadUserId(id); |
| | | distribDataListVo.setJdsl(jdsl); |
| | | } |
| | | } |
| | | } |
| | |
| | | data.put("code", 0); |
| | | return data; |
| | | } |
| | | |
| | | public DistribDataInfoVo distribDataInfo(DistribDataInfoDto distribDataInfoDto) { |
| | | return accountMapper.selectDistribDataInfoVo(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.xzx.gc.user.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "DistribDataInfoVo", description = "返回参数类") |
| | | public class DistribDataInfoVo { |
| | | |
| | | @ApiModelProperty(value = "团长人数") |
| | | private Integer cnt; |
| | | |
| | | @ApiModelProperty(value = "累计收益") |
| | | private String amount; |
| | | |
| | | @ApiModelProperty(value = "累计交易订单") |
| | | private String orderCnt; |
| | | |
| | | } |
| | |
| | | <if test="record.phone != null and record.phone != ''"> |
| | | and b.mobile_phone like concat('%',#{record.phone},'%') |
| | | </if> |
| | | <if test="record.isProhibit != null and record.isProhibit != ''"> |
| | | and a.is_prohibit = #{record.isProhibit} |
| | | </if> |
| | | <if test="record.reserveTimeStart != null"> |
| | | and b.regist_time >= #{record.reserveTimeStart} |
| | | </if> |
| | |
| | | a.order_no orderNo, |
| | | a.score scoreReward, |
| | | a.amount amountReward, |
| | | sum(c.score) amount |
| | | sum(c.score) score, |
| | | sum(c.score/40) amount |
| | | FROM |
| | | xzx_user_head_details a |
| | | LEFT JOIN xzx_jhy_order b on a.order_no = b.order_no |
| | |
| | | </select> |
| | | |
| | | <select id="distribDataList" resultType="com.xzx.gc.user.vo.DistribDataListVo"> |
| | | SELECT |
| | | a.account_id id, |
| | | b.nick_name nickname, |
| | | b.mobile_phone phone, |
| | | b.regist_time registTime, |
| | | a.is_head isHead, |
| | | (select IFNULL(count(1), 0) from xzx_user_head_relate where head_user_id = a.user_id) cnt, |
| | | (select IFNULL(count(1), 0) from xzx_user_head_details where head_user_id = a.user_id) orderCnt, |
| | | (select IFNULL(sum(amount), 0) from xzx_user_head_relate where head_user_id = a.user_id) amount, |
| | | (select IFNULL(sum(score), 0) from xzx_user_head_relate where head_user_id = a.user_id ) score, |
| | | a.is_prohibit isProhibit |
| | | FROM |
| | | xzx_account_info a |
| | | LEFT JOIN xzx_user_info b on a.user_id = b.user_id |
| | | <where> |
| | | 1=1 |
| | | and a.is_head = 1 |
| | | <if test="record.name != null and record.name != ''"> |
| | | and b.nick_name like concat('%',#{record.name},'%') |
| | | </if> |
| | | <if test="record.phone != null and record.phone != ''"> |
| | | and b.mobile_phone like concat('%',#{record.phone},'%') |
| | | </if> |
| | | <if test="record.reserveTimeStart != null"> |
| | | and b.regist_time >= #{record.reserveTimeStart} |
| | | </if> |
| | | SELECT |
| | | a.account_id id, |
| | | b.nick_name nickname, |
| | | b.mobile_phone phone, |
| | | b.regist_time registTime, |
| | | a.is_head isHead, |
| | | (select IFNULL(count(1), 0) from xzx_user_head_relate where head_user_id = a.user_id) cnt, |
| | | (select IFNULL(count(1), 0) from xzx_user_head_details where head_user_id = a.user_id) orderCnt, |
| | | (select IFNULL(sum(amount), 0) from xzx_user_head_relate where head_user_id = a.user_id) amount, |
| | | (select IFNULL(sum(score), 0) from xzx_user_head_relate where head_user_id = a.user_id ) score, |
| | | a.is_prohibit isProhibit |
| | | FROM |
| | | xzx_account_info a |
| | | LEFT JOIN xzx_user_info b on a.user_id = b.user_id |
| | | <where> |
| | | 1=1 |
| | | and a.is_head = 1 |
| | | <if test="record.name != null and record.name != ''"> |
| | | and b.nick_name like concat('%',#{record.name},'%') |
| | | </if> |
| | | <if test="record.phone != null and record.phone != ''"> |
| | | and b.mobile_phone like concat('%',#{record.phone},'%') |
| | | </if> |
| | | <if test="record.reserveTimeStart != null"> |
| | | and b.regist_time >= #{record.reserveTimeStart} |
| | | </if> |
| | | |
| | | <if test="record.reserveTimeEnd != null"> |
| | | and b.regist_time <= #{record.reserveTimeEnd} |
| | | </if> |
| | | </where> |
| | | order by id desc |
| | | </select> |
| | | <if test="record.reserveTimeEnd != null"> |
| | | and b.regist_time <= #{record.reserveTimeEnd} |
| | | </if> |
| | | </where> |
| | | order by id desc |
| | | </select> |
| | | |
| | | <select id="selectOrderByHeadUserId" resultType="java.lang.String"> |
| | | SELECT |
| | | IFNULL(SUM(weight),0) as kg |
| | | FROM |
| | | xzx_jhy_order_items |
| | | WHERE |
| | | order_id in ( |
| | | SELECT |
| | | id |
| | | FROM |
| | | xzx_jhy_order |
| | | WHERE |
| | | order_no in ( |
| | | SELECT |
| | | order_no |
| | | FROM |
| | | xzx_user_head_details |
| | | WHERE |
| | | head_user_id = ( |
| | | SELECT |
| | | user_id |
| | | FROM |
| | | xzx_account_info |
| | | WHERE |
| | | account_id = #{accountId} |
| | | ) |
| | | ) |
| | | ) |
| | | </select> |
| | | |
| | | <select id="selectJDSLByHeadUserId" resultType="java.lang.String"> |
| | | SELECT |
| | | IFNULL(SUM(a.weight),0) as jdsl |
| | | FROM |
| | | xzx_jhy_order_items a |
| | | left join xzx_sys_environmental_info b on a.item_type = b.id |
| | | WHERE |
| | | b.item_unit = '台' and |
| | | a.order_id in ( |
| | | SELECT |
| | | id |
| | | FROM |
| | | xzx_jhy_order |
| | | WHERE |
| | | order_no in ( |
| | | SELECT |
| | | order_no |
| | | FROM |
| | | xzx_user_head_details |
| | | WHERE |
| | | head_user_id = ( |
| | | SELECT |
| | | user_id |
| | | FROM |
| | | xzx_account_info |
| | | WHERE |
| | | account_id = #{accountId} |
| | | ) |
| | | ) |
| | | ) |
| | | </select> |
| | | |
| | | <select id="selectDistribDataInfoVo" resultType="com.xzx.gc.user.vo.DistribDataInfoVo"> |
| | | SELECT |
| | | IFNULL(count(1), 0) cnt, |
| | | SUM((select IFNULL(count(1), 0) from xzx_user_head_details where head_user_id = a.user_id) ) orderCnt, |
| | | SUM((select IFNULL(sum(amount), 0) from xzx_user_head_details where head_user_id = a.user_id) ) amount |
| | | FROM |
| | | xzx_account_info a |
| | | where |
| | | 1=1 |
| | | and a.is_head = 1 |
| | | </select> |
| | | |
| | | </mapper> |