Commit 9d6ad47e by jianan

Merge remote-tracking branch 'origin/dev_20201104_CommissionCheck' into…

Merge remote-tracking branch 'origin/dev_20201104_CommissionCheck' into dev_20201104_CommissionCheck

# Conflicts:
#	yd-api/src/main/java/com/yd/api/agms/service/AgmsFortuneService.java
#	yd-api/src/main/java/com/yd/api/agms/service/impl/AgmsFortuneServiceImpl.java
#	yd-api/src/main/java/com/yd/dal/service/agms/impl/AgmsFortuneDALServiceImpl.java
parents ce44cef6 e8049cd9
......@@ -116,8 +116,8 @@ public class AgmsController {
/**
* AGMS -- 商机统计报表
* @param requestVO
* @return
* @param requestVO requestVO
* @return 响应数据
*/
@RequestMapping(value="/leadsStatistics")
public Object leadsStatistics(@RequestBody LeadsStatisticsRequestVO requestVO,HttpServletResponse response) {
......@@ -148,7 +148,7 @@ public class AgmsController {
* @return 响应数据
*/
@RequestMapping(value="/commissionPayoutStatusQuery")
public Object commissionPayoutStatusQuery(@RequestBody CommissionPayoutStatusQueryRequestVO requestVO) throws InvocationTargetException, IllegalAccessException {
public Object commissionPayoutStatusQuery(@RequestBody CommissionPayoutStatusQueryRequestVO requestVO){
JsonResult result = new JsonResult();
CommissionPayoutStatusQueryResponseVO responseVO = agmsFortuneService.commissionPayoutStatusQuery(requestVO);
result.setData(responseVO);
......@@ -162,7 +162,7 @@ public class AgmsController {
* @return 响应数据
*/
@RequestMapping("/withdrawQuery")
public Object withdrawQuery(@RequestBody WithdrawQueryRequestVO requestVO) throws InvocationTargetException, IllegalAccessException {
public Object withdrawQuery(@RequestBody WithdrawQueryRequestVO requestVO){
JsonResult result = new JsonResult();
WithdrawQueryResponseVO withdrawQueryResponseVO = agmsFortuneService.withdrawQuery(requestVO);
result.addResult(withdrawQueryResponseVO);
......@@ -184,4 +184,17 @@ public class AgmsController {
return result;
}
/**
* AGMS -- 财富批量支付
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping(value="/fortunePay")
public Object fortunePay(@RequestBody FortunePayRequestVO requestVO) {
JsonResult result = new JsonResult();
FortunePayResponseVO responseVO = agmsFortuneService.fortunePay(requestVO);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
}
......@@ -26,14 +26,14 @@ public interface AgmsFortuneService {
* @throws InvocationTargetException InvocationTargetException
* @throws IllegalAccessException IllegalAccessException
*/
CommissionPayoutStatusQueryResponseVO commissionPayoutStatusQuery(CommissionPayoutStatusQueryRequestVO requestVO) throws InvocationTargetException, IllegalAccessException;
CommissionPayoutStatusQueryResponseVO commissionPayoutStatusQuery(CommissionPayoutStatusQueryRequestVO requestVO);
/**
* AGMS -- 支付列表查询
* @param requestVO 请求数据
* @return 响应数据
*/
WithdrawQueryResponseVO withdrawQuery(WithdrawQueryRequestVO requestVO) throws InvocationTargetException, IllegalAccessException ;
WithdrawQueryResponseVO withdrawQuery(WithdrawQueryRequestVO requestVO);
/**
* AGMS -- 提现财富对应订单查询
......@@ -42,6 +42,13 @@ public interface AgmsFortuneService {
*/
FortunePayToOrderResponseVO fortunePayToOrder(FortunePayToOrderRequestVO requestVO);
/**
* AGMS -- 财富批量支付
* @param requestVO 请求数据
* @return 响应数据
*/
FortunePayResponseVO fortunePay(FortunePayRequestVO requestVO);
SurrenderFortuneResponseVO surrenderFortune(SurrenderFortuneRequestVO requestVO);
public void canPaymentUpDate(String paymentStatus, Long payoutBatchId , Long loginId, List<AclCustomerFortune> customerFortunes);
......
......@@ -6,18 +6,17 @@ import com.yd.api.order.vo.SurrenderFortuneRequestVO;
import com.yd.api.order.vo.SurrenderFortuneResponseVO;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.agms.fortune.*;
import com.yd.dal.entity.customer.AclCustomerFortune;
import com.yd.dal.entity.customer.AclCustomerFortunePay;
import com.yd.dal.entity.customer.AclCustomerFortunePayoutBatch;
import com.yd.dal.entity.customer.AclCustomerFortuneWithdraw;
import com.yd.dal.entity.customer.AclPolicyholder;
import com.yd.dal.entity.customer.*;
import com.yd.dal.entity.meta.MdIncometaxRate;
import com.yd.dal.entity.user.AclUser;
import com.yd.dal.entity.order.PoOrder;
import com.yd.dal.entity.product.Product;
import com.yd.dal.entity.product.ProductPlan;
import com.yd.dal.service.agms.AclCustomerFortuneStatisticService;
import com.yd.dal.service.agms.AgmsFortuneDALService;
import com.yd.dal.service.customer.*;
import com.yd.dal.service.user.AclUserDALService;
import com.yd.dal.service.customer.*;
import com.yd.dal.service.order.PoOrderDALService;
import com.yd.dal.service.product.ProductDALService;
import com.yd.dal.service.product.ProductPlanDALService;
......@@ -25,9 +24,12 @@ import com.yd.rmi.ali.send.service.SendService;
import com.yd.rmi.cache.SystemConfigService;
import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
......@@ -46,6 +48,8 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
private AgmsFortuneDALService agmsFortuneDalService;
private SystemConfigService systemConfigService;
private AclCustomerFortunePayoutBatchDALService customerFortunePayoutBatchDalService;
private AclCustomerFortuneStatisticDALService customerFortuneStatisticDalService;
private AclUserDALService userDalService;
@Autowired
public void setAclCustomerFortuneDalService(AclCustomerFortuneDALService customerFortuneDalService) {
this.customerFortuneDalService = customerFortuneDalService;
......@@ -76,6 +80,15 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
}
@Autowired
public void setAclUserDALService(AclUserDALService userDalService){
this.userDalService = userDalService;
}
@Autowired
public void setAclCustomerFortuneStatisticDALService(AclCustomerFortuneStatisticDALService customerFortuneStatisticDalService){
this.customerFortuneStatisticDalService = customerFortuneStatisticDalService;
}
@Autowired
private PoOrderDALService poOrderDALService;
@Autowired
private AclCustomerFortuneStatisticService aclCustomerFortuneStatisticService;
......@@ -411,6 +424,8 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
pay.setCustomerName(customerFortuneStatisticalInfo.getCustomerName());
pay.setPaidMethod(1);
pay.setPayStatus(0);
pay.setPayAmount(paidAmount);
pay.setTaxAmount(taxAmount);
pay.setCreatedAt(new Date());
pay.setCreatedBy(loginId);
pay.setUpdatedAt(new Date());
......@@ -499,10 +514,10 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
@Override
public CommissionPayoutStatusQueryResponseVO commissionPayoutStatusQuery(CommissionPayoutStatusQueryRequestVO requestVO) throws InvocationTargetException, IllegalAccessException {
public CommissionPayoutStatusQueryResponseVO commissionPayoutStatusQuery(CommissionPayoutStatusQueryRequestVO requestVO){
CommissionPayoutStatusQueryResponseVO responseVO = new CommissionPayoutStatusQueryResponseVO();
CommissionPayoutStatusQueryInfo info = new CommissionPayoutStatusQueryInfo();
BeanUtils.copyProperties(info,requestVO);
BeanUtils.copyProperties(requestVO,info);
List<CommissionPayoutStatus> commissionPayoutStatusList = agmsFortuneDalService.commissionPayoutStatusQuery(info);
responseVO.setTotalSingular(commissionPayoutStatusList.size());
BigDecimal totalOrderPrice = commissionPayoutStatusList.stream()
......@@ -519,10 +534,10 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
}
@Override
public WithdrawQueryResponseVO withdrawQuery(WithdrawQueryRequestVO requestVO) throws InvocationTargetException, IllegalAccessException {
public WithdrawQueryResponseVO withdrawQuery(WithdrawQueryRequestVO requestVO){
WithdrawQueryResponseVO responseVO = new WithdrawQueryResponseVO();
WithdrawQueryInfo info = new WithdrawQueryInfo();
BeanUtils.copyProperties(info,requestVO);
BeanUtils.copyProperties(requestVO,info);
List<WithdrawLabelInfo> withdraws = agmsFortuneDalService.transformForWithdrawLabel(info);
responseVO.setTotalPeople(withdraws.size());
BigDecimal totalReferralAmount = withdraws.stream()
......@@ -537,17 +552,16 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
@Override
public FortunePayToOrderResponseVO fortunePayToOrder(FortunePayToOrderRequestVO requestVO) {
FortunePayToOrderResponseVO responseVO = new FortunePayToOrderResponseVO();
Long customerId = requestVO.getCustomerId();
Long payId = requestVO.getPayId();
//查询所有订单,并根据支付id标记本次提现订单
List<FortunePayToOrderInfo> fortunePayToOrderInfos = agmsFortuneDalService.fortunePayToOrder(customerId,payId);
responseVO.setTotalSingular(fortunePayToOrderInfos.size());
List<FortunePayToOrderInfo> fortunePayToOrderInfos = agmsFortuneDalService.fortunePayToOrder(payId);
BigDecimal totalOrderPrice = fortunePayToOrderInfos.stream()
.map(f -> f.getOrderPrice() == null ? BigDecimal.ZERO : f.getOrderPrice())
.reduce(BigDecimal.ZERO,BigDecimal::add);
BigDecimal totalReferralAmount = fortunePayToOrderInfos.stream()
.map(f -> f.getReferralAmount() == null ? BigDecimal.ZERO : f.getReferralAmount())
.reduce(BigDecimal.ZERO,BigDecimal::add);
responseVO.setTotalSingular(fortunePayToOrderInfos.size());
responseVO.setTotalOrderPrice(totalOrderPrice);
responseVO.setTotalReferralAmount(totalReferralAmount);
responseVO.setFortunePayToOrderInfos(fortunePayToOrderInfos);
......@@ -555,6 +569,84 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
return responseVO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public FortunePayResponseVO fortunePay(FortunePayRequestVO requestVO) {
FortunePayResponseVO responseVO = new FortunePayResponseVO();
CommonResult commonResult = check(requestVO);
Long[] payIds = requestVO.getPayIds();
Long loginId = requestVO.getLoginId();
AclUser user = userDalService.selectByPrimaryKey(loginId);
//查询所有pay记录和withdraw记录
List<AclCustomerFortunePay> customerFortunePays = customerFortunePayDalService.findByIds(payIds);
Long[] withdrawIds = new Long[customerFortunePays.size()];
for(int i = 0; i <= customerFortunePays.size();i++){
withdrawIds[i] = customerFortunePays.get(i).getWithdrawId();
}
List<AclCustomerFortuneWithdraw> customerFortuneWithdraws = customerFortuneWithdrawDalService.findByIds(Arrays.asList(withdrawIds));
//查询经纪人的静态记录
Long[] customerIds = new Long[customerFortunePays.size()];
for(int i = 0; i <= customerFortunePays.size();i++){
customerIds[i] = customerFortunePays.get(i).getCustomerId();
}
List<AclCustomerFortuneStatistic> customerFortuneStatistics = customerFortuneStatisticDalService.findByCustomerIds(customerIds);
//fortune记录
List<AclCustomerFortune> fortunes = customerFortuneDalService.findByWithdrawIds(Arrays.asList(withdrawIds));
//更新静态表
for (AclCustomerFortuneStatistic statistic: customerFortuneStatistics){
Long customerId = statistic.getCustomerId();
BeanPropertyValueEqualsPredicate predicateClause = new BeanPropertyValueEqualsPredicate( "customerId", customerId);
List<AclCustomerFortuneWithdraw> withdraws = (List<AclCustomerFortuneWithdraw>) CollectionUtils.select(customerFortuneWithdraws,predicateClause);
if (withdraws.isEmpty()){
continue;
}
for (AclCustomerFortuneWithdraw withdraw: withdraws) {
if (CommonUtil.isNullOrZero(withdraw.getIsPaid())){
BigDecimal drawnFortune = statistic.getDrawnFortune();
if (CommonUtil.isNullOrZero(drawnFortune)){
drawnFortune = BigDecimal.ZERO;
}
drawnFortune = drawnFortune.add(withdraw.getWithdrawAmount());
statistic.setDrawnFortune(drawnFortune);
}
}
}
customerFortuneStatisticDalService.updateAll(customerFortuneStatistics);
//修改withdraw记录
customerFortuneWithdraws.forEach(w -> {
w.setIsPaid(1);
w.setPaidDate(new Date());
});
customerFortuneWithdrawDalService.updateAll(customerFortuneWithdraws);
//修改pay表
customerFortunePays.forEach(p -> {
p.setPayStatus(1);
p.setPaidBy(user.getName());
p.setUpdatedAt(new Date());
p.setUpdatedBy(loginId);
});
customerFortunePayDalService.updateAll(customerFortunePays);
//修改fortune
fortunes.forEach(f -> f.setCommissionPayoutStatus("4"));
customerFortuneDalService.updateBatch(fortunes);
responseVO.setCommonResult(commonResult);
return responseVO;
}
private CommonResult check(FortunePayRequestVO requestVO) {
CommonResult commonResult = new CommonResult();
Boolean success = true;
String message = ZHBErrorConfig.getErrorInfo("800000");
Long[] payIds = requestVO.getPayIds();
if (payIds == null || payIds.length == 0){
success = false;
message = ZHBErrorConfig.getErrorInfo("830022");
}
commonResult.setSuccess(success);
commonResult.setMessage(message);
return commonResult;
}
@Override
public SurrenderFortuneResponseVO surrenderFortune(SurrenderFortuneRequestVO requestVO) {
......
package com.yd.api.agms.vo.fortune;
import lombok.Data;
/**
* @author xxy
*/
@Data
public class FortunePayRequestVO {
private Long[] payIds;
private Long loginId;
}
package com.yd.api.agms.vo.fortune;
import com.yd.api.result.CommonResult;
import lombok.Data;
/**
* @author xxy
*/
@Data
public class FortunePayResponseVO {
private CommonResult commonResult;
}
......@@ -7,6 +7,5 @@ import lombok.Data;
*/
@Data
public class FortunePayToOrderRequestVO {
private Long customerId;
private Long payId;
}
package com.yd.dal.entity.customer;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* 用户财富最终统计结果
*/
@Data
public class AclCustomerFortuneStatistic {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
/**
* 历史累积财富
*/
private BigDecimal accumulatedFortune;
/**
* 已提现财富
*/
private BigDecimal drawnFortune;
/**
* 已退保财富
*/
private BigDecimal cancelledFortune;
/**
* 注释或补充
*/
private String remark;
private Date createdAt;
private Long createdBy;
private Date updatedAt;
/**
* 变更者 id
*/
private Long updatedBy;
}
\ No newline at end of file
......@@ -26,11 +26,10 @@ public interface AgmsFortuneMapper {
/**
* 通过customerId 和 payId 查询 fortune 信息
* @param customerId customerId
* @param payId payId
* @return FortunePayToOrderInfo
*/
List<FortunePayToOrderInfo> fortunePayToOrder(@Param("customerId") Long customerId,@Param("payId") Long payId);
List<FortunePayToOrderInfo> fortunePayToOrder(@Param("payId") Long payId);
/**
* 经纪人支付列表
......
......@@ -24,4 +24,6 @@ public interface AclCustomerFortunePayMapper {
int batchInsert(@Param("list") List<AclCustomerFortunePay> list);
List<AclCustomerFortunePay> findByWithdrawIds(List<Long> withdrawIds);
List<AclCustomerFortunePay> findByIds(Long[] payIds);
}
\ No newline at end of file
package com.yd.dal.mapper.customer;
import com.yd.dal.entity.customer.AclCustomerFortuneStatistic;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface AclCustomerFortuneStatisticMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortuneStatistic record);
int insertSelective(AclCustomerFortuneStatistic record);
AclCustomerFortuneStatistic selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortuneStatistic record);
int updateByPrimaryKey(AclCustomerFortuneStatistic record);
int updateBatch(List<AclCustomerFortuneStatistic> list);
int updateBatchSelective(List<AclCustomerFortuneStatistic> list);
int batchInsert(@Param("list") List<AclCustomerFortuneStatistic> list);
List<AclCustomerFortuneStatistic> findByCustomerIds(Long[] customerIds);
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ public interface AgmsFortuneDALService {
* @param payId payId
* @return FortunePayToOrderInfo
*/
List<FortunePayToOrderInfo> fortunePayToOrder(Long customerId, Long payId);
List<FortunePayToOrderInfo> fortunePayToOrder(Long payId);
/**
* 支付列表插叙
......
......@@ -62,8 +62,8 @@ public class AgmsFortuneDALServiceImpl implements AgmsFortuneDALService {
}
@Override
public List<FortunePayToOrderInfo> fortunePayToOrder(Long customerId, Long payId) {
return agmsFortuneMapper.fortunePayToOrder(customerId,payId);
public List<FortunePayToOrderInfo> fortunePayToOrder( Long payId) {
return agmsFortuneMapper.fortunePayToOrder(payId);
}
@Override
......
......@@ -23,4 +23,11 @@ public interface AclCustomerFortunePayDALService {
void updateAll(List<AclCustomerFortunePay> pays);
Long save(AclCustomerFortunePay pay);
/**
* 批量查询
* @param payIds payIds
* @return 列表
*/
List<AclCustomerFortunePay> findByIds(Long[] payIds);
}
package com.yd.dal.service.customer;
import com.yd.dal.entity.customer.AclCustomerFortuneStatistic;
import java.util.List;
/**
* @author xxy
*/
public interface AclCustomerFortuneStatisticDALService {
/**
* 通过customerIds查询静态表
* @param customerIds customerIds
* @return 列表
*/
List<AclCustomerFortuneStatistic> findByCustomerIds(Long[] customerIds);
void updateAll(List<AclCustomerFortuneStatistic> customerFortuneStatistics);
}
......@@ -31,4 +31,9 @@ public class AclCustomerFortunePayDALServiceImpl implements AclCustomerFortunePa
public Long save(AclCustomerFortunePay pay) {
return (long)customerFortunePayMapper.insert(pay);
}
@Override
public List<AclCustomerFortunePay> findByIds(Long[] payIds) {
return customerFortunePayMapper.findByIds(payIds);
}
}
package com.yd.dal.service.customer.impl;
import com.yd.dal.entity.customer.AclCustomerFortuneStatistic;
import com.yd.dal.mapper.customer.AclCustomerFortuneStatisticMapper;
import com.yd.dal.service.customer.AclCustomerFortuneStatisticDALService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author xxy
*/
@Service("aclCustomerFortuneStatisticDALService")
public class AclCustomerFortuneStatisticDALServiceImpl implements AclCustomerFortuneStatisticDALService {
@Autowired
private AclCustomerFortuneStatisticMapper customerFortuneStatisticMapper;
@Override
public List<AclCustomerFortuneStatistic> findByCustomerIds(Long[] customerIds) {
return customerFortuneStatisticMapper.findByCustomerIds(customerIds);
}
@Override
public void updateAll(List<AclCustomerFortuneStatistic> customerFortuneStatistics) {
customerFortuneStatisticMapper.updateBatch(customerFortuneStatistics);
}
}
......@@ -35,4 +35,5 @@
830019=已申请过专家支持!请等待
830020=活动时间段冲突
830021=请选择发佣日期
830022=请选择关账记录
900003=保险公司响应报文为空!
\ No newline at end of file
......@@ -104,7 +104,6 @@
on o.id = f.order_id
where (o.status = 3 or o.status = 4)
and f.order_price != 0
and f.customer_id = #{customerId,jdbcType=BIGINT}
and f.fortune_payed_id = #{payId,jdbcType=BIGINT}
</select>
......
......@@ -13,10 +13,10 @@
<result column="campaign_name" jdbcType="VARCHAR" property="campaignName" />
<result column="campaing_reward" jdbcType="DECIMAL" property="campaingReward" />
<result column="pay_to" jdbcType="VARCHAR" property="payTo" />
<result column="pay_to_mobile" jdbcType="VARCHAR" property="payToMobile" />
<result column="pay_to_mobile" jdbcType="VARCHAR" property="payToMobile" typeHandler="com.yd.util.deshandler.DESTypeHandler"/>
<result column="pay_to_wechat" jdbcType="VARCHAR" property="payToWechat" />
<result column="pay_to_id_type_id" jdbcType="BIGINT" property="payToIdTypeId" />
<result column="pay_to_id_no" jdbcType="VARCHAR" property="payToIdNo" />
<result column="pay_to_id_no" jdbcType="VARCHAR" property="payToIdNo" typeHandler="com.yd.util.deshandler.DESTypeHandler"/>
<result column="pay_to_birthday" jdbcType="DATE" property="payToBirthday" />
<result column="pay_to_gender" jdbcType="INTEGER" property="payToGender" />
<result column="pay_date" jdbcType="TIMESTAMP" property="payDate" />
......@@ -63,8 +63,8 @@
updated_by)
values (#{withdrawId,jdbcType=BIGINT}, #{withdrawAmount,jdbcType=DECIMAL}, #{customerId,jdbcType=BIGINT},
#{customerName,jdbcType=VARCHAR}, #{campaignId,jdbcType=BIGINT}, #{campaignName,jdbcType=VARCHAR},
#{campaingReward,jdbcType=DECIMAL}, #{payTo,jdbcType=VARCHAR}, #{payToMobile,jdbcType=VARCHAR},
#{payToWechat,jdbcType=VARCHAR}, #{payToIdTypeId,jdbcType=BIGINT}, #{payToIdNo,jdbcType=VARCHAR},
#{campaingReward,jdbcType=DECIMAL}, #{payTo,jdbcType=VARCHAR}, #{payToMobile,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
#{payToWechat,jdbcType=VARCHAR}, #{payToIdTypeId,jdbcType=BIGINT}, #{payToIdNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
#{payToBirthday,jdbcType=DATE}, #{payToGender,jdbcType=INTEGER}, #{payDate,jdbcType=TIMESTAMP},
#{payAmount,jdbcType=DECIMAL}, #{taxAmount,jdbcType=DECIMAL}, #{paidBy,jdbcType=VARCHAR},
#{paidMethod,jdbcType=INTEGER}, #{payStatus,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR},
......@@ -177,7 +177,7 @@
#{payTo,jdbcType=VARCHAR},
</if>
<if test="payToMobile != null">
#{payToMobile,jdbcType=VARCHAR},
#{payToMobile,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
</if>
<if test="payToWechat != null">
#{payToWechat,jdbcType=VARCHAR},
......@@ -186,7 +186,7 @@
#{payToIdTypeId,jdbcType=BIGINT},
</if>
<if test="payToIdNo != null">
#{payToIdNo,jdbcType=VARCHAR},
#{payToIdNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
</if>
<if test="payToBirthday != null">
#{payToBirthday,jdbcType=DATE},
......@@ -258,7 +258,7 @@
pay_to = #{payTo,jdbcType=VARCHAR},
</if>
<if test="payToMobile != null">
pay_to_mobile = #{payToMobile,jdbcType=VARCHAR},
pay_to_mobile = #{payToMobile,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
</if>
<if test="payToWechat != null">
pay_to_wechat = #{payToWechat,jdbcType=VARCHAR},
......@@ -267,7 +267,7 @@
pay_to_id_type_id = #{payToIdTypeId,jdbcType=BIGINT},
</if>
<if test="payToIdNo != null">
pay_to_id_no = #{payToIdNo,jdbcType=VARCHAR},
pay_to_id_no = #{payToIdNo,jdbcType=VARCHAR,typeHandler=com.yd.util.deshandler.DESTypeHandler},
</if>
<if test="payToBirthday != null">
pay_to_birthday = #{payToBirthday,jdbcType=DATE},
......@@ -692,4 +692,14 @@
#{item}
</foreach>
</select>
<select id="findByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_pay
where id in
<foreach collection="array" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yd.dal.mapper.customer.AclCustomerFortuneStatisticMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerFortuneStatistic">
<!--@mbg.generated-->
<!--@Table ag_acl_customer_fortune_statistic-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="customer_id" jdbcType="BIGINT" property="customerId" />
<result column="accumulated_fortune" jdbcType="DECIMAL" property="accumulatedFortune" />
<result column="drawn_fortune" jdbcType="DECIMAL" property="drawnFortune" />
<result column="cancelled_fortune" jdbcType="DECIMAL" property="cancelledFortune" />
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, customer_id, accumulated_fortune, drawn_fortune, cancelled_fortune, remark, created_at,
created_by, updated_at, updated_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_statistic
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from ag_acl_customer_fortune_statistic
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneStatistic" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_statistic (customer_id, accumulated_fortune, drawn_fortune,
cancelled_fortune, remark, created_at,
created_by, updated_at, updated_by
)
values (#{customerId,jdbcType=BIGINT}, #{accumulatedFortune,jdbcType=DECIMAL}, #{drawnFortune,jdbcType=DECIMAL},
#{cancelledFortune,jdbcType=DECIMAL}, #{remark,jdbcType=LONGVARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
#{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneStatistic" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_statistic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">
customer_id,
</if>
<if test="accumulatedFortune != null">
accumulated_fortune,
</if>
<if test="drawnFortune != null">
drawn_fortune,
</if>
<if test="cancelledFortune != null">
cancelled_fortune,
</if>
<if test="remark != null">
remark,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="updatedAt != null">
updated_at,
</if>
<if test="updatedBy != null">
updated_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">
#{customerId,jdbcType=BIGINT},
</if>
<if test="accumulatedFortune != null">
#{accumulatedFortune,jdbcType=DECIMAL},
</if>
<if test="drawnFortune != null">
#{drawnFortune,jdbcType=DECIMAL},
</if>
<if test="cancelledFortune != null">
#{cancelledFortune,jdbcType=DECIMAL},
</if>
<if test="remark != null">
#{remark,jdbcType=LONGVARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
#{updatedBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneStatistic">
<!--@mbg.generated-->
update ag_acl_customer_fortune_statistic
<set>
<if test="customerId != null">
customer_id = #{customerId,jdbcType=BIGINT},
</if>
<if test="accumulatedFortune != null">
accumulated_fortune = #{accumulatedFortune,jdbcType=DECIMAL},
</if>
<if test="drawnFortune != null">
drawn_fortune = #{drawnFortune,jdbcType=DECIMAL},
</if>
<if test="cancelledFortune != null">
cancelled_fortune = #{cancelledFortune,jdbcType=DECIMAL},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
<if test="updatedAt != null">
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedBy != null">
updated_by = #{updatedBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclCustomerFortuneStatistic">
<!--@mbg.generated-->
update ag_acl_customer_fortune_statistic
set customer_id = #{customerId,jdbcType=BIGINT},
accumulated_fortune = #{accumulatedFortune,jdbcType=DECIMAL},
drawn_fortune = #{drawnFortune,jdbcType=DECIMAL},
cancelled_fortune = #{cancelledFortune,jdbcType=DECIMAL},
remark = #{remark,jdbcType=LONGVARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_statistic
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="accumulated_fortune = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.accumulatedFortune,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="drawn_fortune = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.drawnFortune,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="cancelled_fortune = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.cancelledFortune,jdbcType=DECIMAL}
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.remark,jdbcType=LONGVARCHAR}
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
</foreach>
</trim>
<trim prefix="updated_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<update id="updateBatchSelective" parameterType="java.util.List">
<!--@mbg.generated-->
update ag_acl_customer_fortune_statistic
<trim prefix="set" suffixOverrides=",">
<trim prefix="customer_id = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.customerId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.customerId,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="accumulated_fortune = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.accumulatedFortune != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.accumulatedFortune,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="drawn_fortune = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.drawnFortune != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.drawnFortune,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="cancelled_fortune = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.cancelledFortune != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.cancelledFortune,jdbcType=DECIMAL}
</if>
</foreach>
</trim>
<trim prefix="remark = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.remark != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.remark,jdbcType=LONGVARCHAR}
</if>
</foreach>
</trim>
<trim prefix="created_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="created_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.createdBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
<trim prefix="updated_at = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updatedAt != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
</if>
</foreach>
</trim>
<trim prefix="updated_by = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.updatedBy != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=BIGINT}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ag_acl_customer_fortune_statistic
(customer_id, accumulated_fortune, drawn_fortune, cancelled_fortune, remark, created_at,
created_by, updated_at, updated_by)
values
<foreach collection="list" item="item" separator=",">
(#{item.customerId,jdbcType=BIGINT}, #{item.accumulatedFortune,jdbcType=DECIMAL},
#{item.drawnFortune,jdbcType=DECIMAL}, #{item.cancelledFortune,jdbcType=DECIMAL},
#{item.remark,jdbcType=LONGVARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.createdBy,jdbcType=BIGINT},
#{item.updatedAt,jdbcType=TIMESTAMP}, #{item.updatedBy,jdbcType=BIGINT})
</foreach>
</insert>
<select id="findByCustomerIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_statistic
where customer_id in
<foreach collection="array" item="item" open="(" separator="," close=")">
#{item,jdbcType=BIGINT}
</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