This commit is contained in:
parent
48a58966d8
commit
6fe314ff5e
|
|
@ -110,6 +110,23 @@ public class AgencyController {
|
||||||
return agencyService.getSumDeviceStock(userId);
|
return agencyService.getSumDeviceStock(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备列表
|
||||||
|
* @param loginName
|
||||||
|
* @param token
|
||||||
|
* @param userId
|
||||||
|
* @param merchantCode
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("getDeviceStockInfo")
|
||||||
|
public RespBody getDeviceStockInfo(@RequestHeader("loginName") String loginName, @RequestHeader("token") String token, @RequestHeader("userId") String userId,
|
||||||
|
@RequestParam("merchantCode") String merchantCode,@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize
|
||||||
|
){
|
||||||
|
return agencyService.getSumDeviceStockInfo(userId,merchantCode,pageNum,pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取创客审核列表
|
* 获取创客审核列表
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.chaozhanggui.dao.system.entity.TbPlussUserApp;
|
||||||
import com.chaozhanggui.dao.system.entity.TbPlussUserInfo;
|
import com.chaozhanggui.dao.system.entity.TbPlussUserInfo;
|
||||||
import com.chaozhanggui.dao.system.entity.TbPlussUserPromotion;
|
import com.chaozhanggui.dao.system.entity.TbPlussUserPromotion;
|
||||||
import com.chaozhanggui.dao.system.model.CashStatus;
|
import com.chaozhanggui.dao.system.model.CashStatus;
|
||||||
|
import com.chaozhanggui.dao.system.model.ProfitPO;
|
||||||
import com.chaozhanggui.dao.system.util.N;
|
import com.chaozhanggui.dao.system.util.N;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
@ -24,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -246,6 +248,13 @@ public class AgencyService {
|
||||||
return new RespBody("000000",userPromotionMapper.selectCount(userId));
|
return new RespBody("000000",userPromotionMapper.selectCount(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RespBody getSumDeviceStockInfo(String userId,String merchantCode,Integer pageNum,Integer pageSize){
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
List<Map<String,Object>> list= userPromotionMapper.selectDeviceStok(userId,merchantCode);
|
||||||
|
PageInfo pageInfo=new PageInfo(list);
|
||||||
|
return new RespBody("000000",pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public RespBody getUserMark(String userId,String phone,String name,Integer pageNum,Integer pageSize){
|
public RespBody getUserMark(String userId,String phone,String name,Integer pageNum,Integer pageSize){
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
|
@ -273,8 +282,22 @@ public class AgencyService {
|
||||||
return new RespBody("000019");
|
return new RespBody("000019");
|
||||||
}
|
}
|
||||||
PageHelper.startPage(pageNo, pageSize);
|
PageHelper.startPage(pageNo, pageSize);
|
||||||
List<Map<String,Object>> list=userAppMapper.selectProfit(userId, orderNumber, merchantCode);
|
List<ProfitPO> list= userAppMapper.selectProfit(userId,orderNumber,merchantCode);
|
||||||
|
|
||||||
|
if(ObjectUtil.isEmpty(list)||list.size()<=0){
|
||||||
|
return new RespBody("000000");
|
||||||
|
}
|
||||||
|
list.stream().forEach(it->{
|
||||||
|
TbPlussUserPromotion userPromotion= userPromotionMapper.selectUserPromotionByUserId(userId,it.getUserId());
|
||||||
|
if(ObjectUtil.isNotEmpty(userPromotion)){
|
||||||
|
it.setLoginName(userPromotion.getLoginName());
|
||||||
|
it.setTypeCode(userPromotion.getTypeCode());
|
||||||
|
it.setCurrentFee(userPromotion.getCurrentFee().toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
PageInfo pageInfo=new PageInfo(list);
|
PageInfo pageInfo=new PageInfo(list);
|
||||||
|
|
||||||
return new RespBody("000000",pageInfo);
|
return new RespBody("000000",pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,18 @@ public class Userservice {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RespBody getIndexData(Integer userId){
|
public RespBody getIndexData(Integer userId){
|
||||||
return new RespBody("000000",userInfoMapper.selectIndexData(userId));
|
Map<String,Object> map= userInfoMapper.selectIndexData(userId);
|
||||||
|
if(ObjectUtil.isEmpty(map)||map.size()<=0){
|
||||||
|
TbPlussUserPromotion userPromotion= userPromotionMapper.selectByPrimaryKey(userId);
|
||||||
|
map=new HashMap<>();
|
||||||
|
map.put("sumConsumeFee",0);
|
||||||
|
map.put("yestedayConsumeFee",0);
|
||||||
|
map.put("sumfansShareMoney",0);
|
||||||
|
map.put("yestedayShareMoney",0);
|
||||||
|
map.put("currentFee",ObjectUtil.isEmpty(userPromotion)?0:userPromotion.getCurrentFee());
|
||||||
|
|
||||||
|
}
|
||||||
|
return new RespBody("000000",map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
# url: jdbc:mysql://rm-bp19ib8x213kh9t45.rwlb.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
|
# url: jdbc:mysql://rm-bp1uo9iq250st2e691o.mysql.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
|
||||||
url: jdbc:mysql://rm-bp1uo9iq250st2e69.mysql.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
|
url: jdbc:mysql://rm-bp1uo9iq250st2e69.mysql.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=CTT&useSSL=false
|
||||||
username: root
|
username: root
|
||||||
password: prodCZGmysqlroot@123
|
password: prodCZGmysqlroot@123
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@ server:
|
||||||
port: 18071
|
port: 18071
|
||||||
servlet:
|
servlet:
|
||||||
context-path: /admin
|
context-path: /admin
|
||||||
|
# 指定日志级别 把springboot的所有日志修改成为debug
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: debug
|
||||||
mybatis:
|
mybatis:
|
||||||
configuration:
|
configuration:
|
||||||
map-underscore-to-camel-case: true
|
map-underscore-to-camel-case: true
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.chaozhanggui.dao.system.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.dao.system.entity.TbPlussUserApp;
|
import com.chaozhanggui.dao.system.entity.TbPlussUserApp;
|
||||||
|
|
||||||
|
import com.chaozhanggui.dao.system.model.ProfitPO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -26,5 +27,5 @@ public interface TbPlussUserAppMapper {
|
||||||
|
|
||||||
int countByInviteNum(String inviteNum);
|
int countByInviteNum(String inviteNum);
|
||||||
|
|
||||||
List<Map<String,Object>> selectProfit(@Param("userId") String userId,@Param("orderNumber") String orderNumber,@Param("merchantCode") String merchantCode);
|
List<ProfitPO> selectProfit(@Param("userId") String userId, @Param("orderNumber") String orderNumber, @Param("merchantCode") String merchantCode);
|
||||||
}
|
}
|
||||||
|
|
@ -45,4 +45,10 @@ public interface TbPlussUserPromotionMapper {
|
||||||
Map<String,Integer> selectCount(String userId);
|
Map<String,Integer> selectCount(String userId);
|
||||||
|
|
||||||
List<Map<String,Object>> selectMarkByUserId(@Param("userId") String userId,@Param("phone") String phone,@Param("name") String name);
|
List<Map<String,Object>> selectMarkByUserId(@Param("userId") String userId,@Param("phone") String phone,@Param("name") String name);
|
||||||
|
|
||||||
|
|
||||||
|
List<Map<String,Object>> selectDeviceStok(@Param("userId") String userId,@Param("merchantCode") String merchantCode);
|
||||||
|
|
||||||
|
|
||||||
|
TbPlussUserPromotion selectUserPromotionByUserId(@Param("userId") String userId,@Param("orderUserId") String orderUserId);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.chaozhanggui.dao.system.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProfitPO implements Serializable {
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
private String merchantCode;
|
||||||
|
|
||||||
|
private String merchantName;
|
||||||
|
|
||||||
|
private String orderNumber;
|
||||||
|
|
||||||
|
private String price;
|
||||||
|
|
||||||
|
private String loginName;
|
||||||
|
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
private Date createDt;
|
||||||
|
|
||||||
|
private String currentFee;
|
||||||
|
|
||||||
|
private String consumeFee;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -544,33 +544,28 @@
|
||||||
select count(0) from tb_pluss_user_app where inviteNum=#{inviteNum}
|
select count(0) from tb_pluss_user_app where inviteNum=#{inviteNum}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectProfit" resultType="java.util.Map">
|
|
||||||
|
|
||||||
|
<select id="selectProfit" resultType="com.chaozhanggui.dao.system.model.ProfitPO">
|
||||||
SELECT
|
SELECT
|
||||||
p.merchantCode,
|
p.merchantCode,
|
||||||
p.merchantName,
|
p.merchantName,
|
||||||
p.orderNumber,
|
|
||||||
p.price,
|
p.price,
|
||||||
u.loginName,
|
p.consumeFee,
|
||||||
m.type_code AS typeCode,
|
|
||||||
p.createDt,
|
p.createDt,
|
||||||
m.current_fee AS currentFee,
|
b.userId
|
||||||
p.consumeFee
|
|
||||||
FROM
|
FROM
|
||||||
tb_pluss_merchant_profit p
|
tb_pluss_merchant_profit p left join tb_pluss_merchant_base_info b on p.merchantCode=b.merchantCode
|
||||||
LEFT JOIN tb_pluss_merchant_base_info b ON p.userId = b.userId
|
where p.userId=#{userId}
|
||||||
LEFT JOIN tb_pluss_user_promotion m ON p.userId = m.user_id
|
and p.price!=0
|
||||||
LEFT JOIN tb_pluss_user_info u ON p.userId = u.id
|
|
||||||
WHERE
|
|
||||||
p.merchantParentId = #{userId}
|
|
||||||
AND p.price != 0
|
|
||||||
<if test="orderNumber !=null and orderNumber != ''">
|
<if test="orderNumber !=null and orderNumber != ''">
|
||||||
and p.orderNumber=#{orderNumber}
|
and p.orderNumber=#{orderNumber}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="merchantCode !=null and merchantCode != ''">
|
<if test="merchantCode !=null and merchantCode != ''">
|
||||||
and p.merchantCode=#{merchantCode}
|
and p.merchantCode=#{merchantCode}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
p.id DESC
|
p.id DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -238,12 +238,11 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCount" resultType="java.util.Map">
|
<select id="selectCount" resultType="java.util.Map">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
count( s.id ) as sumCount,
|
count( s.id ) as sumCount,
|
||||||
sum(case s.`status` when 1 then 1 else 0 end) as NoSellCount,
|
IFNULL(sum(case s.`status` when 1 then 1 else 0 end),0) as NoSellCount,
|
||||||
sum(case s.`status` when 2 then 1 else 0 end) as sellCount,
|
IFNULL(sum(case s.`status` when 2 then 1 else 0 end),0) as sellCount,
|
||||||
sum(case s.`status` when 3 then 1 else 0 end) as activityCount
|
IFNULL(sum(case s.`status` when 3 then 1 else 0 end),0) as activityCount
|
||||||
|
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
|
|
@ -257,7 +256,7 @@
|
||||||
WHERE
|
WHERE
|
||||||
@ids IS NOT NULL
|
@ids IS NOT NULL
|
||||||
) ID,
|
) ID,
|
||||||
tb_pluss_user_promotion p right join tb_pluss_device_stock s on p.user_id=s.belongUserId
|
tb_pluss_user_promotion p right join view_device_stock s on p.user_id=s.userId
|
||||||
WHERE
|
WHERE
|
||||||
FIND_IN_SET( p.user_id, ID._ids )
|
FIND_IN_SET( p.user_id, ID._ids )
|
||||||
and p.user_id!=#{userId}
|
and p.user_id!=#{userId}
|
||||||
|
|
@ -395,4 +394,71 @@
|
||||||
WHERE
|
WHERE
|
||||||
P.user_id = #{userId}
|
P.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserPromotionByUserId" resultMap="BaseResultMap">
|
||||||
|
|
||||||
|
select d.*,i.loginName from (SELECT t2.*
|
||||||
|
FROM (
|
||||||
|
SELECT @supId AS _id,
|
||||||
|
(SELECT @supId := parent_user_id FROM tb_pluss_user_promotion WHERE user_id = _id ) AS supdeptid,
|
||||||
|
@level := @level + 1 AS lvl
|
||||||
|
FROM (SELECT @supId := #{orderUserId}, @level := 0) vars,
|
||||||
|
tb_pluss_user_promotion h
|
||||||
|
WHERE @supId != 0) t1
|
||||||
|
JOIN (SELECT * FROM tb_pluss_user_promotion ) t2
|
||||||
|
ON t1._id = t2.user_id
|
||||||
|
where t2.parent_user_id=#{userId}
|
||||||
|
ORDER BY t1.lvl DESC) d left join tb_pluss_user_info i on d.user_id=i.id
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDeviceStok" resultType="java.util.Map">
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
s.snNo,
|
||||||
|
s.actMercName,
|
||||||
|
o.merchantCode,
|
||||||
|
i.phone,
|
||||||
|
s.`status`,
|
||||||
|
o.countId AS countSum,
|
||||||
|
o.consumeFee,
|
||||||
|
u.loginName
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
@ids AS _ids,
|
||||||
|
( SELECT @ids := GROUP_CONCAT( user_id ) FROM tb_pluss_user_promotion WHERE FIND_IN_SET( parent_user_id, @ids ) ) AS cids,
|
||||||
|
@l := @l + 1 AS LEVEL
|
||||||
|
FROM
|
||||||
|
tb_pluss_user_promotion,
|
||||||
|
( SELECT @ids := #{userId}, @l := 0 ) b
|
||||||
|
WHERE
|
||||||
|
@ids IS NOT NULL
|
||||||
|
) ID,
|
||||||
|
tb_pluss_user_promotion p
|
||||||
|
RIGHT JOIN view_device_stock s ON p.user_id = s.userId
|
||||||
|
LEFT JOIN tb_pluss_user_info i ON p.user_id = i.id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
count( o.id ) AS countId,
|
||||||
|
sum( o.consumeFee ) AS consumeFee,
|
||||||
|
b.id,
|
||||||
|
o.merchantCode
|
||||||
|
FROM
|
||||||
|
tb_pluss_merchant_order o
|
||||||
|
LEFT JOIN tb_pluss_merchant_base_info b ON o.merchantCode = b.merchantCode
|
||||||
|
WHERE
|
||||||
|
o.`status` = 1
|
||||||
|
GROUP BY
|
||||||
|
b.id,
|
||||||
|
o.merchantCode
|
||||||
|
) o ON s.actMercId = o.id
|
||||||
|
LEFT JOIN tb_pluss_user_info u ON p.parent_user_id = u.id
|
||||||
|
WHERE
|
||||||
|
FIND_IN_SET( p.user_id, ID._ids )
|
||||||
|
AND p.user_id != #{userId}
|
||||||
|
<if test="merchantCode !=null and merchantCode!=''">
|
||||||
|
and o.merchantCode=#{merchantCode}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue