Commit 9dc3c069 authored by libin's avatar libin

员工统计

parent 7f918cbb
package com.github.wxiaoqi.security.common.enumconstant;
import org.assertj.core.util.Lists;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
......@@ -36,7 +36,7 @@ public enum LevelEnum {
static {
levelMap = EnumSet.allOf(LevelEnum.class).stream().collect(Collectors.toMap(LevelEnum::getLevel, Function.identity()));
levels = Lists.newArrayList(levelMap.keySet());
levels = new ArrayList<>(levelMap.keySet());
}
public Integer getLevel() {
......
package com.github.wxiaoqi.security.admin.bo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/11/26 17:09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StaffStatisticsBo {
private static final long serialVersionUID = 1L;
private String name ;
private List<String> companyNames;
private List<Integer> compnayIds;
private List<String> postionNames;
private List<Integer> postionIds;
private String phone;
private BigDecimal sellAmount = BigDecimal.ZERO;
private BigDecimal royaltyAmount = BigDecimal.ZERO;
private Integer memberOrderNum = 0;
private BigDecimal memberAmount = BigDecimal.ZERO;
private Integer rentVehicleOrderNum = 0;
private BigDecimal rentVehicleAmount = BigDecimal.ZERO;
private Integer travelOrderNum = 0;
private BigDecimal travelAmount = BigDecimal.ZERO;
public List<String> getCompanyNames() {
return CollectionUtils.isEmpty(companyNames)? new ArrayList<>():companyNames;
}
public List<Integer> getCompnayIds() {
return CollectionUtils.isEmpty(compnayIds)?new ArrayList<>():compnayIds;
}
public List<String> getPostionNames() {
return CollectionUtils.isEmpty(postionNames)?new ArrayList<>() :postionNames;
}
public List<Integer> getPostionIds() {
return CollectionUtils.isEmpty(postionIds)?new ArrayList<>():postionIds;
}
public BigDecimal getSellAmount() {
return rentVehicleAmount.add(travelAmount).add(memberAmount);
}
}
package com.github.wxiaoqi.security.admin.bo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/11/26 17:09
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StaffStatisticsTotalBo {
private Integer staffNum;
private BigDecimal totalSellAmount;
private BigDecimal totalRoyaltyAmount;
public Integer getStaffNum() {
return this.staffNum==null?0:staffNum;
}
public BigDecimal getTotalSellAmount() {
return this.totalSellAmount==null?BigDecimal.ZERO:totalSellAmount;
}
public BigDecimal getTotalRoyaltyAmount() {
return this.totalRoyaltyAmount==null?BigDecimal.ZERO:totalRoyaltyAmount;
}
}
......@@ -3,6 +3,9 @@ package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
......@@ -10,7 +13,8 @@ import lombok.Data;
* @data 2019/7/11 15:14
*/
@Data
public class AppUserSellingWaterDTO {
public class AppUserSellingWaterDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
......@@ -35,6 +39,8 @@ public class AppUserSellingWaterDTO {
@ApiModelProperty(value = "订单id")
private Integer orderId;
private Integer orderType;
/**
* 商品id
*/
......@@ -75,7 +81,7 @@ public class AppUserSellingWaterDTO {
* 售价
*/
@ApiModelProperty(value = "售价")
private Long price;
private BigDecimal price;
/**
* 提成百分比
......@@ -89,4 +95,12 @@ public class AppUserSellingWaterDTO {
@ApiModelProperty(value = "是否入账:0-未入账;1-已入账")
private Integer waiting;
private BigDecimal commission;
private Integer companyId;
private String companyName;
private String stateGroup;
}
package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/11/26 17:04
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StaffStatisticsFindDTO extends PageParam {
private Date startDate;
private Date endDate;
private String companyName;
private Integer userPostionId;
private Integer companyId;
}
......@@ -2,14 +2,17 @@ package com.github.wxiaoqi.security.admin.feign;
import com.github.wxiaoqi.security.admin.bo.UserBo;
import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.AppUserSellingWaterDTO;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
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.github.wxiaoqi.security.admin.feign.dto.UserDTO;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.admin.vo.ImiVo;
import com.github.wxiaoqi.security.admin.vo.WalletPostionVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -164,8 +167,13 @@ public interface UserFeign {
List<UserStaffBo> findAllStaffs();
@GetMapping("/sellingwater/list_staff_sellerwater")
public List<UserStaffBo> findStaffSellerWater(@RequestParam(value = "userIds",required = false) List<Integer> userIds,
@RequestParam(value = "startDate") Date startDate,
@RequestParam(value = "endDate") Date endDate);
List<AppUserSellingWaterDTO> findStaffSellerWater(@RequestParam(value = "userIds",required = false) List<Integer> userIds,
@RequestParam(value = "startDate") Date startDate,
@RequestParam(value = "endDate") Date endDate);
@GetMapping("/postion/admin/postions")
ObjectRestResponse<List<WalletPostionVo>> findAllPostions();
@GetMapping("/public/getUsersByUserIdList")
ObjectRestResponse<List<AppUserVo>> getByUserIdList(@RequestParam("userIds") List<Integer> userIds);
}
......@@ -3,6 +3,8 @@ package com.github.wxiaoqi.security.admin.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author libin
* @version 1.0
......@@ -10,8 +12,8 @@ import lombok.Data;
* @data 2019/7/17 16:17
*/
@Data
public class WalletPostionVo {
public class WalletPostionVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键id")
private Integer id;
......
......@@ -4,12 +4,14 @@ import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.AccountBindDTO;
import com.github.wxiaoqi.security.admin.dto.StaffStatisticsFindDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.mapper.AppUserDetailMapper;
import com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService;
import com.github.wxiaoqi.security.admin.vo.AppUserInfoVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
......@@ -176,4 +178,13 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
List<UserStaffBo> userStaffBos = mapper.selectAllStaffs();
return CollectionUtils.isEmpty(userStaffBos)? Collections.EMPTY_LIST:userStaffBos;
}
public List<AppUserVo> getUserByUserIdList(List<Integer> userIds) {
List<AppUserVo> appUserVos = mapper.getUserByUserIdList(userIds);
return CollectionUtils.isEmpty(appUserVos)?Collections.EMPTY_LIST:appUserVos;
}
public PageDataVO<UserStaffBo> findAllStaffsByCompanyIdAndPostionIdWithPage(StaffStatisticsFindDTO staffStatisticsFindDTO) {
return PageDataVO.pageInfo(staffStatisticsFindDTO.getPage(),staffStatisticsFindDTO.getLimit(),()->mapper.findAllStaffsByCompanyIdAndPostionIdWithPage(staffStatisticsFindDTO));
}
}
......@@ -2,10 +2,7 @@ package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.bo.UserIncomeBo;
import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.OrderGoodsDTO;
import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterAdminDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterFindDTO;
import com.github.wxiaoqi.security.admin.dto.*;
import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import com.github.wxiaoqi.security.admin.vo.SellingWalletVo;
......@@ -21,6 +18,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Supplier;
......@@ -200,12 +198,12 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
amount = amount.add(commission);
}
BigDecimal unbooked=amount;
log.info("订单完成计算用户拥金----finishOrderWater----orderId====" + orderId + "---amount==" + amount+"---unbooked=="+unbooked);
if(orderType==1){
List<OrderGoodsDTO> goodsDTOList =orderWaterDTO.getGoodsDTOList();
log.info("租车订单完成-----goodsDTOList==="+goodsDTOList);
if (CollectionUtils.isNotEmpty(goodsDTOList)){
BigDecimal unbooked = amount;
log.info("订单完成计算用户拥金----finishOrderWater----orderId====" + orderId + "---amount==" + amount + "---unbooked==" + unbooked);
if (orderType == 1) {
List<OrderGoodsDTO> goodsDTOList = orderWaterDTO.getGoodsDTOList();
log.info("租车订单完成-----goodsDTOList===" + goodsDTOList);
if (CollectionUtils.isNotEmpty(goodsDTOList)) {
for (OrderGoodsDTO goodsDto : goodsDTOList) {
//商品id
Integer goodId = goodsDto.getGoodId();
......@@ -215,17 +213,17 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
sellingWater.setOrderId(orderId);
sellingWater.setGoodId(goodId);
sellingWater = selectOne(sellingWater);
if (sellingWater == null||sellingWater.getExtract()==null||sellingWater.getExtract()==0) {
if (sellingWater == null || sellingWater.getExtract() == null || sellingWater.getExtract() == 0) {
log.info("租车订单完成-----sellingWater---不存在或extract---为空");
continue;
}
if (price.compareTo(sellingWater.getPrice())>=0){
if (price.compareTo(sellingWater.getPrice()) >= 0) {
log.info("租车订单完成-----完成价格大于支付价格");
continue;
}
price=sellingWater.getPrice().subtract(price);
Integer extract=sellingWater.getExtract();
log.info("租车订单完成-----price====="+price+"---extract===="+extract);
price = sellingWater.getPrice().subtract(price);
Integer extract = sellingWater.getExtract();
log.info("租车订单完成-----price=====" + price + "---extract====" + extract);
BigDecimal commission = price.multiply(new BigDecimal(extract + "")).divide(new BigDecimal("100"), 2, BigDecimal.ROUND_HALF_UP);
log.info("租车订单完成--------userId===" + userId + "---commission===" + commission);
sellingWater.setWaiting(1);
......@@ -235,8 +233,8 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
insertSelective(sellingWater);
log.info("租车订单完成计算用户拥成功----payOrderWater--------userId===" + userId);
amount = amount.subtract(commission);
}
}
}
}
log.info("订单完成计算用户拥金----finishOrderWater--------orderId===" + orderId + "----amount====" + amount + "--orderType===" + orderType);
int r = amount.compareTo(BigDecimal.ZERO);
......@@ -250,7 +248,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
detail.setSource(1);
myWaterBiz.updMyWater(detail);
}
if ((orderType == 1 || orderType == 2)&&unbooked.compareTo(BigDecimal.ZERO)==1 ){
if ((orderType == 1 || orderType == 2) && unbooked.compareTo(BigDecimal.ZERO) == 1) {
myWaterBiz.updMyWalletUnbooked(userId, unbooked, 2);
}
}
......@@ -450,7 +448,7 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
criteria.andEqualTo("userId", leaderId);
criteria.andEqualTo("orderType", orderType);
List<AppUserSellingWater> appUserSellingWaters = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(appUserSellingWaters)){
if (CollectionUtils.isEmpty(appUserSellingWaters)) {
return Collections.EMPTY_LIST;
}
return appUserSellingWaters.stream().map(AppUserSellingWater::getSourceId).collect(Collectors.toList());
......@@ -463,9 +461,35 @@ public class AppUserSellingWaterBiz extends BaseBiz<AppUserSellingWaterMapper, A
return pageDataVO;
}
public List<UserStaffBo> findStatffSellerWaterByUserIdsAndTime(List<Integer> userIds,Date startDate,Date endDate) {
List<UserStaffBo> userStaffBos = mapper.statisticsStatffSellerWaterByUserIdsAndTime(userIds,startDate.getTime(),endDate.getTime());
return CollectionUtils.isEmpty(userStaffBos)?Collections.EMPTY_LIST:userStaffBos;
public List<AppUserSellingWaterDTO> findStatffSellerWaterByUserIdsAndTime(List<Integer> userIds, Date startDate, Date endDate) {
/* List<UserStaffBo> userStaffBos = mapper.statisticsStatffSellerWaterByUserIdsAndTime(userIds,startDate.getTime(),endDate.getTime());
return CollectionUtils.isEmpty(userStaffBos)?Collections.EMPTY_LIST:userStaffBos;*/
List<AppUserSellingWaterDTO> appUserSellingWaterDTOS = new ArrayList<>();
Example example = new Example(AppUserSellingWater.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIn("userId", userIds);
if(startDate!=null && endDate!=null){
criteria.andBetween("crtTime", startDate.getTime(), endDate.getTime());
}
if (startDate!=null && endDate==null){
criteria.andGreaterThanOrEqualTo("crtTime",startDate.getTime());
}
if(startDate==null && endDate!=null){
criteria.andLessThanOrEqualTo("crtTime",endDate.getTime());
}
criteria.andNotEqualTo("positionId", 6);
List<AppUserSellingWater> appUserSellingWaters = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(appUserSellingWaters)) {
return appUserSellingWaterDTOS;
}
AppUserSellingWaterDTO appUserSellingWaterDTO = null;
for (AppUserSellingWater appUserSellingWater : appUserSellingWaters) {
appUserSellingWaterDTO = new AppUserSellingWaterDTO();
BeanUtils.copyProperties(appUserSellingWater, appUserSellingWaterDTO);
appUserSellingWaterDTOS.add(appUserSellingWaterDTO);
}
return appUserSellingWaterDTOS;
}
private enum SellerWallterStatus {
......
......@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.AppUserManageDTO;
import com.github.wxiaoqi.security.admin.dto.StaffStatisticsFindDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserDetail;
import com.github.wxiaoqi.security.admin.vo.AppUserManageVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
......@@ -28,4 +29,8 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
List<AppUserManageVo> selectAppUser(AppUserManageDTO appUserManageDTO);
List<UserStaffBo> selectAllStaffs();
List<AppUserVo> getUserByUserIdList(@Param("userIds") List<Integer> userIds);
List<UserStaffBo> findAllStaffsByCompanyIdAndPostionIdWithPage(StaffStatisticsFindDTO staffStatisticsFindDTO);
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.bo.UserIncomeBo;
import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.AppUserSellingWaterDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterAdminDTO;
import com.github.wxiaoqi.security.admin.dto.UserSellingWaterFindDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserSellingWater;
......@@ -29,7 +30,7 @@ public interface AppUserSellingWaterMapper extends Mapper<AppUserSellingWater> {
List<UserSellingWaterAdminDTO> selectSellingWaterPage(UserSellingWaterFindDTO userSellingWaterFindDTO);
List<UserStaffBo> statisticsStatffSellerWaterByUserIdsAndTime(@Param("userIds") List<Integer> userIds,
@Param("startTime") Long startTime,
@Param("endTime") Long endTime);
List<AppUserSellingWaterDTO> statisticsStatffSellerWaterByUserIdsAndTime(@Param("userIds") List<Integer> userIds,
@Param("startTime") Long startTime,
@Param("endTime") Long endTime);
}
......@@ -368,7 +368,7 @@ public class AppUserController extends CommonBaseController{
}
@ApiOperation("查询全部员工")
@GetMapping("/app/user/list_staff")
@GetMapping("/list_staff")
public List<UserStaffBo> findAllStaffs(){
return userDetailBiz.findAllStaffs();
}
......
......@@ -13,11 +13,13 @@ import com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
......@@ -169,4 +171,9 @@ public class PublicController {
return ObjectRestResponse.succ(appUserVos);
}
@GetMapping("/getUsersByUserIdList")
ObjectRestResponse<List<AppUserVo>> getByUserIdList(@RequestParam("userIds") List<Integer> userIds){
List<AppUserVo> appUserVos = detailBiz.getUserByUserIdList(userIds);
return ObjectRestResponse.succ(appUserVos);
}
}
......@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.AppUserSellingWaterBiz;
import com.github.wxiaoqi.security.admin.bo.UserStaffBo;
import com.github.wxiaoqi.security.admin.dto.AppUserSellingWaterDTO;
import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO;
import com.github.wxiaoqi.security.admin.vo.SellingWalletPagVo;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
......@@ -79,9 +80,9 @@ public class UserSellingWaterController {
@ApiOperation("员工佣金")
@GetMapping("/list_staff_sellerwater")
public List<UserStaffBo> findStaffSellerWater(@RequestParam(value = "userIds",required = false) List<Integer> userIds,
@RequestParam(value = "startDate") Date startDate,
@RequestParam(value = "endDate") Date endDate){
public List<AppUserSellingWaterDTO> findStaffSellerWater(@RequestParam(value = "userIds",required = false) List<Integer> userIds,
@RequestParam(value = "startDate") Date startDate,
@RequestParam(value = "endDate") Date endDate){
return appUserSellingWaterBiz.findStatffSellerWaterByUserIdsAndTime(userIds,startDate,endDate);
}
......
package com.github.wxiaoqi.security.admin.rest.admin;
import com.github.wxiaoqi.security.admin.biz.StaffStatisticsBiz;
import com.github.wxiaoqi.security.admin.dto.StaffStatisticsFindDTO;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/11/26 16:59
*/
@RestController
@RequestMapping("/staff_statistics")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class StaffStatisticsAdminController {
private final StaffStatisticsBiz staffStatisticsBiz;
@PostMapping("/page")
public ObjectRestResponse<Map<String,Object>> lisetStaffStatisticsWithPage(@RequestBody StaffStatisticsFindDTO staffStatisticsFindDTO){
Map<String,Object> result = staffStatisticsBiz.listStaffStatisticsWithPage(staffStatisticsFindDTO);
return ObjectRestResponse.succ(result);
}
}
......@@ -236,11 +236,44 @@
<!--查询非普通用户-->
<select id="selectAllStaffs" resultType="com.github.wxiaoqi.security.admin.bo.UserStaffBo">
select aud.realname as `realName`,aud.nickname as `nickName`,aul.username as `phone`,aupt.position_id as `postionId`,aupt.company_id as `companyId`,aupt.company_name as `companyName`
from `app_user_detail` as `aud` left join `app_user_login` as `aul`
on aul.id=aud.userid left join `app_user_position_temp` as `aupt`
on aupt.user_id=aul.id left join `app_user_position` as `aup`
on aup.id=aupt.position_id
select aud.userid as `userId`,aud.realname as `realName`,aud.nickname as `nickName`,aul.username as `phone`,aud.position_id as `postionId`,aup.name as `postionName`,aupt.company_id as `companyId`,aupt.company_name as `companyName`
from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=aud.userid
left join `app_user_position_temp` as `aupt` on aupt.user_id=aul.id
left join `app_user_position` as `aup` on aup.id=aud.position_id
where <![CDATA[aud.position_id<>6]]> and aud.isdel=0
</select>
<select id="getUserByUserIdList" resultMap="AppUserVoMap">
select
l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.*,p.name as
jobTitle,buml.name as memberName from app_user_login l
left join app_user_detail d
on d.userid = l.id
left join base_user_member bum
on bum.user_id=l.id
left join (select level, name from base_user_member_level level where isdel = 0) buml
on bum.member_level = buml.level
left join (select id, name from app_user_position where is_del=0) p
on d.position_id=p.id
where l.isdel=0 and
d.userid in
<foreach collection="userIds" item="userId" index="index" open="(" separator="," close=")">
#{userId}
</foreach>
</select>
<select id="findAllStaffsByCompanyIdAndPostionIdWithPage"
resultType="com.github.wxiaoqi.security.admin.bo.UserStaffBo">
select aud.userid as `userId`,aud.realname as `realName`,aud.nickname as `nickName`,aul.username as `phone`,aud.position_id as `postionId`,aup.name as `postionName`,aupt.company_id as `companyId`,aupt.company_name as `companyName`
from `app_user_detail` as `aud` left join `app_user_login` as `aul` on aul.id=aud.userid
left join `app_user_position_temp` as `aupt` on aupt.user_id=aul.id
left join `app_user_position` as `aup` on aup.id=aud.position_id
where <![CDATA[aud.position_id<>6]]> and aud.isdel=0
<if test="userPostionId!=null">
and aud.`position_id`=#{userPostionId}
</if>
<if test="companyId!=null">
and aupt.`company_id`=#{companyId}
</if>
</select>
......
......@@ -152,7 +152,7 @@ FROM
</select>
<select id="statisticsStatffSellerWaterByUserIdsAndTime"
resultType="com.github.wxiaoqi.security.admin.bo.UserStaffBo">
resultType="com.github.wxiaoqi.security.admin.dto.AppUserSellingWaterDTO">
SELECT
`auswu`.user_id, ( IFNULL(auswu.upIncome,0) - IFNULL(auswd.dowIncome,0) ) AS `commission`
FROM
......
......@@ -46,7 +46,7 @@ public class StaffStatistics implements Serializable {
protected String weekOfYear;
@ApiModelProperty("员工所属公司id")
@Column(name = "compnay_id")
@Column(name = "company_id")
private Integer companyId;
@ApiModelProperty("公司名称")
......
package com.xxfc.platform.order.feign;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.pojo.dto.OrderDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by ace on 2017/9/15.
......@@ -25,4 +23,8 @@ public interface OrderFeign {
@GetMapping("/count/list")
public ObjectRestResponse<List<OrderPageVO>> getOrderList(@RequestParam("dateTime")Long dateTime, @RequestParam("type")Integer type, @RequestParam("status")Integer status);
@GetMapping(value = "/count/basebase/findByOrderIds")
public ObjectRestResponse<List<OrderDTO>> findOrdersByorderId(@RequestParam(value = "orderIds") List<Integer> orderIds);
}
......@@ -889,6 +889,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return userFeign;
}
/**
* 订单查询类
*/
......@@ -916,6 +917,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
return CollectionUtils.isEmpty(orderDTOS)?Collections.EMPTY_LIST:orderDTOS;
}
public List<OrderDTO> selectBaeOrderByOrderIds(List<Integer> orderIds) {
List<OrderDTO> orderDTOList = mapper.selectBaeOrderByOrderIds(orderIds);
return CollectionUtils.isNotEmpty(orderDTOList)?Collections.EMPTY_LIST:orderDTOList;
}
public List<OrderPageVO> selectAllRentVehicleOrder(Map<String, Object> paramMap) {
return mapper.selectAllRentVehicleOrder(paramMap);
}
......
......@@ -22,7 +22,7 @@ import java.util.Enumeration;
* @see FeignHeadConfiguration
* @since JDK1.8
*/
@Configuration
//@Configuration
@Slf4j
public class FeignHeadConfiguration {
......
......@@ -2,6 +2,10 @@ package com.xxfc.platform.order.jobhandler;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.admin.entity.AppUserPosition;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.vo.WalletPostionVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.StaffStatisticsBiz;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxl.job.core.biz.model.ReturnT;
......@@ -13,7 +17,9 @@ import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author libin
......@@ -27,6 +33,7 @@ import java.util.Map;
public class SaffStatisticsJobHandler extends IJobHandler {
private final StaffStatisticsBiz staffStatisticsBiz;
private final VehicleFeign vehicleFeign;
private final UserFeign userFeign;
@Override
public ReturnT<String> execute(String arg) throws Exception {
//1.查询公司
......@@ -39,7 +46,11 @@ public class SaffStatisticsJobHandler extends IJobHandler {
}
Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate();
staffStatisticsBiz.staffStatisticsJob(startDate,endDate,companyMap);
ObjectRestResponse<List<WalletPostionVo>> response = userFeign.findAllPostions();
Map<Integer, String> postionMap = response.getData().stream().collect(Collectors.toMap(WalletPostionVo::getId, WalletPostionVo::getName));
staffStatisticsBiz.staffStatisticsJob(startDate,endDate,companyMap,postionMap);
return ReturnT.SUCCESS;
}
}
......@@ -39,8 +39,12 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> {
List<MemberOrderBo> findMemberOrders(MemberOrderFindDTO memberOrderFindDTO);
public List<BgOrderListVo> getAllOrderList(Map<String, Object> paramMap);
List<OrderDTO> selectOrdersByTypeAndTime(@Param("types") List<Integer> types,
@Param("hasPay") Integer hasPay,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
List<OrderDTO> selectBaeOrderByOrderIds(@Param("orderIds") List<Integer> orderIds);
}
......@@ -24,6 +24,7 @@ import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.dto.OrderDTO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.order.CancelOrderDTO;
import com.xxfc.platform.order.pojo.order.OrderAboutParamDTO;
......@@ -473,4 +474,12 @@ public class BaseOrderController extends CommonBaseController implements UserRes
return ObjectRestResponse.succ();
}
@RequestMapping(value = "/basebase/aaa", method = RequestMethod.GET)
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse<List<OrderDTO>> findOrdersByorderId(@RequestParam(value = "orderIds") String orderIds){
return ObjectRestResponse.succ();
//ObjectRestResponse.succ(baseOrderBiz.selectBaeOrderByOrderIds(orderIds));
}
}
package com.xxfc.platform.order.rest.background;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.rpc.OrderListBiz;
import com.xxfc.platform.order.pojo.dto.OrderDTO;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
......@@ -18,9 +19,18 @@ public class OrderListController {
@Autowired
OrderListBiz orderListBiz;
@Autowired
private BaseOrderBiz baseOrderBiz;
@GetMapping("/list")
public ObjectRestResponse<List<OrderPageVO>> getOrderList(@RequestParam("dateTime")Long dateTime, @RequestParam("type")Integer type, @RequestParam("status")Integer status) {
return orderListBiz.getOrderList(dateTime, type, status);
}
@GetMapping(value = "/basebase/findByOrderIds")
@IgnoreClientToken
@IgnoreUserToken
public ObjectRestResponse<List<OrderDTO>> findOrdersByorderId(@RequestParam(value = "orderIds") List<Integer> orderIds){
return ObjectRestResponse.succ(baseOrderBiz.selectBaeOrderByOrderIds(orderIds));
}
}
......@@ -432,4 +432,11 @@
LEFT JOIN (select `order_id`,`member_level` AS `memberLevel` from `order_member_detail`) AS `omd` ON
omd.order_id=bo.id;
</select>
<select id="selectBaeOrderByOrderIds" resultType="com.xxfc.platform.order.pojo.dto.OrderDTO">
select `id`,`parent_user_company_id` as `companyId` from `base_order` where id in
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
#{orderId}
</foreach>
</select>
</mapper>
\ No newline at end of file
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