Commit 51d92659 by yao.xiao

增加-经纪人商机目标设置

parent a69ffa0b
......@@ -9,8 +9,7 @@ import com.yd.api.practitioner.vo.opportunity.*;
import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveRequestVO;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveResponseVO;
import com.yd.api.practitioner.vo.salestarget.*;
import com.yd.api.practitioner.vo.setting.*;
import com.yd.api.result.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -233,4 +232,28 @@ public class PractitionerController {
result.setData(responseVO);
return result;
}
/**
* 查询销售目标
*/
@RequestMapping("/salesTargetQuery")
public Object salesTargetQuery(@RequestBody SalesTargetQueryRequestVO requestVO){
JsonResult result = new JsonResult();
SalesTargetQueryResponseVO responseVO = practitionerService.salesTargetQuery(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
/**
* 保存月均目标
*/
@RequestMapping("/salesTargetMonthSave")
public Object salesTargetMonthSave(@RequestBody SalesTargetMonthSaveRequestVO requestVO){
JsonResult result = new JsonResult();
SalesTargetMonthSaveResponseVO responseVO = practitionerService.salesTargetMonthSave(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
}
......@@ -8,8 +8,7 @@ import com.yd.api.practitioner.vo.opportunity.*;
import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveRequestVO;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveResponseVO;
import com.yd.api.practitioner.vo.salestarget.*;
import com.yd.api.practitioner.vo.setting.*;
import org.springframework.stereotype.Service;
......@@ -125,4 +124,18 @@ public interface PractitionerService {
* @return
*/
SalesTargetSaveResponseVO salesTargetSave(SalesTargetSaveRequestVO requestVO);
/**
* 查询销售目标
* @param requestVO
* @return
*/
SalesTargetQueryResponseVO salesTargetQuery(SalesTargetQueryRequestVO requestVO);
/**
* 保存月均目标
* @param requestVO
* @return
*/
SalesTargetMonthSaveResponseVO salesTargetMonthSave(SalesTargetMonthSaveRequestVO requestVO);
}
......@@ -15,10 +15,7 @@ import com.yd.api.practitioner.vo.rank.PractitionerRankRequestVO;
import com.yd.api.practitioner.vo.rank.PractitionerRankResponseVO;
import com.yd.api.practitioner.vo.rank.PractitionerInfoForAchievement;
import com.yd.api.practitioner.vo.recruit.*;
import com.yd.api.practitioner.vo.salestarget.SalesTargetActions;
import com.yd.api.practitioner.vo.salestarget.SalesTargetMonth;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveRequestVO;
import com.yd.api.practitioner.vo.salestarget.SalesTargetSaveResponseVO;
import com.yd.api.practitioner.vo.salestarget.*;
import com.yd.api.practitioner.vo.setting.*;
import com.yd.api.result.CommonResult;
import com.yd.dal.entity.customer.*;
......@@ -1383,6 +1380,93 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
return responseVO;
}
@Override
public SalesTargetQueryResponseVO salesTargetQuery(SalesTargetQueryRequestVO requestVO) {
SalesTargetQueryResponseVO responseVO = new SalesTargetQueryResponseVO();
//经纪人id
Long practitionerId = requestVO.getPractitionerId();
//当前年份
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
//通过is_active = 1 经纪人id 和 目标所属年度 去查询ag_mkt_leads_goals/ag_mkt_leads_goals_actions
MktLeadsGoals mktLeadsGoals = new MktLeadsGoals();
mktLeadsGoals.setIsActive(1);
mktLeadsGoals.setPractitionerId(practitionerId);
mktLeadsGoals.setCurrentYear(year);
List<MktLeadsGoals> mktLeadsGoalsList = mktLeadsGoalsDALService.findByMktLeadsGoals(mktLeadsGoals);
List<SalesTargetMonth> salesTargetMonthList = new ArrayList<>();
for (MktLeadsGoals info :mktLeadsGoalsList){
Integer statisticTimeUnit = info.getStatisticTimeUnit();
if (statisticTimeUnit==1){//年
responseVO.setPremium(info.getPremium());
responseVO.setCommission(info.getCommission());
responseVO.setPieces(info.getPieces());
responseVO.setPieceAveragePremium(info.getPieceAveragePremium());
}else if (statisticTimeUnit==3){//月
SalesTargetMonth salesTargetMonth = new SalesTargetMonth();
salesTargetMonth.setCommission(info.getCommission());
salesTargetMonth.setMonthNum(info.getSeqTime());
salesTargetMonth.setPieceAveragePremium(info.getPieceAveragePremium());
salesTargetMonth.setPieces(info.getPieces());
salesTargetMonth.setPremium(info.getPremium());
salesTargetMonthList.add(salesTargetMonth);
}
}
MktLeadsGoalsActions mktLeadsGoalsActions = new MktLeadsGoalsActions();
mktLeadsGoalsActions.setIsActive(1);
mktLeadsGoalsActions.setPractitionerId(practitionerId);
mktLeadsGoalsActions.setCurrentYear(year);
List<MktLeadsGoalsActions> mktLeadsGoalsActionsList = mktLeadsGoalsActionsDALService.findByMktLeadsGoalsActions(mktLeadsGoalsActions);
List<SalesTargetActions> salesTargetActions = new ArrayList<>();
for (MktLeadsGoalsActions info : mktLeadsGoalsActionsList){
SalesTargetActions salesTargetAction = new SalesTargetActions();
salesTargetAction.setStatisticTimeUnit(3);
salesTargetAction.setActionStandards(info.getActionStandards());
salesTargetAction.setLeadsActionId(info.getLeadsActionId());
salesTargetAction.setLeadsActionName(info.getLeadsActionName());
salesTargetActions.add(salesTargetAction);
}
responseVO.setPractitionerId(practitionerId);
responseVO.setSalesTargetMonths(salesTargetMonthList);
responseVO.setSalesTargetActions(salesTargetActions);
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
@Override
public SalesTargetMonthSaveResponseVO salesTargetMonthSave(SalesTargetMonthSaveRequestVO requestVO) {
SalesTargetMonthSaveResponseVO responseVO = new SalesTargetMonthSaveResponseVO();
//经纪人id
Long practitionerId = requestVO.getPractitionerId();
//当前年份
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
mktLeadsGoalsActionsDALService.updateIsActiveIsNull(practitionerId,year);
List<SalesTargetActions> salesTargetActionsList = requestVO.getSalesTargetActionsList();
Date date = new Date();
MktLeadsGoalsActions mktLeadsGoalsActions;
for (SalesTargetActions info : salesTargetActionsList){
mktLeadsGoalsActions = new MktLeadsGoalsActions();
mktLeadsGoalsActions.setPractitionerId(practitionerId);
mktLeadsGoalsActions.setCurrentYear(year);
mktLeadsGoalsActions.setStatisticTimeUnit(3);
mktLeadsGoalsActions.setLeadsActionId(info.getLeadsActionId());
mktLeadsGoalsActions.setLeadsActionName(info.getLeadsActionName());
mktLeadsGoalsActions.setActionStandards(info.getActionStandards());
mktLeadsGoalsActions.setCurrentVersion(date);
mktLeadsGoalsActions.setIsActive(1);
mktLeadsGoalsActions.setCreatedAt(new Date());
mktLeadsGoalsActions.setCreatedBy(practitionerId);
mktLeadsGoalsActions.setUpdatedAt(new Date());
mktLeadsGoalsActions.setUpdatedBy(practitionerId);
mktLeadsGoalsActionsDALService.save(mktLeadsGoalsActions);
}
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
private void initializationAction(Long practitionerId, int year) {
//通过经纪人id 和 目标所属年度 去查询ag_mkt_leads_goals/ag_mkt_leads_goals_actions 并将is_active = 0
mktLeadsGoalsDALService.updateIsActiveIsNull(practitionerId,year);
......@@ -1434,7 +1518,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
*/
private void saveMonthGoal(SalesTargetMonth info, Long practitionerId, Date date,int year) {
MktLeadsGoals mktLeadsGoals = new MktLeadsGoals();
mktLeadsGoals.setPractitionerId(practitionerId.toString());
mktLeadsGoals.setPractitionerId(practitionerId);
mktLeadsGoals.setPremium(info.getPremium());
mktLeadsGoals.setCommission(info.getCommission());
mktLeadsGoals.setPieces(info.getPieces());
......@@ -1464,7 +1548,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
Integer pieces = requestVO.getPieces();
Integer pieceAveragePremium = requestVO.getPieceAveragePremium();
MktLeadsGoals mktLeadsGoals = new MktLeadsGoals();
mktLeadsGoals.setPractitionerId(practitionerId.toString());
mktLeadsGoals.setPractitionerId(practitionerId);
mktLeadsGoals.setPremium(premium);
mktLeadsGoals.setCommission(commission);
mktLeadsGoals.setPieces(pieces);
......
package com.yd.api.practitioner.vo.salestarget;
import lombok.Data;
import java.util.List;
@Data
public class SalesTargetMonthSaveRequestVO {
private Long practitionerId;
private List<SalesTargetActions> salesTargetActionsList;
}
package com.yd.api.practitioner.vo.salestarget;
import com.yd.api.result.CommonResult;
import lombok.Data;
@Data
public class SalesTargetMonthSaveResponseVO {
private Long practitionerId;
private CommonResult commonResult;
}
package com.yd.api.practitioner.vo.salestarget;
import lombok.Data;
@Data
public class SalesTargetQueryRequestVO {
private Long practitionerId;
}
package com.yd.api.practitioner.vo.salestarget;
import com.yd.api.result.CommonResult;
import lombok.Data;
import java.util.List;
@Data
public class SalesTargetQueryResponseVO {
private Long practitionerId;
private Integer premium;
private Integer commission;
private Integer pieces;
private Integer pieceAveragePremium;
private List<SalesTargetMonth> salesTargetMonths;
private List<SalesTargetActions> salesTargetActions;
private CommonResult commonResult;
}
......@@ -16,7 +16,7 @@ public class MktLeadsGoals {
/**
* FK ag_acl_practitioner.id 经纪人
*/
private String practitionerId;
private Long practitionerId;
/**
* 目标所属年度
......
......@@ -3,6 +3,8 @@ package com.yd.dal.mapper.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoalsActions;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MktLeadsGoalsActionsMapper {
int deleteByPrimaryKey(Long id);
......@@ -17,4 +19,6 @@ public interface MktLeadsGoalsActionsMapper {
int updateByPrimaryKey(MktLeadsGoalsActions record);
void updateIsActiveIsNull(@Param("practitionerId") Long practitionerId,@Param("year") Integer year);
List<MktLeadsGoalsActions> findByMktLeadsGoalsActions(MktLeadsGoalsActions mktLeadsGoalsActions);
}
\ No newline at end of file
package com.yd.dal.mapper.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import org.apache.ibatis.annotations.Param;
import com.yd.dal.entity.marketing.MktLeadsGoals;import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MktLeadsGoalsMapper {
int deleteByPrimaryKey(Long id);
......@@ -16,5 +17,7 @@ public interface MktLeadsGoalsMapper {
int updateByPrimaryKey(MktLeadsGoals record);
void updateIsActiveIsNull(@Param("practitionerId") Long practitionerId,@Param("year") Integer year);
void updateIsActiveIsNull(@Param("practitionerId") Long practitionerId, @Param("year") Integer year);
List<MktLeadsGoals> selectByMktLeadsGoals(MktLeadsGoals mktLeadsGoals);
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.yd.dal.service.marketing.MktLeadsGoalsActionsDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("mktLeadsGoalsActionsService")
public class MktLeadsGoalsActionsDALServiceImpl implements MktLeadsGoalsActionsDALService {
......@@ -22,4 +23,9 @@ public class MktLeadsGoalsActionsDALServiceImpl implements MktLeadsGoalsActionsD
public void updateIsActiveIsNull(Long practitionerId, int year) {
mktLeadsGoalsActionsMapper.updateIsActiveIsNull(practitionerId, year);
}
@Override
public List<MktLeadsGoalsActions> findByMktLeadsGoalsActions(MktLeadsGoalsActions mktLeadsGoalsActions) {
return mktLeadsGoalsActionsMapper.findByMktLeadsGoalsActions(mktLeadsGoalsActions);
}
}
......@@ -6,6 +6,7 @@ import com.yd.dal.service.marketing.MktLeadsGoalsDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("mktLeadsGoalsDALService")
public class MktLeadsGoalsDALServiceImpl implements MktLeadsGoalsDALService {
......@@ -22,4 +23,9 @@ public class MktLeadsGoalsDALServiceImpl implements MktLeadsGoalsDALService {
public void updateIsActiveIsNull(Long practitionerId, Integer year) {
mktLeadsGoalsMapper.updateIsActiveIsNull(practitionerId, year) ;
}
@Override
public List<MktLeadsGoals> findByMktLeadsGoals(MktLeadsGoals mktLeadsGoals) {
return mktLeadsGoalsMapper.selectByMktLeadsGoals(mktLeadsGoals);
}
}
......@@ -2,8 +2,12 @@ package com.yd.dal.service.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoalsActions;
import java.util.List;
public interface MktLeadsGoalsActionsDALService {
void save(MktLeadsGoalsActions mktLeadsGoalsActions);
void updateIsActiveIsNull(Long practitionerId, int year);
List<MktLeadsGoalsActions> findByMktLeadsGoalsActions(MktLeadsGoalsActions mktLeadsGoalsActions);
}
......@@ -2,8 +2,12 @@ package com.yd.dal.service.marketing;
import com.yd.dal.entity.marketing.MktLeadsGoals;
import java.util.List;
public interface MktLeadsGoalsDALService {
void saveMktLeadsGoals(MktLeadsGoals mktLeadsGoals);
void updateIsActiveIsNull(Long practitionerId, Integer year);
List<MktLeadsGoals> findByMktLeadsGoals(MktLeadsGoals mktLeadsGoals);
}
......@@ -198,4 +198,50 @@
and current_year = #{year,jdbcType=INTEGER}
and is_active =1;
</update>
<select id="findByMktLeadsGoalsActions" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_mkt_leads_goals_actions
<where>
<if test="id != null">
id = #{id,jdbcType=BIGINT}
</if>
<if test="practitionerId != null">
and practitioner_id = #{practitionerId,jdbcType=BIGINT}
</if>
<if test="currentYear != null">
and current_year = #{currentYear,jdbcType=INTEGER}
</if>
<if test="statisticTimeUnit != null">
and statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER}
</if>
<if test="leadsActionId != null">
and leads_action_id = #{leadsActionId,jdbcType=BIGINT}
</if>
<if test="leadsActionName != null">
and leads_action_name = #{leadsActionName,jdbcType=VARCHAR}
</if>
<if test="actionStandards != null">
and action_standards = #{actionStandards,jdbcType=INTEGER}
</if>
<if test="currentVersion != null">
and current_version = #{currentVersion,jdbcType=TIMESTAMP}
</if>
<if test="isActive != null">
and is_active = #{isActive,jdbcType=INTEGER}
</if>
<if test="createdAt != null">
and created_at = #{createdAt,jdbcType=TIMESTAMP}
</if>
<if test="createdBy != null">
and created_by = #{createdBy,jdbcType=BIGINT}
</if>
<if test="updatedAt != null">
and updated_at = #{updatedAt,jdbcType=TIMESTAMP}
</if>
<if test="updatedBy != null">
and updated_by = #{updatedBy,jdbcType=BIGINT}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<!--@mbg.generated-->
<!--@Table ag_mkt_leads_goals-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="practitioner_id" jdbcType="VARCHAR" property="practitionerId" />
<result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
<result column="current_year" jdbcType="INTEGER" property="currentYear" />
<result column="statistic_time_unit" jdbcType="INTEGER" property="statisticTimeUnit" />
<result column="seq_time" jdbcType="INTEGER" property="seqTime" />
......@@ -45,7 +45,7 @@
pieces, piece_average_premium, current_version,
is_active, created_at, created_by,
updated_at, updated_by)
values (#{practitionerId,jdbcType=VARCHAR}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
values (#{practitionerId,jdbcType=BIGINT}, #{currentYear,jdbcType=INTEGER}, #{statisticTimeUnit,jdbcType=INTEGER},
#{seqTime,jdbcType=INTEGER}, #{premium,jdbcType=INTEGER}, #{commission,jdbcType=INTEGER},
#{pieces,jdbcType=INTEGER}, #{pieceAveragePremium,jdbcType=INTEGER}, #{currentVersion,jdbcType=TIMESTAMP},
#{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT},
......@@ -100,7 +100,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="practitionerId != null">
#{practitionerId,jdbcType=VARCHAR},
#{practitionerId,jdbcType=BIGINT},
</if>
<if test="currentYear != null">
#{currentYear,jdbcType=INTEGER},
......@@ -148,7 +148,7 @@
update ag_mkt_leads_goals
<set>
<if test="practitionerId != null">
practitioner_id = #{practitionerId,jdbcType=VARCHAR},
practitioner_id = #{practitionerId,jdbcType=BIGINT},
</if>
<if test="currentYear != null">
current_year = #{currentYear,jdbcType=INTEGER},
......@@ -195,7 +195,7 @@
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.marketing.MktLeadsGoals">
<!--@mbg.generated-->
update ag_mkt_leads_goals
set practitioner_id = #{practitionerId,jdbcType=VARCHAR},
set practitioner_id = #{practitionerId,jdbcType=BIGINT},
current_year = #{currentYear,jdbcType=INTEGER},
statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER},
seq_time = #{seqTime,jdbcType=INTEGER},
......@@ -218,4 +218,56 @@
AND current_year = #{year,jdbcType=INTEGER}
AND is_active = 1;
</update>
<select id="selectByMktLeadsGoals" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_mkt_leads_goals
<where>
<if test="id != null">
id = #{id,jdbcType=BIGINT}
</if>
<if test="practitionerId != null">
and practitioner_id = #{practitionerId,jdbcType=BIGINT}
</if>
<if test="currentYear != null">
and current_year = #{currentYear,jdbcType=INTEGER}
</if>
<if test="statisticTimeUnit != null">
and statistic_time_unit = #{statisticTimeUnit,jdbcType=INTEGER}
</if>
<if test="seqTime != null">
and seq_time = #{seqTime,jdbcType=INTEGER}
</if>
<if test="premium != null">
and premium = #{premium,jdbcType=INTEGER}
</if>
<if test="commission != null">
and commission = #{commission,jdbcType=INTEGER}
</if>
<if test="pieces != null">
and pieces = #{pieces,jdbcType=INTEGER}
</if>
<if test="pieceAveragePremium != null">
and piece_average_premium = #{pieceAveragePremium,jdbcType=INTEGER}
</if>
<if test="currentVersion != null">
and current_version = #{currentVersion,jdbcType=TIMESTAMP}
</if>
<if test="isActive != null">
and is_active = #{isActive,jdbcType=INTEGER}
</if>
<if test="createdAt != null">
and created_at = #{createdAt,jdbcType=TIMESTAMP}
</if>
<if test="createdBy != null">
and created_by = #{createdBy,jdbcType=BIGINT}
</if>
<if test="updatedAt != null">
and updated_at = #{updatedAt,jdbcType=TIMESTAMP}
</if>
<if test="updatedBy != null">
and updated_by = #{updatedBy,jdbcType=BIGINT}
</if>
</where>
</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