Commit 74bca627 by yao.xiao

解决冲突

parent 9d6ad47e
...@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;
@Controller @Controller
@RestController @RestController
......
...@@ -12,11 +12,9 @@ import com.yd.dal.entity.user.AclUser; ...@@ -12,11 +12,9 @@ import com.yd.dal.entity.user.AclUser;
import com.yd.dal.entity.order.PoOrder; import com.yd.dal.entity.order.PoOrder;
import com.yd.dal.entity.product.Product; import com.yd.dal.entity.product.Product;
import com.yd.dal.entity.product.ProductPlan; 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.agms.AgmsFortuneDALService;
import com.yd.dal.service.customer.*; import com.yd.dal.service.customer.*;
import com.yd.dal.service.user.AclUserDALService; 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.order.PoOrderDALService;
import com.yd.dal.service.product.ProductDALService; import com.yd.dal.service.product.ProductDALService;
import com.yd.dal.service.product.ProductPlanDALService; import com.yd.dal.service.product.ProductPlanDALService;
...@@ -31,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -31,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
...@@ -91,8 +88,6 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -91,8 +88,6 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
@Autowired @Autowired
private PoOrderDALService poOrderDALService; private PoOrderDALService poOrderDALService;
@Autowired @Autowired
private AclCustomerFortuneStatisticService aclCustomerFortuneStatisticService;
@Autowired
private ProductDALService productDALService; private ProductDALService productDALService;
@Autowired @Autowired
private ProductPlanDALService productPlanDALService; private ProductPlanDALService productPlanDALService;
...@@ -130,7 +125,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -130,7 +125,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
private CommonResult check(CommissionPayoutStatusUpdateRequestVO requestVO) { private CommonResult check(CommissionPayoutStatusUpdateRequestVO requestVO) {
CommonResult commonResult = new CommonResult(); CommonResult commonResult = new CommonResult();
Boolean success = true; boolean success = true;
String message = ZHBErrorConfig.getErrorInfo("800000"); String message = ZHBErrorConfig.getErrorInfo("800000");
if (("2").equals(requestVO.getPaymentStatus())){ if (("2").equals(requestVO.getPaymentStatus())){
if (CommonUtil.isNullOrBlank(requestVO.getPayoutBatch())){ if (CommonUtil.isNullOrBlank(requestVO.getPayoutBatch())){
...@@ -570,6 +565,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -570,6 +565,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
} }
@Override @Override
@SuppressWarnings("unchecked")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public FortunePayResponseVO fortunePay(FortunePayRequestVO requestVO) { public FortunePayResponseVO fortunePay(FortunePayRequestVO requestVO) {
FortunePayResponseVO responseVO = new FortunePayResponseVO(); FortunePayResponseVO responseVO = new FortunePayResponseVO();
...@@ -635,7 +631,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -635,7 +631,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
private CommonResult check(FortunePayRequestVO requestVO) { private CommonResult check(FortunePayRequestVO requestVO) {
CommonResult commonResult = new CommonResult(); CommonResult commonResult = new CommonResult();
Boolean success = true; boolean success = true;
String message = ZHBErrorConfig.getErrorInfo("800000"); String message = ZHBErrorConfig.getErrorInfo("800000");
Long[] payIds = requestVO.getPayIds(); Long[] payIds = requestVO.getPayIds();
if (payIds == null || payIds.length == 0){ if (payIds == null || payIds.length == 0){
...@@ -669,16 +665,15 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -669,16 +665,15 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
List<AclCustomerFortune> fortunes = agmsFortuneDalService.findByOrderId(orderId); List<AclCustomerFortune> fortunes = agmsFortuneDalService.findByOrderId(orderId);
for (AclCustomerFortune fortune : fortunes){ for (AclCustomerFortune fortune : fortunes){
//查询财富对应的customer的statistic //查询财富对应的customer的statistic
AclCustomerFortuneStatistic statistic = aclCustomerFortuneStatisticService.findByCustomerId(fortune.getCustomerId()); AclCustomerFortuneStatistic statistic = customerFortuneStatisticDalService.findByCustomerId(fortune.getCustomerId());
Double cancelledFortune = statistic.getCancelledFortune(); BigDecimal cancelledFortune = statistic.getCancelledFortune();
if (CommonUtil.isNullOrZero(cancelledFortune)){ if (CommonUtil.isNullOrZero(cancelledFortune)){
cancelledFortune = 0.0; cancelledFortune = BigDecimal.ZERO;
} }
cancelledFortune = BigDecimal.valueOf(cancelledFortune) cancelledFortune = cancelledFortune
.add(fortune.getReferralAmount()) .add(fortune.getReferralAmount());
.doubleValue();
statistic.setCancelledFortune(cancelledFortune); statistic.setCancelledFortune(cancelledFortune);
aclCustomerFortuneStatisticService.update(statistic); customerFortuneStatisticDalService.update(statistic);
//生成对应的负向记录 (commission_amount/fyc_amount/referral_amount) //生成对应的负向记录 (commission_amount/fyc_amount/referral_amount)
AclCustomerFortune fortuneNew = new AclCustomerFortune(); AclCustomerFortune fortuneNew = new AclCustomerFortune();
...@@ -696,7 +691,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -696,7 +691,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
fortuneNew.setWithdrawedId(null); fortuneNew.setWithdrawedId(null);
fortuneNew.setFortunePayedId(null); fortuneNew.setFortunePayedId(null);
fortuneNew.setId(null); fortuneNew.setId(null);
agmsFortuneDalService.save(fortuneNew); customerFortuneDalService.save(fortuneNew);
} }
//发送邮件 //发送邮件
......
package com.yd.dal.entity.agms.fortune;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* ag_acl_customer_fortune_statistic
* @author
*/
public class AclCustomerFortuneStatistic implements Serializable {
/**
* serial id
*/
private Long id;
/**
* FK ag_acl_customer.id
*/
private Long customerId;
/**
* 历史累积财富
*/
private Double accumulatedFortune;
/**
* 已提现财富
*/
private Double drawnFortune;
/**
* 已退保财富
*/
private Double cancelledFortune;
private Date createdAt;
private Long createdBy;
private Date updatedAt;
/**
* 变更者 id
*/
private Long updatedBy;
/**
* 注释或补充
*/
private String remark;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getCustomerId() {
return customerId;
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public Double getAccumulatedFortune() {
return accumulatedFortune;
}
public void setAccumulatedFortune(Double accumulatedFortune) {
this.accumulatedFortune = accumulatedFortune;
}
public Double getDrawnFortune() {
return drawnFortune;
}
public void setDrawnFortune(Double drawnFortune) {
this.drawnFortune = drawnFortune;
}
public Double getCancelledFortune() {
return cancelledFortune;
}
public void setCancelledFortune(Double cancelledFortune) {
this.cancelledFortune = cancelledFortune;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Long getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Long createdBy) {
this.createdBy = createdBy;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Long getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(Long updatedBy) {
this.updatedBy = updatedBy;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
AclCustomerFortuneStatistic other = (AclCustomerFortuneStatistic) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
&& (this.getAccumulatedFortune() == null ? other.getAccumulatedFortune() == null : this.getAccumulatedFortune().equals(other.getAccumulatedFortune()))
&& (this.getDrawnFortune() == null ? other.getDrawnFortune() == null : this.getDrawnFortune().equals(other.getDrawnFortune()))
&& (this.getCancelledFortune() == null ? other.getCancelledFortune() == null : this.getCancelledFortune().equals(other.getCancelledFortune()))
&& (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
&& (this.getCreatedBy() == null ? other.getCreatedBy() == null : this.getCreatedBy().equals(other.getCreatedBy()))
&& (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()))
&& (this.getUpdatedBy() == null ? other.getUpdatedBy() == null : this.getUpdatedBy().equals(other.getUpdatedBy()))
&& (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
result = prime * result + ((getAccumulatedFortune() == null) ? 0 : getAccumulatedFortune().hashCode());
result = prime * result + ((getDrawnFortune() == null) ? 0 : getDrawnFortune().hashCode());
result = prime * result + ((getCancelledFortune() == null) ? 0 : getCancelledFortune().hashCode());
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
result = prime * result + ((getCreatedBy() == null) ? 0 : getCreatedBy().hashCode());
result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
result = prime * result + ((getUpdatedBy() == null) ? 0 : getUpdatedBy().hashCode());
result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", customerId=").append(customerId);
sb.append(", accumulatedFortune=").append(accumulatedFortune);
sb.append(", drawnFortune=").append(drawnFortune);
sb.append(", cancelledFortune=").append(cancelledFortune);
sb.append(", createdAt=").append(createdAt);
sb.append(", createdBy=").append(createdBy);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", updatedBy=").append(updatedBy);
sb.append(", remark=").append(remark);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.yd.dal.mapper.agms;
import com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic;
public interface AclCustomerFortuneStatisticMapper {
int deleteByPrimaryKey(Long id);
int insert(AclCustomerFortuneStatistic record);
int insertSelective(AclCustomerFortuneStatistic record);
AclCustomerFortuneStatistic selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(AclCustomerFortuneStatistic record);
int updateByPrimaryKeyWithBLOBs(AclCustomerFortuneStatistic record);
int updateByPrimaryKey(AclCustomerFortuneStatistic record);
AclCustomerFortuneStatistic findByCustomerId(Long customerId);
}
\ No newline at end of file
...@@ -42,6 +42,4 @@ public interface AgmsFortuneMapper { ...@@ -42,6 +42,4 @@ public interface AgmsFortuneMapper {
List<AclCustomerFortune> findByOrderId(@Param("orderId")Long orderId); List<AclCustomerFortune> findByOrderId(@Param("orderId")Long orderId);
void save(AclCustomerFortune fortune);
} }
...@@ -24,4 +24,6 @@ public interface AclCustomerFortuneStatisticMapper { ...@@ -24,4 +24,6 @@ public interface AclCustomerFortuneStatisticMapper {
int batchInsert(@Param("list") List<AclCustomerFortuneStatistic> list); int batchInsert(@Param("list") List<AclCustomerFortuneStatistic> list);
List<AclCustomerFortuneStatistic> findByCustomerIds(Long[] customerIds); List<AclCustomerFortuneStatistic> findByCustomerIds(Long[] customerIds);
AclCustomerFortuneStatistic findByCustomerId(Long customerId);
} }
\ No newline at end of file
package com.yd.dal.service.agms;
import com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic;
public interface AclCustomerFortuneStatisticService {
AclCustomerFortuneStatistic findByCustomerId(Long customerId);
void update(AclCustomerFortuneStatistic statistic);
}
\ No newline at end of file
...@@ -47,6 +47,4 @@ public interface AgmsFortuneDALService { ...@@ -47,6 +47,4 @@ public interface AgmsFortuneDALService {
*/ */
List<WithdrawLabelInfo> transformForWithdrawLabel(WithdrawQueryInfo info); List<WithdrawLabelInfo> transformForWithdrawLabel(WithdrawQueryInfo info);
void save(AclCustomerFortune fortune);
} }
package com.yd.dal.service.agms.impl;
import com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic;
import com.yd.dal.mapper.agms.AclCustomerFortuneStatisticMapper;
import com.yd.dal.service.agms.AclCustomerFortuneStatisticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("aclCustomerFortuneStatisticService")
public class AclCustomerFortuneStatisticServiceImpl implements AclCustomerFortuneStatisticService {
@Autowired
private AclCustomerFortuneStatisticMapper aclCustomerFortuneStatisticMapper;
@Override
public AclCustomerFortuneStatistic findByCustomerId(Long customerId) {
return aclCustomerFortuneStatisticMapper.findByCustomerId(customerId);
}
@Override
public void update(AclCustomerFortuneStatistic statistic) {
aclCustomerFortuneStatisticMapper.updateByPrimaryKeySelective(statistic);
}
}
\ No newline at end of file
...@@ -71,8 +71,4 @@ public class AgmsFortuneDALServiceImpl implements AgmsFortuneDALService { ...@@ -71,8 +71,4 @@ public class AgmsFortuneDALServiceImpl implements AgmsFortuneDALService {
return agmsFortuneMapper.transformForWithdrawLabel(info); return agmsFortuneMapper.transformForWithdrawLabel(info);
} }
@Override
public void save(AclCustomerFortune fortune) {
agmsFortuneMapper.save(fortune);
}
} }
...@@ -20,4 +20,5 @@ public interface AclCustomerFortuneDALService { ...@@ -20,4 +20,5 @@ public interface AclCustomerFortuneDALService {
List<AclCustomerFortune> findByWithdrawIds(List<Long> withdrawUpdateIds); List<AclCustomerFortune> findByWithdrawIds(List<Long> withdrawUpdateIds);
void save(AclCustomerFortune fortuneNew);
} }
...@@ -16,4 +16,8 @@ public interface AclCustomerFortuneStatisticDALService { ...@@ -16,4 +16,8 @@ public interface AclCustomerFortuneStatisticDALService {
List<AclCustomerFortuneStatistic> findByCustomerIds(Long[] customerIds); List<AclCustomerFortuneStatistic> findByCustomerIds(Long[] customerIds);
void updateAll(List<AclCustomerFortuneStatistic> customerFortuneStatistics); void updateAll(List<AclCustomerFortuneStatistic> customerFortuneStatistics);
AclCustomerFortuneStatistic findByCustomerId(Long customerId);
void update(AclCustomerFortuneStatistic statistic);
} }
...@@ -34,4 +34,9 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe ...@@ -34,4 +34,9 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe
public List<AclCustomerFortune> findByWithdrawIds(List<Long> withdrawUpdateIds) { public List<AclCustomerFortune> findByWithdrawIds(List<Long> withdrawUpdateIds) {
return aclCustomerFortuneMapper.findByWithdrawIds(withdrawUpdateIds); return aclCustomerFortuneMapper.findByWithdrawIds(withdrawUpdateIds);
} }
@Override
public void save(AclCustomerFortune fortuneNew) {
aclCustomerFortuneMapper.insert(fortuneNew);
}
} }
...@@ -26,4 +26,14 @@ public class AclCustomerFortuneStatisticDALServiceImpl implements AclCustomerFor ...@@ -26,4 +26,14 @@ public class AclCustomerFortuneStatisticDALServiceImpl implements AclCustomerFor
public void updateAll(List<AclCustomerFortuneStatistic> customerFortuneStatistics) { public void updateAll(List<AclCustomerFortuneStatistic> customerFortuneStatistics) {
customerFortuneStatisticMapper.updateBatch(customerFortuneStatistics); customerFortuneStatisticMapper.updateBatch(customerFortuneStatistics);
} }
@Override
public AclCustomerFortuneStatistic findByCustomerId(Long customerId) {
return customerFortuneStatisticMapper.findByCustomerId(customerId);
}
@Override
public void update(AclCustomerFortuneStatistic statistic) {
customerFortuneStatisticMapper.updateByPrimaryKeySelective(statistic);
}
} }
<?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.agms.AclCustomerFortuneStatisticMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic">
<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="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>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic">
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
</resultMap>
<sql id="Base_Column_List">
id, customer_id, accumulated_fortune, drawn_fortune, cancelled_fortune, created_at,
created_by, updated_at, updated_by
</sql>
<sql id="Blob_Column_List">
remark
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from ag_acl_customer_fortune_statistic
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
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.agms.fortune.AclCustomerFortuneStatistic" useGeneratedKeys="true">
insert into ag_acl_customer_fortune_statistic (customer_id, accumulated_fortune, drawn_fortune,
cancelled_fortune, created_at, created_by,
updated_at, updated_by, remark
)
values (#{customerId,jdbcType=BIGINT}, #{accumulatedFortune,jdbcType=DECIMAL}, #{drawnFortune,jdbcType=DECIMAL},
#{cancelledFortune,jdbcType=DECIMAL}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
#{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}, #{remark,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic" useGeneratedKeys="true">
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="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>
<if test="remark != null">
remark,
</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="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>
<if test="remark != null">
#{remark,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic">
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="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>
<if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic">
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},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
updated_by = #{updatedBy,jdbcType=BIGINT},
remark = #{remark,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic">
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},
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>
<select id="findByCustomerId" resultMap="ResultMapWithBLOBs">
select * from ag_acl_customer_fortune_statistic
where customer_id = #{customerId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<mapper namespace="com.yd.dal.mapper.agms.AgmsDashboardMapper"> <mapper namespace="com.yd.dal.mapper.agms.AgmsDashboardMapper">
<select id="statisticsPEP" resultType="com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo"> <select id="statisticsPEP" resultType="com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo">
select if(b.branch_name is null,'暂无公司',b.branch_name) branchName, select if(b.branch_name is null,'暂无公司',b.branch_name) branchName,
if(p.insurer_branch_id is null,0,p.insurer_branch_id) branchId, if(p.insurer_branch_id is null,0,p.insurer_branch_id) branchId,
if(s.name is null ,'暂无团队',s.name) subordinateName, if(s.name is null ,'暂无团队',s.name) subordinateName,
if(p.subordinate_system_id is null ,0,p.subordinate_system_id) subordinateId, if(p.subordinate_system_id is null ,0,p.subordinate_system_id) subordinateId,
...@@ -36,10 +36,10 @@ select if(b.branch_name is null,'暂无公司',b.branch_name) branchName, ...@@ -36,10 +36,10 @@ select if(b.branch_name is null,'暂无公司',b.branch_name) branchName,
</when> </when>
</choose> </choose>
order by scoreDay desc ,scoreWeek desc ,scoreMonth desc; order by scoreDay desc ,scoreWeek desc ,scoreMonth desc;
</select> </select>
<select id="statisticsOpportunity" resultType="com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo"> <select id="statisticsOpportunity" resultType="com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo">
select if(b.branch_name is null,'暂无公司',b.branch_name) branchName, select if(b.branch_name is null,'暂无公司',b.branch_name) branchName,
if(s.name is null ,'暂无团队',s.name) subordinateName, if(s.name is null ,'暂无团队',s.name) subordinateName,
<choose> <choose>
<when test="time.equalsIgnoreCase('D')"> <when test="time.equalsIgnoreCase('D')">
...@@ -73,12 +73,12 @@ select if(b.branch_name is null,'暂无公司',b.branch_name) branchName, ...@@ -73,12 +73,12 @@ select if(b.branch_name is null,'暂无公司',b.branch_name) branchName,
sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.pieces else 0 end) pieces sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.pieces else 0 end) pieces
</when> </when>
</choose> </choose>
from ag_acl_practitioner p from ag_acl_practitioner p
left join ag_mkt_leads_assigneds a on p.id = a.assigned_practitioner_id and a.is_active = 1 left join ag_mkt_leads_assigneds a on p.id = a.assigned_practitioner_id and a.is_active = 1
left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id
where where
ps.practitioner_type_id = 28 ps.practitioner_type_id = 28
and p.is_active = 1 and p.is_active = 1
and not EXISTS( and not EXISTS(
...@@ -94,11 +94,11 @@ where ...@@ -94,11 +94,11 @@ where
group by p.subordinate_system_id group by p.subordinate_system_id
</when> </when>
</choose> </choose>
order by predictFYC desc ,predictFYP desc ,pieces desc ,opportunityNum desc; order by predictFYC desc ,predictFYP desc ,pieces desc ,opportunityNum desc;
</select> </select>
<select id="getPractitionerNums" resultType="java.util.Map"> <select id="getPractitionerNums" resultType="java.util.Map">
select select
<choose> <choose>
<when test="type.equalsIgnoreCase('B')"> <when test="type.equalsIgnoreCase('B')">
if(p.insurer_branch_id is null,0,p.insurer_branch_id) id, if(p.insurer_branch_id is null,0,p.insurer_branch_id) id,
...@@ -111,9 +111,9 @@ select ...@@ -111,9 +111,9 @@ select
</otherwise> </otherwise>
</choose> </choose>
count(p.id) practitionerNum count(p.id) practitionerNum
from ag_acl_practitioner p from ag_acl_practitioner p
left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id
where ps.practitioner_type_id = 28 where ps.practitioner_type_id = 28
and p.is_active = 1 and p.is_active = 1
<choose> <choose>
<when test="type.equalsIgnoreCase('B')"> <when test="type.equalsIgnoreCase('B')">
...@@ -123,7 +123,7 @@ where ps.practitioner_type_id = 28 ...@@ -123,7 +123,7 @@ where ps.practitioner_type_id = 28
group by p.subordinate_system_id group by p.subordinate_system_id
</when> </when>
</choose> </choose>
</select> </select>
<select id="statisticsSalesYD" resultType="com.yd.api.agms.vo.dashboard.StatisticsSalesInfo"> <select id="statisticsSalesYD" resultType="com.yd.api.agms.vo.dashboard.StatisticsSalesInfo">
select select
......
...@@ -186,29 +186,4 @@ ...@@ -186,29 +186,4 @@
where f.order_id = #{orderId} where f.order_id = #{orderId}
</select> </select>
<insert id="save" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.agms.fortune.AclCustomerFortuneStatistic" useGeneratedKeys="true">
insert into ag_acl_customer_fortune (share_id, customer_id, order_id,
order_date, order_price, commission_rate,
commission_amount, fyc_rate, fyc_amount,
grade_commission_rate, share_rate, referral_rate,
referral_amount, month_period, commission_type,
drop_option_code, practitioner_level, is_tax,
tax_amount, net_amount, campaign_id,
campaign_name, withdrawable_date, payout_batch_id,
commission_payout_status, commission_payout_at,
commission_payout_by, withdrawed_id, fortune_payed_id,
created_at, created_by)
values (#{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT},
#{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL}, #{commissionRate,jdbcType=DECIMAL},
#{commissionAmount,jdbcType=DECIMAL}, #{fycRate,jdbcType=DECIMAL}, #{fycAmount,jdbcType=DECIMAL},
#{gradeCommissionRate,jdbcType=DECIMAL}, #{shareRate,jdbcType=DECIMAL}, #{referralRate,jdbcType=DECIMAL},
#{referralAmount,jdbcType=DECIMAL}, #{monthPeriod,jdbcType=VARCHAR}, #{commissionType,jdbcType=VARCHAR},
#{dropOptionCode,jdbcType=VARCHAR}, #{practitionerLevel,jdbcType=VARCHAR}, #{isTax,jdbcType=INTEGER},
#{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL}, #{campaignId,jdbcType=BIGINT},
#{campaignName,jdbcType=VARCHAR}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{payoutBatchId,jdbcType=BIGINT},
#{commissionPayoutStatus,jdbcType=VARCHAR}, #{commissionPayoutAt,jdbcType=TIMESTAMP},
#{commissionPayoutBy,jdbcType=BIGINT}, #{withdrawedId,jdbcType=BIGINT}, #{fortunePayedId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT})
</insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -304,4 +304,11 @@ ...@@ -304,4 +304,11 @@
#{item,jdbcType=BIGINT} #{item,jdbcType=BIGINT}
</foreach> </foreach>
</select> </select>
<select id="findByCustomerId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_customer_fortune_statistic
where customer_id = #{customerId,jdbcType=BIGINT}
</select>
</mapper> </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