记得上下班打卡 | git大法好,push需谨慎

Commit 1181c7a5 authored by GaoHu's avatar GaoHu

Merge branch 'gaohu_0826_smileExit' into pre

parents 2514659e 6cfcfdd8
......@@ -20,11 +20,14 @@ public class SmileRedisConst {
public static final String SELL_DATA_COMMISSION = PREFIX.concat("sellDataCommission:"); //销售数据 第一步
public static final String SELL_SHOW_PAYMENT = PREFIX.concat("show:payment:"); //打款信息 SELL_SHOW_PAYMENT+演出id+uid
public static final String SELL_SHOW_SAVE = PREFIX.concat("show:save:"); //演出打款vo数据 SELL_SHOW_SAVE+演出id
public static final String SELL_SHOW_PAYMENT_ENDJOB = PREFIX.concat("show:payment:endJob"); //定时任务结算信息 SELL_SHOW_PAYMENT_ENDJOB+演出id+uid
public static final String SELL_USER_REVENUE = PREFIX.concat("user:revenue:"); //用户总营收 SELL_USER_REVENUE+uid
public static final String SELL_USER_DATA = PREFIX.concat("user:data:"); //用户总营收 SELL_USER_REVENUE+perId+uid
public static final String SELL_TEST = PREFIX.concat("test"); //用户总营收 SELL_USER_REVENUE+uid
public static final String SELL_SHOW_POEN = PREFIX.concat("show:poen:"); //代理总销售数量
......
package com.liquidnet.client.admin.web.controller.zhengzai.smile;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.smile.dto.SaleDataVo;
import com.liquidnet.client.admin.zhengzai.smile.dto.ShowSort;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmilePriceParam;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileShowParam;
import com.liquidnet.client.admin.zhengzai.smile.service.ISmileShowService;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
/**
* @author TT
*/
@Api(tags = "演出管理")
@Controller
@RequestMapping("/smile/show/base")
@Slf4j
public class SmileShowBaseController extends BaseController {
private String prefix = "zhengzai/smile";
......@@ -42,6 +49,39 @@ public class SmileShowBaseController extends BaseController {
return prefix + "/smileTickets/saleData";
}
@GetMapping("/export")
@ApiOperation("单个演出销售列表导出")
@ResponseBody
public void export(String perId,String title, HttpServletResponse response) {
ServletOutputStream servletOutputStream = null;
try {
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename="
.concat(new String((title + DateUtil.getNowTime() + "代理数据").getBytes("gb2312"), StandardCharsets.ISO_8859_1)).concat(ExcelTypeEnum.XLSX.getValue()));
response.setContentType(MediaType.MULTIPART_FORM_DATA_VALUE);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
servletOutputStream = response.getOutputStream();
//数据查询
/*
SaleDataVo saleDataVo = smileShowService.saleData(performancesId);
List<UserDataExcel> rowsToExcels = new ArrayList<>();
saleDataVo.getUserDataList().forEach(userData -> rowsToExcels.add(UserDataExcel.getNew().copy(userData)));
EasyExcel.write(servletOutputStream,UserDataExcel.class).sheet(saleDataVo.getTitle() + "演出销售列表导出").doWrite(rowsToExcels);
*/
smileShowService.exportData(servletOutputStream,perId);
} catch (IOException e) {
log.error("单个演出销售列表导出异常[performancesId={},ex.msg={}]", perId, e.getLocalizedMessage());
} finally {
if (null != servletOutputStream) {
try {
servletOutputStream.close();
} catch (Exception ignored) {
}
}
}
}
/*@GetMapping("/saleDataTest/{performancesId}")
@ApiOperation("销售数据Test")
@ApiImplicitParams({
......
......@@ -42,6 +42,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">代理数据:</label>
<a style="margin-left: 500px" href="javascript:void(0)" class="btn btn-success btn-xs" onclick="onexport()"><i class="fa fa-edit"></i>导出</a>
<table id="team-table2" class="table table-condensed table-sm" th:border="1">
<tr>
<td>姓名</td>
......@@ -65,7 +66,7 @@
<td th:if="${item.type==2}" th:text="普代"></td>
<td th:each="itemAgent : ${item.dataAgentVos}" th:text="${itemAgent.number}"></td>
<td th:text="${#aggregates.sum(item.dataAgentVos.![number])}"></td>
<td th:text="${#aggregates.sum(item.dataAgentVos.![price*number])}"></td>
<td th:text="${#aggregates.sum(item.dataAgentVos.![priceReal])}"></td>
<td th:text="${#aggregates.sum(item.dataAgentVos.![commission])}"></td>
<td th:if="${item.priceStatus!=0}" th:text="待打款"></td>
<td th:if="${item.priceStatus==0}" th:text="已打款"></td>
......@@ -109,6 +110,23 @@
}
});
}
function onexport(){
var params = {
perId:'[[${saleDataVo.performancesId}]]'.replaceAll("\"", "")
}
$.ajax({
type: 'get',
url: "/smile/show/base/export",
headers: {"Content-Type": "application/json;charset=UTF-8"},
data: params,
success: function (e) {
window.location.replace('http://' + window.location.host + '/smile/show/base/export?perId=' + '[[${saleDataVo.performancesId}]]'.replaceAll("\"", "") + '&title=' + '[[${saleDataVo.title}]]')
}
});
}
</script>
</body>
</html>
package com.liquidnet.client.admin.zhengzai.smile.dto;
import com.liquidnet.service.kylin.dao.report.KylinPerformancesDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
......@@ -10,54 +12,56 @@ import java.time.LocalDateTime;
* @author TT
*/
@Data
public class ShowVo {
public class ShowVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 演出id
*/
@ApiModelProperty(value ="演出id")
@ApiModelProperty(value = "演出id")
private String performancesId;
/**
* 演出名
*/
@ApiModelProperty(value ="演出名")
@ApiModelProperty(value = "演出名")
private String title;
/**
* 城市
*/
@ApiModelProperty(value ="城市")
@ApiModelProperty(value = "城市")
private String cityName;
/**
* 总销售数量 -张 saleGeneral
*/
@ApiModelProperty(value ="总销售数量")
@ApiModelProperty(value = "总销售数量")
private BigDecimal open;
/**
* 总销售金额 totalSalePrice
*/
@ApiModelProperty(value ="总销售金额")
@ApiModelProperty(value = "总销售金额")
private BigDecimal totalSalePrice;
/**
* 总销售代理
*/
@ApiModelProperty(value ="总销售代理人数")
private Long totalOutAgent;
@ApiModelProperty(value = "总销售代理人数")
private Integer totalOutAgent;
/**
* 演出结束时间
*/
@ApiModelProperty(value ="演出结束时间")
@ApiModelProperty(value = "演出结束时间")
private LocalDateTime timeEnd;
/**
* 演出结束时间
*/
@ApiModelProperty(value ="演出开始时间")
@ApiModelProperty(value = "演出开始时间")
private LocalDateTime timeStart;
@ApiModelProperty(value = "演出状态")
......@@ -69,45 +73,70 @@ public class ShowVo {
/**
* 打款状态
*/
@ApiModelProperty(value ="演出打款状态")
@ApiModelProperty(value = "演出打款状态")
private String status;
/**
* 顺序
*/
@ApiModelProperty(value ="演出排列顺序")
@ApiModelProperty(value = "演出排列顺序")
private String comment;
public void setShowStatus(Integer status){
this.showStatus=status;
switch (status){
public void setShowStatus(Integer status) {
this.showStatus = status;
switch (status) {
case 1:
this.statusName="审核中";
this.statusName = "审核中";
break;
case 3:
this.statusName="审核通过";
this.statusName = "审核通过";
break;
case 4:
this.statusName="审核拒绝";
this.statusName = "审核拒绝";
break;
case 6:
this.statusName="售卖中";
this.statusName = "售卖中";
break;
case 7:
this.statusName="已下架";
this.statusName = "已下架";
break;
case 8:
this.statusName="售罄";
this.statusName = "售罄";
break;
case 9:
this.statusName="未开始";
this.statusName = "未开始";
break;
case 10:
this.statusName="已结束";
this.statusName = "已结束";
break;
default:
this.statusName="其他";
this.statusName = "其他";
break;
}
}
private static final ShowVo obj = new ShowVo();
public static ShowVo getNew() {
try {
return (ShowVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new ShowVo();
}
}
public ShowVo copy(KylinPerformancesDto kylinPerformancesDto) {
if (null == kylinPerformancesDto) return null;
this.setTimeStart(kylinPerformancesDto.getTimeStart());
this.setComment(kylinPerformancesDto.getComment());
this.setTitle(kylinPerformancesDto.getTitle());
this.setShowStatus(kylinPerformancesDto.getStatus());
this.setCityName(kylinPerformancesDto.getCityName());
this.setTotalSalePrice(kylinPerformancesDto.getTotalSalePrice());
this.setOpen(kylinPerformancesDto.getOpen() == null ? BigDecimal.valueOf(0) : kylinPerformancesDto.getOpen());
this.setPerformancesId(kylinPerformancesDto.getPerformancesId());
this.setTimeEnd(kylinPerformancesDto.getTimeEnd());
return this;
}
}
......@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
......@@ -11,7 +12,7 @@ import java.util.List;
*/
@ApiModel(value = "UserData", description = "代理数据")
@Data
public class UserData {
public class UserData implements Serializable, Cloneable {
/**
* 用户uid
......@@ -49,4 +50,15 @@ public class UserData {
@ApiModelProperty(value = "打款状态", example = "")
private Integer priceStatus;
private static final UserData obj = new UserData();
public static UserData getNew() {
try {
return (UserData) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new UserData();
}
}
......@@ -4,11 +4,12 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@ApiModel(value = "UserDataAgentVo", description = "用户单票数据")
@Data
public class UserDataAgentVo {
public class UserDataAgentVo implements Serializable, Cloneable{
/**
* 票提id
......@@ -34,6 +35,12 @@ public class UserDataAgentVo {
@ApiModelProperty(value = "单价", example = "")
private BigDecimal price;
/**
* 单价
*/
@ApiModelProperty(value = "真实付款金额", example = "")
private BigDecimal priceReal;
/**
* 票提
*/
......@@ -45,4 +52,15 @@ public class UserDataAgentVo {
*/
@ApiModelProperty(value = "提成", example = "")
private BigDecimal commission;
private static final UserDataAgentVo obj = new UserDataAgentVo();
public static UserDataAgentVo getNew() {
try {
return (UserDataAgentVo) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new UserDataAgentVo();
}
}
......@@ -10,6 +10,8 @@ import com.liquidnet.client.admin.zhengzai.smile.dto.SmilePriceParam;
import com.liquidnet.client.admin.zhengzai.smile.dto.SmileShowParam;
import com.liquidnet.service.smile.entity.SmileSchool;
import javax.servlet.ServletOutputStream;
/**
* <p>
* 服务类
......@@ -68,4 +70,6 @@ public interface ISmileShowService extends IService<SmileSchool> {
*/
AjaxResult updateRedis();
void exportData(ServletOutputStream servletOutputStream, String performancesId);
}
package com.liquidnet.client.admin.zhengzai.smile.utils;
import com.liquidnet.client.admin.zhengzai.smile.dto.ShowVo;
import com.liquidnet.client.admin.zhengzai.smile.dto.UserData;
import com.liquidnet.service.goblin.dto.vo.SmileProjectDetailsVo;
import com.liquidnet.common.cache.redis.util.AbstractRedisUtil;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
......@@ -13,7 +15,6 @@ import com.liquidnet.service.smile.entity.SmileVolunteersTeam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
......@@ -107,6 +108,30 @@ public class SmileRedisUtils {
return (String) redisDataSourceUtil.getRedisSweetUtil().get(SmileRedisConst.SMILE_SHOW.concat(performancesId));
}
/**
* 保存用户最新计算数据
* @param userData
*/
public void setUserDataByUid(UserData userData, String perId) {
String key = SmileRedisConst.SELL_USER_DATA.concat(perId).concat(":").concat(userData.getUid());
redisDataSourceUtil.getRedisSweetUtil().set(key, userData, 60 * 60 * 24);
}
/**
* 获取用户最新计算数据
* @param userData
*/
public UserData getUserDataByUid(String perId,String uid) {
String key = SmileRedisConst.SELL_USER_DATA.concat(perId).concat(":").concat(uid);
Object obj = redisDataSourceUtil.getRedisSweetUtil().get(key);
if (obj==null){
return null;
}else {
return (UserData)obj;
}
}
/**
* 保存演出ids
*/
......@@ -293,4 +318,27 @@ public class SmileRedisUtils {
String rdk = SmileRedisConst.VOLUNTEERS_DETAILS.concat(projectId).concat(":uid:").concat(uid);
getRedis().set(rdk, teamIds);
}
/**
* 保存演出列表vo
* @param vo
*/
public void setShowVoByPerId(ShowVo vo) {
String key = SmileRedisConst.SELL_SHOW_SAVE.concat(vo.getPerformancesId());
redisDataSourceUtil.getRedisSweetUtil().set(key,vo);
}
/**
* 获取演出列表vo
* @param vo
*/
public ShowVo getShowVoByPerId(String perId) {
String key = SmileRedisConst.SELL_SHOW_SAVE.concat(perId);
Object o = redisDataSourceUtil.getRedisSweetUtil().get(key);
if (o==null){
return null;
}else {
return (ShowVo) o;
}
}
}
package com.liquidnet.service.kylin.dao.report;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
* 演出
* </p>
*
* @author liquidnet
* @since 2021-05-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class KylinPerformancesDto implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
/**
* 演出id
*/
private String performancesId;
/**
* 演出名
*/
private String title;
/**
* 城市
*/
private String cityName;
/**
* 总销售数量 -张 saleGeneral
*/
private BigDecimal open;
/**
* 总销售金额 totalSalePrice
*/
private BigDecimal totalSalePrice;
/**
* 演出结束时间
*/
private LocalDateTime timeEnd;
/**
* 演出结束时间
*/
private LocalDateTime timeStart;
/**
* 顺序
*/
private String comment;
/**
* 演出状态
*/
private int status;
}
......@@ -18,5 +18,5 @@ public interface KylinOrderTicketRelationsMapper extends BaseMapper<KylinOrderTi
Integer concatByAgent(@Param("performancesId") String performancesId);
List<Long> concatByAgentDed(@Param("performancesId") String performancesId);
Integer concatByAgentDed(@Param("performancesId") String performancesId);
}
......@@ -56,8 +56,6 @@ public interface KylinOrderTicketsMapper extends BaseMapper<KylinOrderTickets> {
List<KylinOrderTicketAndAgentVo> selectListByPerformanceId(@Param("performancesId") String performancesId,@Param("ticketId")String ticketId);
Map selectByPerformanceId(@Param("performancesId") String performancesId);
List<String> getAgentIdListByPerId(@Param("performancesId") String performancesId);
Map selectNumAndPrice(@Param("performancesId") String performancesId,@Param("ticketsId") String ticketsId);
......
......@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.kylin.dao.*;
import com.liquidnet.service.kylin.dao.report.KylinPerformancesDto;
import com.liquidnet.service.kylin.entity.KylinPerformances;
import org.apache.ibatis.annotations.Param;
......@@ -67,7 +68,7 @@ public interface KylinPerformancesMapper extends BaseMapper<KylinPerformances> {
List<KylinPerformances> selectByComment();
List<KylinPerformances> selectPerIdByAgent(@Param("pageNumber") Integer pageNumber, @Param("pageSize")Integer pageSize);
List<KylinPerformancesDto> selectPerIdByAgent();
List<KylinPerformancesDao> selectTicketIdByPerId(@Param("performancesId") String performancesId);
......
......@@ -3,11 +3,23 @@
<mapper namespace="com.liquidnet.service.kylin.mapper.KylinOrderTicketRelationsMapper">
<select id="concatByAgent" resultType="Long">
SELECT count(*) FROM kylin_order_ticket_relations WHERE agent_id != 0 AND performance_id = #{performancesId};
SELECT count(*)
FROM kylin_order_ticket_relations
WHERE agent_id != 0
AND performance_id = #{performancesId};
</select>
<select id="concatByAgentDed" resultType="Long">
SELECT COUNT(*) FROM (SELECT agent_id FROM kylin_order_ticket_relations WHERE agent_id != 0 AND performance_id = #{performancesId} group by agent_id) kotr;
<select id="concatByAgentDed" resultType="Integer">
SELECT COUNT(kk.mid)
FROM (
SELECT kotr.mid, kotr.agent_id
FROM kylin_order_ticket_relations as kotr
LEFT JOIN kylin_order_ticket_status AS kots ON kotr.order_id = kots.order_id
INNER JOIN smile_user AS su ON su.uid = kotr.agent_id
WHERE kots.status IN (1,6)
AND kotr.agent_id != 0
AND kotr.performance_id = #{performancesId}
group by kotr.agent_id) kk;
</select>
......
......@@ -530,31 +530,6 @@
</select>
<select id="selectByPerformanceId" resultType="java.util.Map">
SELECT
kk.performance_id,
sum( kot.number - kot.refund_number ) AS `open`,
sum( kot.price_actual - kot.price_refund ) AS price
FROM
kylin_order_tickets AS kot
LEFT JOIN (
SELECT
kotr.order_id,
kotr.agent_id,
kotr.performance_id,
kotr.agent_distributions,
kotr.agent_id_master,
kotr.agent_distributions_master,
kotr.ticket_id
FROM
kylin_order_ticket_relations AS kotr
LEFT JOIN kylin_order_ticket_status AS kots ON kotr.order_id = kots.order_id
) AS kk ON kot.order_tickets_id = kk.order_id
WHERE
kk.agent_id != 0
AND kk.performance_id = #{performancesId}
</select>
<select id="getAgentIdListByPerId" resultType="String">
SELECT agent_id
FROM kylin_order_ticket_relations
......
......@@ -717,17 +717,53 @@ GROUP BY user_mobile,tickets_id;
select performances_id,comment from kylin_performances where `comment` != "" ORDER BY `comment`;
</select>
<select id="selectPerIdByAgent" resultType="com.liquidnet.service.kylin.entity.KylinPerformances">
select kp.performances_id,kp.title,kp.city_name,kp.time_end,kp.time_start,kp.comment
from kylin_performances as kp
left join kylin_ticket_time_relation as kttr on kttr.performance_id = kp.performances_id
left join kylin_ticket_relations as ktr on ktr.times_id = kttr.times_id
inner join kylin_ticket_status as kts on kts.ticket_id = ktr.ticket_id
where kts.is_agent = 1
AND kp.performances_id IN ( SELECT sa.performance_id FROM smile_agent sa WHERE sa.del_tag = 0 GROUP BY sa.performance_id )
group by kp.performances_id
order by kp.comment desc, kp.time_start asc
limit #{pageNumber},#{pageSize}
<select id="selectPerIdByAgent" resultType="com.liquidnet.service.kylin.dao.report.KylinPerformancesDto">
SELECT
kp.performances_id AS performancesId,
kp.title,
kp.city_name AS cityName,
kp.time_end AS timeEnd,
kp.time_start AS timeStart,
kp.`comment`,
IFNULL( map.`open`, 0 ) AS OPEN,
IFNULL( map.price, 0 ) AS totalSalePrice,
kps.`status`
FROM
kylin_performances AS kp
LEFT JOIN kylin_performance_status AS kps ON kps.performance_id = kp.performances_id
LEFT JOIN (
SELECT
kk.performance_id,
sum( kot.number - kot.refund_number ) AS `open`,
sum( kot.price_actual - kot.price_refund ) AS price
FROM
kylin_order_tickets AS kot
LEFT JOIN (
SELECT
kotr.order_id,
kotr.agent_id,
kotr.performance_id,
kotr.agent_distributions,
kotr.agent_id_master,
kotr.agent_distributions_master,
kotr.ticket_id
FROM
kylin_order_ticket_relations AS kotr
LEFT JOIN kylin_order_ticket_status AS kots ON kotr.order_id = kots.order_id
INNER JOIN smile_user AS su ON su.uid = kotr.agent_id
WHERE
kots.STATUS IN ( 1, 6 ,3 )
) AS kk ON kot.order_tickets_id = kk.order_id
WHERE
kk.agent_id != 0
GROUP BY
kk.performance_id
) AS map ON map.performance_id = kp.performances_id
WHERE
kp.performances_id IN ( SELECT sa.performance_id FROM smile_agent AS sa WHERE sa.del_tag = 0 GROUP BY sa.performance_id )
ORDER BY
kp.COMMENT DESC,
kp.time_start ASC
</select>
<select id="selectTicketIdByPerId" resultType="com.liquidnet.service.kylin.dao.KylinPerformancesDao">
......
......@@ -44,6 +44,15 @@ public class SmilePrice implements Serializable {
*/
private BigDecimal price;
/**
* 打款记录保留
*/
private String record;
/**
* 打款标识0:未打款,1:已打款
*/
private Integer status;
/**
* 0:未删除,1:已删除
......@@ -60,6 +69,14 @@ public class SmilePrice implements Serializable {
*/
private LocalDateTime updatedDate;
private static final SmilePrice obj = new SmilePrice();
public static SmilePrice getNew() {
try {
return (SmilePrice) obj.clone();
} catch (CloneNotSupportedException e) {
return new SmilePrice();
}
}
}
package com.liquidnet.service.smile.entity.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author TT
*/
@Data
public class ShowBaseVoDto implements Serializable, Cloneable{
/**
* 名字
*/
private String name;
/**
* 城市
*/
private String city;
/**
* agentId
*/
private String agentId;
/**
* 票提id
*/
private String tid;
/**
* 单价
*/
private BigDecimal price;
/**
* 真实付款金额
*/
private BigDecimal priceReal;
/**
* 票提
*/
private BigDecimal use;
/**
* 类型
*/
private int type;
/**
* 张数
*/
private BigDecimal number;
/**
*提成
*/
private BigDecimal totalPrice;
private static final ShowBaseVoDto obj = new ShowBaseVoDto();
public static ShowBaseVoDto getNew() {
try {
return (ShowBaseVoDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new ShowBaseVoDto();
}
}
}
......@@ -4,6 +4,7 @@ package com.liquidnet.service.smile.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.smile.entity.SmileAgent;
import com.liquidnet.service.smile.entity.dao.SmileAgentDao;
import com.liquidnet.service.smile.entity.dto.ShowBaseVoDto;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
......@@ -33,4 +34,6 @@ public interface SmileAgentMapper extends BaseMapper<SmileAgent> {
List<SmileAgent> selectAgentCarryGtZeroByPerId(@Param("performancesId")String performancesId);
int selectCountPerId();
List<ShowBaseVoDto> selectMapByPerId(@Param("performancesId") String performancesId);
}
......@@ -41,4 +41,8 @@ public interface SmileUserMapper extends BaseMapper<SmileUser> {
List<SmileUser> pageUser(@Param("offest") int offest,@Param("size") int size);
List<SmileUser> getAllUidByPerId(@Param("performancesId") String performancesId);
List<SmileUser> selectUidByPerId(@Param("performancesId") String performancesId);
List<SmileUser> selectUidByPerIdNotType(@Param("performancesId") String performancesId);
}
......@@ -62,37 +62,23 @@
</select>
<select id="getUserOrgByPerIdAndUidAndAgentMaster" resultType="java.util.Map">
SELECT *,
SUM(kk.price * kk.agent_distributions_master * ( kk.number - kk.refund_number )) totalPrice
FROM (SELECT kote.mid,
kote.order_id,
kote.ticket_id tid,
kt.title,
kote.user_id,
kote.performance_id perId,
kote.is_payment,
kote.status,
kot.number,
kot.refund_number,
kot.price,
kotr.agent_id agentId,
kotr.agent_id_master,
kotr.agent_distributions `use`,
kotr.agent_distributions_master,
su.type
FROM kylin_order_ticket_entities kote
LEFT JOIN kylin_order_tickets kot ON kote.order_id = kot.order_tickets_id
LEFT JOIN kylin_order_ticket_relations kotr ON kotr.order_id = kot.order_tickets_id
LEFT JOIN kylin_order_ticket_status kots ON kots.order_id = kotr.order_id
LEFT JOIN smile_user su ON su.uid = kotr.agent_id
LEFT JOIN kylin_tickets kt ON kote.ticket_id = kt.tickets_id
WHERE kote.performance_id = #{performancesId}
AND kote.ticket_id = #{ticketId}
AND kotr.agent_id_master = #{uid}
AND kotr.agent_status = 1
AND kots.status = 1
AND kots.pay_status = 1
GROUP BY kote.order_id) kk
SELECT
SUM(
( kot.price_actual - kot.price_refund )* kotr.agent_distributions_master) totalPrice
FROM
kylin_order_ticket_relations AS kotr
INNER JOIN kylin_order_tickets AS kot ON kot.order_tickets_id = kotr.order_id
WHERE
kot.order_tickets_id IN (
SELECT
kotr.order_id
FROM
kylin_order_ticket_relations AS kotr
LEFT JOIN kylin_order_ticket_status AS kots ON kots.order_id = kotr.order_id
WHERE
kotr.agent_id IN ( SELECT uid FROM smile_user WHERE agent_id = #{uid} )
AND kots.status IN (1,6,3)
) AND kotr.performance_id = #{performancesId} AND kotr.ticket_id = #{ticketId}
</select>
<select id="selectAgentList" resultType="com.liquidnet.service.smile.entity.dao.SmileAgentDao">
......@@ -121,4 +107,53 @@
SELECT COUNT(sa.id) FROM (SELECT id FROM smile_agent WHERE del_tag = 0 GROUP BY performance_id) sa;
</select>
<select id="selectMapByPerId" resultType="com.liquidnet.service.smile.entity.dto.ShowBaseVoDto">
SELECT
sukotr.`name`,
sukotr.city,
sukotr.uid AS agent_id,
sukotr.ticket_id AS tid,
sukotr.type,
kot.price,
SUM(kot.price_actual - kot.price_refund) price_real,
sukotr.agent_distributions AS `use`,
SUM( kot.number - kot.refund_number ) number,
SUM( ( kot.price_actual - kot.price_refund ) * sukotr.agent_distributions ) totalPrice
FROM
kylin_order_tickets AS kot
INNER JOIN (
SELECT
su.uid,
su.`name`,
su.city,
su.type,
kotr.order_id,
kotr.performance_id,
kotr.ticket_id,
kotr.agent_distributions
FROM
smile_user AS su
INNER JOIN kylin_order_ticket_relations AS kotr ON kotr.agent_id = su.uid
INNER JOIN kylin_order_ticket_status AS kots ON kots.order_id = kotr.order_id
WHERE
su.uid IN (
SELECT COALESCE
( kotr.agent_id, kotr.agent_id_master ) uid
FROM
kylin_order_ticket_relations AS kotr
WHERE
kotr.performance_id = #{performancesId}
AND kotr.agent_id != 0
AND COALESCE ( kotr.agent_id, kotr.agent_id_master ) NOT IN ( SELECT sp.uid FROM smile_price AS sp WHERE sp.performanceS_id = #{performancesId} AND sp.uid IS NOT NULL AND sp.record != '')
GROUP BY
uid
)
AND kotr.performance_id = #{performancesId}
AND kots.`status` IN ( 1, 6 ,3)
) AS sukotr ON sukotr.order_id = kot.order_tickets_id
GROUP BY
sukotr.uid,
sukotr.ticket_id
</select>
</mapper>
......@@ -149,20 +149,48 @@
<select id="getAllUidByPerId" parameterType="java.util.Map"
resultType="com.liquidnet.service.smile.entity.SmileUser">
SELECT uid,
`name`,
`type`,
province_id,
province,
city_id,
city,
area_id,
area,
address
FROM smile_user su
LEFT JOIN kylin_order_ticket_relations AS kotr ON kotr.agent_id = su.uid OR kotr.agent_id_master = su.uid
WHERE kotr.performance_id = #{performancesId}
group by uid
SELECT
su.uid,
su.`name`,
su.`type`,
su.province_id,
su.province,
su.city_id,
su.city,
su.area_id,
su.area,
su.address
FROM
smile_user AS su
INNER JOIN ( SELECT mid, agent_id, agent_id_master FROM kylin_order_ticket_relations WHERE performance_id = #{performancesId} AND agent_id != 0 GROUP BY agent_id ) kk ON kk.agent_id = su.uid
OR kk.agent_id_master = su.uid
GROUP BY
su.uid
</select>
<select id="selectUidByPerId" resultType="com.liquidnet.service.smile.entity.SmileUser">
SELECT
su.uid,
su.name,
su.type,
su.city
FROM
smile_user AS su
INNER JOIN ( SELECT kotr.agent_id, kotr.agent_id_master FROM kylin_order_ticket_relations AS kotr WHERE kotr.performance_id = #{performancesId} AND kotr.agent_id != 0 ) kk ON su.uid = kk.agent_id
OR su.uid = kk.agent_id_master
WHERE su.type = 1
GROUP BY su.uid
</select>
<select id="selectUidByPerIdNotType" resultType="com.liquidnet.service.smile.entity.SmileUser">
SELECT
su.uid
FROM
smile_user AS su
INNER JOIN ( SELECT kotr.agent_id, kotr.agent_id_master FROM kylin_order_ticket_relations AS kotr WHERE kotr.performance_id = #{performancesId} AND kotr.agent_id != 0 ) kk ON su.uid = kk.agent_id
OR su.uid = kk.agent_id_master
GROUP BY su.uid
</select>
</mapper>
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