提成优化,视频管理优化
This commit is contained in:
parent
79f1b9b23c
commit
9f2b055dee
@ -2,14 +2,20 @@ package com.stdiet.web.controller.custom;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.domain.SysCommissionDayDetail;
|
||||
import com.stdiet.custom.domain.SysOrder;
|
||||
import com.stdiet.custom.domain.SysOrderCommisionDayDetail;
|
||||
import com.stdiet.custom.dto.request.SysOrderCommision;
|
||||
import com.stdiet.custom.service.ISysCommissionDayService;
|
||||
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
import com.stdiet.custom.service.ISysOrderService;
|
||||
import com.stdiet.custom.service.impl.SysCommissionDayServiceImpl;
|
||||
import com.stdiet.framework.web.domain.server.Sys;
|
||||
import com.stdiet.system.domain.CusSalesman;
|
||||
import com.stdiet.system.service.ISysUserService;
|
||||
@ -41,6 +47,7 @@ import com.stdiet.common.core.page.TableDataInfo;
|
||||
@RestController
|
||||
@RequestMapping("/custom/commision")
|
||||
public class SysCommisionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysCommisionService sysCommisionService;
|
||||
|
||||
@ -50,6 +57,9 @@ public class SysCommisionController extends BaseController {
|
||||
@Autowired
|
||||
private ISysCommissionDayService sysCommissionDayService;
|
||||
|
||||
@Autowired
|
||||
private ISysNutritionalVideoService sysNutritionalVideoService;
|
||||
|
||||
/**
|
||||
* 查询业务提成比例列表
|
||||
*/
|
||||
@ -158,6 +168,14 @@ public class SysCommisionController extends BaseController {
|
||||
@GetMapping("/detail")
|
||||
public TableDataInfo getDetail(SysCommision sysCommision) {
|
||||
startPage();
|
||||
if(sysCommision.getPostId() != null && sysCommision.getPostId().intValue() > 0){
|
||||
//查询售后所有ID
|
||||
SysCommision param = new SysCommision();
|
||||
param.setPostId(sysCommision.getPostId());
|
||||
List<Long> userIds = sysCommisionService.getAfterSaleId(param);
|
||||
sysCommision.setUserIds(userIds.size() == 0 ? null : userIds);
|
||||
sysCommision.setPostId(null);
|
||||
}
|
||||
List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision);
|
||||
for (SysCommision detail : list) {
|
||||
detail.setRate(0F);
|
||||
@ -165,22 +183,38 @@ public class SysCommisionController extends BaseController {
|
||||
tmpQueryCom.setUserId(detail.getUserId());
|
||||
tmpQueryCom.setPostId(detail.getPostId());
|
||||
List<SysCommision> tmpComList = sysCommisionService.selectSysCommisionList(tmpQueryCom);
|
||||
|
||||
//按比例开始时间分类
|
||||
Map<String, List<SysCommision>> rateYearMonthMap = sysCommissionDayService.getRateMapByStartTime(tmpComList);
|
||||
String yearMonth = DateUtils.stringToLocalDate(sysCommision.getBeginTime(),"yyyy-MM-dd").getYear() + "" + DateUtils.stringToLocalDate(sysCommision.getBeginTime(),"yyyy-MM-dd").getMonth().getValue();
|
||||
List<SysCommision> yearMonthRateList = new ArrayList<>();
|
||||
for (String rateMonth : rateYearMonthMap.keySet()) {
|
||||
if(Long.parseLong(yearMonth) >= Long.parseLong(rateMonth)){
|
||||
yearMonthRateList = rateYearMonthMap.get(rateMonth);
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
float dAmount = detail.getAmount().floatValue();
|
||||
for (int i = 0; i < tmpComList.size(); i++) {
|
||||
SysCommision com = tmpComList.get(i);
|
||||
for (int i = 0; i < yearMonthRateList.size(); i++) {
|
||||
SysCommision com = yearMonthRateList.get(i);
|
||||
float cAmount = com.getAmount().floatValue();
|
||||
if (dAmount <= cAmount && i == 0) {
|
||||
Long rateStartYearMonth = null;
|
||||
if(com.getStartTime() != null){
|
||||
rateStartYearMonth = Long.parseLong(DateUtils.dateToLocalDate(com.getStartTime()).getYear() + "" + DateUtils.dateToLocalDate(com.getStartTime()).getMonth().getValue());
|
||||
}else{
|
||||
rateStartYearMonth = 19001L;
|
||||
}
|
||||
if (dAmount <= cAmount && i == 0 && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 第一条规则
|
||||
detail.setRate(com.getRate());
|
||||
break;
|
||||
} else if (i == tmpComList.size() - 1 && dAmount > cAmount) {
|
||||
} else if (i == yearMonthRateList.size() - 1 && dAmount > cAmount && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 最后一条规则
|
||||
detail.setRate(com.getRate());
|
||||
break;
|
||||
} else if (cAmount < dAmount && dAmount <= tmpComList.get(i + 1).getAmount().floatValue()) {
|
||||
} else if (cAmount < dAmount && dAmount <= yearMonthRateList.get(i + 1).getAmount().floatValue() && Long.parseLong(yearMonth) >= rateStartYearMonth) {
|
||||
// 中间规则
|
||||
detail.setRate(tmpComList.get(i + 1).getRate());
|
||||
detail.setRate(yearMonthRateList.get(i + 1).getRate());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -188,6 +222,7 @@ public class SysCommisionController extends BaseController {
|
||||
float amount = detail.getAmount().floatValue();
|
||||
amount = amount * detail.getRate() / 100F;
|
||||
detail.setCommision(new BigDecimal(amount));
|
||||
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
@ -57,7 +57,11 @@ public class SysNutritionalVideoController extends BaseController
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysNutritionalVideoService.selectSysNutritionalVideoById(id));
|
||||
SysNutritionalVideo sysNutritionalVideos = sysNutritionalVideoService.selectSysNutritionalVideoById(id);
|
||||
if(sysNutritionalVideos != null && StringUtils.isNotEmpty(sysNutritionalVideos.getCoverUrl())){
|
||||
sysNutritionalVideos.setPreviewUrl(AliyunOSSUtils.generatePresignedUrl(sysNutritionalVideos.getCoverUrl()));
|
||||
}
|
||||
return AjaxResult.success(sysNutritionalVideos);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,7 @@ import com.stdiet.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务提成比例对象 sys_commision
|
||||
@ -30,6 +31,8 @@ public class SysCommision extends BaseEntity {
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
/**
|
||||
* 岗位id
|
||||
*/
|
||||
|
@ -32,6 +32,9 @@ public class SysNutritionalVideo extends BaseEntity
|
||||
@Excel(name = "视频封面URL")
|
||||
private String coverUrl;
|
||||
|
||||
//预览URL
|
||||
private String previewUrl;
|
||||
|
||||
/** 视频标题 */
|
||||
@Excel(name = "视频标题")
|
||||
private String title;
|
||||
|
@ -68,4 +68,6 @@ public interface SysCommisionMapper
|
||||
* @return
|
||||
*/
|
||||
List<SysCommision> getAfterSaleAndNutri(SysCommision sysCommision);
|
||||
|
||||
List<Long> getAfterSaleId(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -62,4 +62,11 @@ public interface ISysCommisionService
|
||||
public int deleteSysCommisionById(Long ruleId);
|
||||
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision);
|
||||
|
||||
/**
|
||||
* 查询售后、营养师用户信息
|
||||
* @param sysCommision
|
||||
* @return
|
||||
*/
|
||||
List<Long> getAfterSaleId(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -39,4 +39,11 @@ public interface ISysCommissionDayService {
|
||||
*/
|
||||
AjaxResult calculateOrderCommissionDetail(SysCommision sysCommision);
|
||||
|
||||
/**
|
||||
* 根据开始生效时间分类提成比例
|
||||
* @param tmpComList
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<SysCommision>> getRateMapByStartTime(List<SysCommision> tmpComList);
|
||||
|
||||
}
|
||||
|
@ -98,4 +98,14 @@ public class SysCommisionServiceImpl implements ISysCommisionService
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision) {
|
||||
return sysCommisionMapper.selectSysCommisionDetail(sysCommision);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询售后、营养师用户信息
|
||||
* @param sysCommision
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getAfterSaleId(SysCommision sysCommision){
|
||||
return sysCommisionMapper.getAfterSaleId(sysCommision);
|
||||
}
|
||||
}
|
||||
|
@ -407,6 +407,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
* @param tmpComList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, List<SysCommision>> getRateMapByStartTime(List<SysCommision> tmpComList){
|
||||
Map<String, List<SysCommision>> result = new TreeMap<>(new MyComparator());
|
||||
for (SysCommision sysCommision : tmpComList) {
|
||||
|
@ -115,6 +115,12 @@
|
||||
<where>
|
||||
<if test="postId != null and postId != ''">and post_id = #{postId}</if>
|
||||
<if test="userId != null and userId != ''">and user_id = #{userId}</if>
|
||||
<if test="userIds != null">
|
||||
and user_id in
|
||||
<foreach item="id" collection="userIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -213,4 +219,11 @@
|
||||
<if test="postId != null and postId != ''">and sp.post_id = #{postId}</if>
|
||||
<if test="userId != null and userId != ''">and su.user_id = #{userId}</if>
|
||||
</select>
|
||||
|
||||
<select id="getAfterSaleId" parameterType="SysCommision" resultType="Long">
|
||||
SELECT su.user_id FROM sys_user su
|
||||
LEFT JOIN sys_user_post sup ON sup.user_id = su.user_id
|
||||
LEFT JOIN sys_post sp ON sp.post_id = sup.post_id
|
||||
WHERE su.del_flag = 0 and sp.post_id = #{postId}
|
||||
</select>
|
||||
</mapper>
|
@ -7,7 +7,7 @@
|
||||
:on-success="handleFileSuccess"
|
||||
:accept="'.png,.jpg'"
|
||||
:before-upload="beforeAvatarUpload">
|
||||
<img v-if="imageUrl" :src="imageUrl" class="avatar">
|
||||
<img v-if="imageUrl || coverUrl" :src="imageUrl || coverUrl" class="avatar">
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
1、只能上传png、jpg文件,且每个文件不超过{{
|
||||
@ -75,6 +75,10 @@ export default {
|
||||
prefix: {
|
||||
type: String,
|
||||
default: "videoCover",
|
||||
},
|
||||
coverUrl:{
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<el-dialog title="视频上传" v-if="open" :visible.sync="open" width="700px" :close-on-click-modal="false" :show-close="false" append-to-body>
|
||||
<el-form ref="videoFrom" :model="videoFrom" :rules="videoRules" label-width="80px">
|
||||
<el-row :gutter="15">
|
||||
<el-form-item label="视频标题" prop="title">
|
||||
<el-input
|
||||
type="textarea"
|
||||
@ -24,7 +25,8 @@
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="videoFrom.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
@ -34,8 +36,8 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="视频权限" prop="payLevel">
|
||||
<el-select v-model="videoFrom.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
@ -46,6 +48,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-form-item label="视频文件" prop="file">
|
||||
<div>
|
||||
@ -55,6 +58,15 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="展示状态" prop="wxShow">
|
||||
<el-switch
|
||||
v-model="videoFrom.wxShow"
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="authUpload" :disabled="uploadDisabled">开始上传</el-button>
|
||||
@ -109,7 +121,7 @@
|
||||
pauseDisabled: true,
|
||||
uploader: null,
|
||||
statusText: '',
|
||||
fileType:['mp4'],
|
||||
fileType:['mp4','MP4'],
|
||||
uploading: false
|
||||
}
|
||||
},
|
||||
@ -143,8 +155,9 @@
|
||||
title: null,
|
||||
description: null,
|
||||
tags: null,
|
||||
payLevel: null,
|
||||
videoId: null
|
||||
payLevel: 0,
|
||||
videoId: null,
|
||||
wxShow: false
|
||||
};
|
||||
if(this.$refs.uploadFile){
|
||||
this.$refs.uploadFile.resetUpload();
|
||||
@ -321,6 +334,7 @@
|
||||
self.statusText = '文件上传完毕'
|
||||
self.uploading = false;
|
||||
//self.msgSuccess("上传成功");
|
||||
self.videoFrom.showFlag = self.videoFrom.wxShow ? 1 : 0;
|
||||
addNutritionalVideo(self.videoFrom).then(response => {
|
||||
if (response.code === 200) {
|
||||
self.msgSuccess("视频上传成功");
|
||||
|
@ -149,33 +149,61 @@
|
||||
/>
|
||||
|
||||
<!-- 添加或修改营养视频对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="视频分类ID" prop="cateId">
|
||||
<el-input v-model="form.cateId" placeholder="请输入视频分类ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="阿里云视频ID" prop="videoId">
|
||||
<el-input v-model="form.videoId" placeholder="请输入阿里云视频ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面URL" prop="coverUrl">
|
||||
<el-input v-model="form.coverUrl" placeholder="请输入视频封面URL" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频标题" prop="title">
|
||||
<el-input v-model="form.title" placeholder="请输入视频标题" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频标题"
|
||||
v-model="form.title"
|
||||
maxlength="50"
|
||||
rows="1"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入视频描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="视频大小,单位:字节" prop="videoSize">
|
||||
<el-input v-model="form.videoSize" placeholder="请输入视频大小,单位:字节" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标签,使用 , 隔开" prop="tags">
|
||||
<el-input v-model="form.tags" placeholder="请输入标签,使用 , 隔开" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示,0不显示 1显示,默认0" prop="showFlag">
|
||||
<el-input v-model="form.showFlag" placeholder="请输入是否显示,0不显示 1显示,默认0" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
placeholder="请输入视频描述"
|
||||
v-model="form.description"
|
||||
maxlength="1000"
|
||||
rows="2"
|
||||
show-word-limit
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频封面" prop="coverUrl">
|
||||
<UploadFile ref="uploadFile" :prefix="'videoCover'" :coverUrl="form.previewUrl" @callbackMethod="handleCoverUrl"></UploadFile>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频类别" prop="cateId">
|
||||
<el-select v-model="form.cateId" clearable filterable placeholder="请选择类别">
|
||||
<el-option
|
||||
v-for="classify in classifyList"
|
||||
:key="classify.id"
|
||||
:label="classify.cateName"
|
||||
:value="classify.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="视频权限" prop="payLevel">
|
||||
<el-select v-model="form.payLevel" clearable filterable placeholder="请选择权限">
|
||||
<el-option
|
||||
v-for="dict in payVideoLevelList"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="parseInt(dict.dictValue)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="展示状态" prop="wxShow">
|
||||
<el-switch
|
||||
v-model="form.wxShow"
|
||||
active-text="小程序展示"
|
||||
inactive-text="小程序不展示">
|
||||
</el-switch>
|
||||
<div>提示:请保证内容正确再展示到小程序</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
@ -190,6 +218,7 @@
|
||||
import { listNutritionalVideo, getNutritionalVideo, delNutritionalVideo, addNutritionalVideo, updateNutritionalVideo, exportNutritionalVideo, updateWxShow } from "@/api/custom/nutritionalVideo";
|
||||
import {getAllClassify } from "@/api/custom/videoClassify";
|
||||
import UploadVideo from "@/components/UploadVideo";
|
||||
import UploadFile from "@/components/FileUpload/UploadFile";
|
||||
export default {
|
||||
name: "NutritionalVideo",
|
||||
data() {
|
||||
@ -245,7 +274,7 @@
|
||||
});
|
||||
},
|
||||
components: {
|
||||
UploadVideo
|
||||
UploadVideo,UploadFile
|
||||
},
|
||||
methods: {
|
||||
/** 查询营养视频列表 */
|
||||
@ -270,18 +299,13 @@
|
||||
this.form = {
|
||||
id: null,
|
||||
cateId: null,
|
||||
videoId: null,
|
||||
coverUrl: null,
|
||||
title: null,
|
||||
description: null,
|
||||
videoSize: null,
|
||||
tags: null,
|
||||
payLevel:null,
|
||||
showFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null
|
||||
wxShow: false
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@ -317,15 +341,17 @@
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getNutritionalVideo(id).then(response => {
|
||||
response.data.wxShow = response.data.showFlag == 1 ? true : false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改营养视频";
|
||||
});
|
||||
this.open = true;
|
||||
this.title = "修改营养视频";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.showFlag = this.form.wxShow ? 1 : 0;
|
||||
if (this.form.id != null) {
|
||||
updateNutritionalVideo(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
@ -353,6 +379,9 @@
|
||||
};
|
||||
updateWxShow(param);
|
||||
},
|
||||
handleCoverUrl(url){
|
||||
this.form.coverUrl = url;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
|
Loading…
x
Reference in New Issue
Block a user