Commit 2bd7f88c by yao.xiao

暂存-修改佣金发放状态

parent 1f8683b1
package com.yd.api.agms; package com.yd.api.agms;
import com.yd.api.agms.service.AgmsDashboardService; import com.yd.api.agms.service.AgmsDashboardService;
import com.yd.api.agms.service.AgmsFortuneService;
import com.yd.api.agms.vo.dashboard.*; import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.agms.service.AgmsStatisticsService; import com.yd.api.agms.service.AgmsStatisticsService;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO; import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO; import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO; import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO;
...@@ -24,6 +27,8 @@ public class AgmsController { ...@@ -24,6 +27,8 @@ public class AgmsController {
private AgmsDashboardService agmsDashboardService; private AgmsDashboardService agmsDashboardService;
@Autowired @Autowired
private AgmsStatisticsService agmsStatisticsService; private AgmsStatisticsService agmsStatisticsService;
@Autowired
private AgmsFortuneService agmsFortuneService;
/** /**
* AGMS -- 财务管理报表 * AGMS -- 财务管理报表
...@@ -122,4 +127,18 @@ public class AgmsController { ...@@ -122,4 +127,18 @@ public class AgmsController {
result.addResult(responseVO); result.addResult(responseVO);
return result; return result;
} }
/**
* AGMS -- 修改佣金发放状态
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping(value="/commissionPayoutStatusUpdate")
public Object commissionPayoutStatusUpdate(@RequestBody CommissionPayoutStatusUpdateRequestVO requestVO) {
JsonResult result = new JsonResult();
CommissionPayoutStatusUpdateResponseVO responseVO = agmsFortuneService.commissionPayoutStatusUpdate(requestVO);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
} }
package com.yd.api.agms.service;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO;
/**
* @author xxy
*/
public interface AgmsFortuneService {
/**
* AGMS -- 修改佣金发放状态
* @param requestVO 请求数据
* @return 响应数据
*/
CommissionPayoutStatusUpdateResponseVO commissionPayoutStatusUpdate(CommissionPayoutStatusUpdateRequestVO requestVO);
}
package com.yd.api.agms.service.impl;
import com.yd.api.agms.service.AgmsFortuneService;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateRequestVO;
import com.yd.api.agms.vo.fortune.CommissionPayoutStatusUpdateResponseVO;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import com.yd.dal.service.customer.AclCustomerFortuneDALService;
import com.yd.dal.service.customer.AclCustomerFortuneWithdrawDALService;
import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Method;
import java.security.acl.Acl;
import java.util.*;
/**
* @author xxy
*/
@Service("agmsFortuneService")
public class AgmsFortuneServiceImpl implements AgmsFortuneService {
private AclCustomerFortuneDALService customerFortuneDalService;
private AclCustomerFortuneWithdrawDALService customerFortuneWithdrawDalService;
@Autowired
public void setAclCustomerFortuneDalService(AclCustomerFortuneDALService customerFortuneDalService) {
this.customerFortuneDalService = customerFortuneDalService;
}
@Autowired
public void setAclCustomerFortuneWithdrawDalService(AclCustomerFortuneWithdrawDALService customerFortuneWithdrawDalService) {
this.customerFortuneWithdrawDalService = customerFortuneWithdrawDalService;
}
@Override
public CommissionPayoutStatusUpdateResponseVO commissionPayoutStatusUpdate(CommissionPayoutStatusUpdateRequestVO requestVO) {
CommissionPayoutStatusUpdateResponseVO responseVO = new CommissionPayoutStatusUpdateResponseVO();
Long[] fortuneIds = requestVO.getFortuneIds();
//1.暂不可发 2.可发放 3.保留
String paymentStatus = requestVO.getPaymentStatus();
Long loginId = requestVO.getLoginId();
//查询出需修改的佣金发放状态的财富
List<AclCustomerFortune> customerFortunes = customerFortuneDalService.findByIds(fortuneIds);
if (("2").equals(paymentStatus)){
//如paymentStatus = 2(可发放),只需统计Fortune对应Customer最后一笔未支付的Withdraw,重新计算,如没有Withdraw生成一条新的Withdraw记录
canPaymentUpDate(paymentStatus,loginId,customerFortunes);
}else {
//如paymentStatus != 2(暂不可发,保留),只需统计原Fortune对应的Withdraw,重新计算
noPaymentUpDate(paymentStatus,loginId,customerFortunes);
}
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
private void canPaymentUpDate(String paymentStatus, Long loginId, List<AclCustomerFortune> customerFortunes) {
//将查询出来的财富列表根据customerId经行分类
Map<Long,List<AclCustomerFortune>> customerFortuneMap = changeCustomerFortunes(customerFortunes);
//获得所有需要修改佣金发放状的customerIds
Set<Long> customerIds = customerFortuneMap.keySet();
//查询这些customerId最后一笔未完成的提现记录ag_acl_customer_fortune_withdraw,需重新计算withdraw
Map<Long,Long> customerWithdrawMap = customerFortuneWithdrawDalService.findFinalWithdrawNoPayByCustomerIds(customerIds);
//没有最后一笔提现记录客户信息和此次提现的财富记录 customerId fortunes
Map<Long,List<AclCustomerFortune>> newCustomerWithdrawMap = new HashMap<>(16);
//可直接修改的fortune记录(需修改佣金发放状态)
List<AclCustomerFortune> fortuneUpdates = new ArrayList<>();
for(Map.Entry<Long, List<AclCustomerFortune>> customerFortune:customerFortuneMap.entrySet()){
//获取需要修改佣金发放状态的经纪人
Long customerId = customerFortune.getKey();
//此customer最后一笔提现记录id
Long withdrawId = customerWithdrawMap.get(customerId);
//新提现的记录
List<AclCustomerFortune> newFortunes = new ArrayList<>();
//获取休要修改的佣金发放状态的财富记录
List<AclCustomerFortune> fortunes = customerFortune.getValue();
//判断这些财富记录中佣金发放状态和要修改的状态是否一致,如一致,则不需要修改
for(AclCustomerFortune fortune : customerFortunes) {
//不一致,进行修改,并保存需修改的fortune和记录需要新生成的fortune
if (!paymentStatus.equals(fortune.getCommissionPayoutStatus())) {
fortune.setCommissionPayoutStatus(paymentStatus);
fortune.setCommissionPayoutBy(loginId);
fortune.setCommissionPayoutAt(new Date());
if (CommonUtil.isNullOrZero(withdrawId)){
//需生成新的withdraw
newFortunes.add(fortune);
}else {
//可直接修改fortune
fortune.setWithdrawedId(withdrawId);
fortuneUpdates.add(fortune);
}
}
}
if (!newFortunes.isEmpty()){
newCustomerWithdrawMap.put(customerId,newFortunes);
}
}
//批量更新需要修改的fortune记录
customerFortuneDalService.updateBatch(fortuneUpdates);
//重新计算受到影响的withdraw
List<Long> withdrawUpdateIds = new ArrayList<>(customerWithdrawMap.keySet());
recalculateWithdraw(withdrawUpdateIds);
//更新生成新的提现记录,及支付记录,fortune中记录对应的withdraw.id
insertWithdraw(newCustomerWithdrawMap);
}
private void noPaymentUpDate(String paymentStatus, Long loginId, List<AclCustomerFortune> customerFortunes) {
//需要修改的fortune记录(需修改佣金发放状态)
List<AclCustomerFortune> fortuneUpdates = new ArrayList<>();
//需要重新计算的withdraw.id
List<Long> withdrawUpdateIds = new ArrayList<>();
for(AclCustomerFortune fortune : customerFortunes){
//不一致,进行修改,并保存需修改的fortune和需重新计算的withdrawIds
if (!paymentStatus.equals(fortune.getCommissionPayoutStatus())){
fortune.setCommissionPayoutStatus(paymentStatus);
fortune.setCommissionPayoutBy(loginId);
fortune.setCommissionPayoutAt(new Date());
Long withdrawId = fortune.getWithdrawedId();
fortune.setWithdrawedId(null);
fortuneUpdates.add(fortune);
if (!CommonUtil.isNullOrZero(withdrawId)){
withdrawUpdateIds.add(withdrawId);
}
}
}
//批量更新需要修改的fortune记录
customerFortuneDalService.updateBatch(fortuneUpdates);
//重新计算受到影响的withdraw
recalculateWithdraw(withdrawUpdateIds);
}
private void recalculateWithdraw(List<Long> withdrawUpdateIds) {
if (withdrawUpdateIds.isEmpty()){
return;
}
System.out.println("recalculateWithdraw");
// List<AclCustomerFortune> fortunes = customerFortuneDalService.findByWithdrawIds(withdrawUpdateIds);
}
private void insertWithdraw(Map<Long, List<AclCustomerFortune>> newCustomerWithdrawMap) {
if (newCustomerWithdrawMap.isEmpty()){
return;
}
System.out.println("insertWithdraw");
}
private Map<Long, List<AclCustomerFortune>> changeCustomerFortunes(List<AclCustomerFortune> customerFortunes) {
Map<Long, List<AclCustomerFortune>> map = new HashMap<>(16);
for (AclCustomerFortune list: customerFortunes) {
List<AclCustomerFortune> customerFortuneList = map.get(list.getCustomerId());
customerFortuneList = Optional.ofNullable(customerFortuneList).orElse(new ArrayList<>());
if (customerFortuneList.isEmpty()){
customerFortuneList.add(list);
map.put(list.getCustomerId(),customerFortuneList);
}else {
customerFortuneList.add(list);
}
}
return map;
}
private Map<Long, List<Object>> changeList(List<Object> objList ,String name) {
Map<Long, List<Object>> map = new HashMap<>(16);
for (Object obj: objList) {
List<Object> list = map.get(getFieldValueByName(name,obj));
list = Optional.ofNullable(list).orElse(new ArrayList<>());
if (list.isEmpty()){
list.add(list);
map.put(getFieldValueByName(name,obj),list);
}else {
list.add(list);
}
}
return map;
}
/**
* 根据属性名获取属性值
* */
private Long getFieldValueByName(String fieldName, Object o) {
try {
String firstLetter = fieldName.substring(0, 1).toUpperCase();
String getter = "get" + firstLetter + fieldName.substring(1);
Method method = o.getClass().getMethod(getter, new Class[] {});
return (Long) method.invoke(o, new Object[] {});
} catch (Exception e) {
return null;
}
}
}
package com.yd.api.agms.vo.fortune;
import lombok.Data;
/**
* @author xxy
*/
@Data
public class CommissionPayoutStatusUpdateRequestVO {
/**
* 财富id,fortuneId
*/
private Long[] fortuneIds;
/**
* 佣金发放状态
* 1.暂不可发 2.可发放 3.保留
*/
private String paymentStatus;
/**
* 登入者id,loginId
*/
private Long loginId;
}
package com.yd.api.agms.vo.fortune;
import com.yd.api.result.CommonResult;
import lombok.Data;
/**
* @author xxy
*/
@Data
public class CommissionPayoutStatusUpdateResponseVO {
private CommonResult commonResult;
}
package com.yd.dal.entity.customer; package com.yd.dal.entity.customer;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;
/** /**
* ag_acl_customer_fortune * fortune record of customer
* @author
*/ */
@Data @Data
public class AclCustomerFortune implements Serializable { public class AclCustomerFortune {
private static final long serialVersionUID = 1L;
/** /**
* serial id * serial id
*/ */
...@@ -46,14 +45,14 @@ public class AclCustomerFortune implements Serializable { ...@@ -46,14 +45,14 @@ public class AclCustomerFortune implements Serializable {
private BigDecimal commissionAmount; private BigDecimal commissionAmount;
/** /**
* FK ag_product_plan_commission,ag_product_life_plan_commission公告佣金率 * 公告佣金率存百分值
*/ */
private BigDecimal announcementCommissionRate; private BigDecimal fycRate;
/** /**
* 公告佣金 * 公告佣金
*/ */
private BigDecimal announcementCommissionAmount; private BigDecimal fycAmount;
/** /**
* FK ag_acl_channel_referral_rate个人职级佣金率 * FK ag_acl_channel_referral_rate个人职级佣金率
...@@ -61,13 +60,38 @@ public class AclCustomerFortune implements Serializable { ...@@ -61,13 +60,38 @@ public class AclCustomerFortune implements Serializable {
private BigDecimal gradeCommissionRate; private BigDecimal gradeCommissionRate;
/** /**
* %=referral amount / order price * 多个代理人财富分摊比例
*/
private BigDecimal shareRate;
/**
* %=referral amount / order price
*/ */
private BigDecimal referralRate; private BigDecimal referralRate;
private BigDecimal referralAmount; private BigDecimal referralAmount;
/** /**
* 发佣年月
*/
private String monthPeriod;
/**
* 佣金类型
*/
private String commissionType;
/**
* FK ag_md_drop_options.drop_option_code where master = Commission_Type,佣金项目类型编码
*/
private String dropOptionCode;
/**
* 经纪人等级
*/
private String practitionerLevel;
/**
* 0=No, 1=Yes * 0=No, 1=Yes
*/ */
private Integer isTax; private Integer isTax;
...@@ -82,11 +106,31 @@ public class AclCustomerFortune implements Serializable { ...@@ -82,11 +106,31 @@ public class AclCustomerFortune implements Serializable {
private Long campaignId; private Long campaignId;
/** /**
* 推广活动
*/
private String campaignName;
/**
* 可提现日期,在生产记录时就算好 * 可提现日期,在生产记录时就算好
*/ */
private Date withdrawableDate; private Date withdrawableDate;
/** /**
* FK ag_md_drop_options.drop_option_code where master = Commission_Payout_Status,佣金发放状态
*/
private String commissionPayoutStatus;
/**
* 发放状态修改时间
*/
private Date commissionPayoutAt;
/**
* FK ag_acl_user.id
*/
private Long commissionPayoutBy;
/**
* FK ag_acl_customer_fortune_withdraw.id 提现表的id * FK ag_acl_customer_fortune_withdraw.id 提现表的id
*/ */
private Long withdrawedId; private Long withdrawedId;
...@@ -105,6 +149,4 @@ public class AclCustomerFortune implements Serializable { ...@@ -105,6 +149,4 @@ public class AclCustomerFortune implements Serializable {
* FK ag_acl_customer.id * FK ag_acl_customer.id
*/ */
private Long createdBy; private Long createdBy;
private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package com.yd.dal.entity.customer;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* 财务红包小助手真实付给客户提现记录
*/
@Data
public class AclCustomerFortunePay {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_customer_fortune_withdraw.id
*/
private Long withdrawId;
/**
* 提现金额
*/
private BigDecimal withdrawAmount;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
private String customerName;
/**
* 活动id, FK ag_md_mk_campaign.id
*/
private Long campaignId;
/**
* 活动名称
*/
private String campaignName;
/**
* 活动酬金额
*/
private BigDecimal campaingReward;
/**
* 收款者
*/
private String payTo;
private String payToMobile;
/**
* 收款者微信账号
*/
private String payToWechat;
/**
* 收款者证件类型 FK ag_md_id_type, 1=身份证 2=护照 4=台胞证 5=香港身份证
*/
private Long payToIdTypeId;
/**
* 收款者证件号码
*/
private String payToIdNo;
/**
* 收款者生日
*/
private Date payToBirthday;
/**
* 收款者性别 1=Male, 2=Female
*/
private Integer payToGender;
/**
* 付款日
*/
private Date payDate;
/**
* 付款金额
*/
private BigDecimal payAmount;
/**
* 代缴税额
*/
private BigDecimal taxAmount;
/**
* 付款执行者
*/
private String paidBy;
/**
* 1. Wechat red envelope 3. Bank
*/
private Integer paidMethod;
/**
* 0. 待付 1已付
*/
private Integer payStatus;
/**
* 注释或补充
*/
private String remark;
private Date createdAt;
private Long createdBy;
private Date updatedAt;
/**
* 变更者 id
*/
private Long updatedBy;
}
\ No newline at end of file
package com.yd.dal.entity.customer;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* customer withdrawl record
*/
@Data
public class AclCustomerFortuneWithdraw {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
/**
* FK ag_acl_customer_lottery_draws.id
*/
private Long lotteryDrawsId;
/**
* balance before withdrawal
*/
private BigDecimal withdrawBeforeAmount;
private BigDecimal withdrawAmount;
/**
* balance after withdrawal
*/
private BigDecimal withdrawAfterAmount;
/**
* 0=No=申请中, 1=Yes=已付
*/
private Integer isPaid;
/**
* Paid date by finance
*/
private Date paidDate;
private BigDecimal paidAmount;
/**
* 付款后的待缴税额
*/
private BigDecimal taxAmount;
/**
* 1. Wechat red envelope 3. Bank
*/
private Integer paidMethod;
/**
* 提现申请者
*/
private String requestorName;
/**
* 证件类型 FK ag_md_id_type, 1=身份证 2=护照 4=台胞证 5=香港身份证
*/
private Long requestorIdTypeId;
/**
* 证件号码
*/
private String requestorId;
/**
* 申请者生日
*/
private Date requestorBirthdate;
/**
* 申请者性别 1=Male, 2=Female
*/
private Integer requestorGender;
/**
* 0=核实中, 1=已支付关帐, 2=取消
*/
private Integer status;
/**
* 提现申请者wechat id (加入红包小助手)
*/
private String wechatId;
/**
* 创建时间
*/
private Date createdAt;
/**
* 创建人
*/
private Long createdBy;
}
\ No newline at end of file
package com.yd.dal.mapper.customer; package com.yd.dal.mapper.customer;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics; import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.entity.customer.AclCustomerFortune;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortuneMapper { public interface AclCustomerFortuneMapper {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
...@@ -19,5 +17,13 @@ public interface AclCustomerFortuneMapper { ...@@ -19,5 +17,13 @@ public interface AclCustomerFortuneMapper {
int updateByPrimaryKey(AclCustomerFortune record); int updateByPrimaryKey(AclCustomerFortune record);
int updateBatch(List<AclCustomerFortune> list);
int updateBatchSelective(List<AclCustomerFortune> list);
int batchInsert(@Param("list") List<AclCustomerFortune> list);
List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(@Param("subordinateSystemId") Long subordinateSystemId, @Param("time") Integer time); List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(@Param("subordinateSystemId") Long subordinateSystemId, @Param("time") Integer time);
List<AclCustomerFortune> findByIds(Long[] fortuneIds);
} }
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomerFortunePay;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortunePayMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortunePay record);
int insertSelective(AclCustomerFortunePay record);
AclCustomerFortunePay selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortunePay record);
int updateByPrimaryKey(AclCustomerFortunePay record);
int updateBatch(List<AclCustomerFortunePay> list);
int updateBatchSelective(List<AclCustomerFortunePay> list);
int batchInsert(@Param("list") List<AclCustomerFortunePay> list);
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortuneWithdrawMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortuneWithdraw record);
int insertSelective(AclCustomerFortuneWithdraw record);
AclCustomerFortuneWithdraw selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortuneWithdraw record);
int updateByPrimaryKey(AclCustomerFortuneWithdraw record);
int updateBatch(List<AclCustomerFortuneWithdraw> list);
int updateBatchSelective(List<AclCustomerFortuneWithdraw> list);
int batchInsert(@Param("list") List<AclCustomerFortuneWithdraw> list);
List<Map<String, Object>> findFinalWithdrawNoPayByCustomerIds(List<Long> customerIdList);
}
\ No newline at end of file
package com.yd.dal.service.customer; package com.yd.dal.service.customer;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics; import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import com.yd.dal.entity.customer.AclCustomerFortune;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
/**
* @author xxy
*/
@Service("aclCustomerFortuneDALService") @Service("aclCustomerFortuneDALService")
public interface AclCustomerFortuneDALService { public interface AclCustomerFortuneDALService {
List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time); List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time);
List<AclCustomerFortune> findByIds(Long[] fortuneIds);
void updateBatch(List<AclCustomerFortune> fortuneUpdates);
} }
package com.yd.dal.service.customer;
import org.springframework.stereotype.Service;
/**
* @author xxy
*/
public interface AclCustomerFortunePayDALService {
}
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.Set;
/**
* @author xxy
*/
public interface AclCustomerFortuneWithdrawDALService {
/**
* 查询这些customerId最后一笔未完成的提现记录
* @param customerIds 客户id
* @return map customerId withdrawId
*/
Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds);
}
package com.yd.dal.service.customer.impl; package com.yd.dal.service.customer.impl;
import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics; import com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics;
import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.mapper.customer.AclCustomerFortuneMapper; import com.yd.dal.mapper.customer.AclCustomerFortuneMapper;
import com.yd.dal.service.customer.AclCustomerFortuneDALService; import com.yd.dal.service.customer.AclCustomerFortuneDALService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -16,4 +17,16 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe ...@@ -16,4 +17,16 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe
public List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time) { public List<AclCustomerFortuneStatistics> findBySubordinateSystemStatistics(Long subordinateSystemId, Integer time) {
return aclCustomerFortuneMapper.findBySubordinateSystemStatistics(subordinateSystemId,time); return aclCustomerFortuneMapper.findBySubordinateSystemStatistics(subordinateSystemId,time);
} }
@Override
public List<AclCustomerFortune> findByIds(Long[] fortuneIds) {
return aclCustomerFortuneMapper.findByIds(fortuneIds);
}
@Override
public void updateBatch(List<AclCustomerFortune> fortuneUpdates) {
if (!fortuneUpdates.isEmpty()){
aclCustomerFortuneMapper.updateBatch(fortuneUpdates);
}
}
} }
package com.yd.dal.service.customer.impl;
import com.yd.dal.service.customer.AclCustomerFortunePayDALService;
/**
* @author xxy
*/
public class AclCustomerFortunePayDALServiceImpl implements AclCustomerFortunePayDALService {
}
package com.yd.dal.service.customer.impl;
import com.yd.dal.mapper.customer.AclCustomerFortuneWithdrawMapper;
import com.yd.dal.service.customer.AclCustomerFortuneWithdrawDALService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author xxy
*/
@Service("aclCustomerFortuneWithdrawDALService")
public class AclCustomerFortuneWithdrawDALServiceImpl implements AclCustomerFortuneWithdrawDALService {
@Autowired
private AclCustomerFortuneWithdrawMapper customerFortuneWithdrawMapper;
@Override
public Map<Long, Long> findFinalWithdrawNoPayByCustomerIds(Set<Long> customerIds) {
List<Long> customerIdList = new ArrayList<>(customerIds);
List<Map<String,Object>> customerWithdrawList = customerFortuneWithdrawMapper.findFinalWithdrawNoPayByCustomerIds(customerIdList);
Map<Long, Long> customerWithdrawMap = new HashMap<>(16);
for (Map<String, Object> customerWithdraw : customerWithdrawList) {
Long customerId = (Long) customerWithdraw.get("customerId");
String withdrawIds = (String) customerWithdraw.get("withdrawIds");
//查询接口中以进行排序,转为数组,取最后一个
List<String> withdrawList = Arrays.asList(withdrawIds.split(","));
Long withdrawId = Long.valueOf(withdrawList.get(withdrawList.size()-1));
customerWithdrawMap.put(customerId,withdrawId);
}
return customerWithdrawMap;
}
}
...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml ...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml
######datasource###### ######datasource######
###spring boot自动配置单数据源### ###spring boot自动配置单数据源###
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
spring.datasource.username=devdbuser spring.datasource.username=devdbuser
spring.datasource.password=devdbpass1 spring.datasource.password=devdbpass1
###手动配置多数据源### ###手动配置多数据源###
#master #master
multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver
multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
multiple.datasource.master.username=devdbuser multiple.datasource.master.username=devdbuser
multiple.datasource.master.password=devdbpass1 multiple.datasource.master.password=devdbpass1
......
...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml ...@@ -5,14 +5,14 @@ mybatis.mapper-locations=classpath:mapper/**/*.xml
######datasource###### ######datasource######
###spring boot缺省配置单数据源### ###spring boot缺省配置单数据源###
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true spring.datasource.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
spring.datasource.username=devdbuser spring.datasource.username=devdbuser
spring.datasource.password=devdbpass1 spring.datasource.password=devdbpass1
###手动配置主数据源### ###手动配置主数据源###
#master #master
multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver multiple.datasource.master.driver-class-name=com.mysql.jdbc.Driver
multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true multiple.datasource.master.url=jdbc:mysql://139.224.139.2:13307/ajb?useUnicode=true&characterEncoding=utf8&useSSL=false&useAffectedRows=true&zeroDateTimeBehavior=convertToNull
multiple.datasource.master.username=devdbuser multiple.datasource.master.username=devdbuser
multiple.datasource.master.password=devdbpass1 multiple.datasource.master.password=devdbpass1
......
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