Commit c8e9ee56 by yao.xiao

Merge branch 'dev' of http://139.224.139.2:9091/AGSH/yd-backend into dev

parents 13dd5f03 b8031ed1
package com.yd.api.agms;
import com.yd.api.agms.service.AgmsDashboardService;
import com.yd.api.agms.service.AgmsStatementService;
import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.agms.vo.statement.FinancialStatementRequestVO;
import com.yd.api.agms.vo.statement.FinancialStatementResponseVO;
import com.yd.api.agms.service.AgmsStatisticsService;
import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsResponseVO;
import com.yd.api.result.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -19,19 +21,19 @@ import javax.servlet.http.HttpServletResponse;
@RequestMapping("/agms")
public class AgmsController {
@Autowired
private AgmsStatementService agmsStatementService;
@Autowired
private AgmsDashboardService agmsDashboardService;
@Autowired
private AgmsStatisticsService agmsStatisticsService;
/**
* AGMS -- 财务管理报表
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping("/financialPredictStatement")
public Object financialPredictStatement(@RequestBody FinancialStatementRequestVO requestVO, HttpServletResponse response){
@RequestMapping("/financialPredictStatistics")
public Object financialPredictStatistics(@RequestBody FinancialStatisticsRequestVO requestVO, HttpServletResponse response){
JsonResult result = new JsonResult();
FinancialStatementResponseVO responseVO = agmsStatementService.financialPredictStatement(requestVO,response);
FinancialStatisticsResponseVO responseVO = agmsStatisticsService.financialPredictStatistics(requestVO,response);
result.addResult(responseVO);
result.setData(responseVO);
return result;
......@@ -78,4 +80,46 @@ public class AgmsController {
result.setData(responseVO);
return result;
}
/**
* AGMS -- Dashboard查询 销售统计查询
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping("/statisticsSales")
public Object statisticsSales(@RequestBody StatisticsSalesRequestVO requestVO){
JsonResult result = new JsonResult();
StatisticsSalesResponseVO responseVO = agmsDashboardService.statisticsSales(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
/**
* AGMS -- Dashboard查询 经纪人统计查询
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping("/statisticsPractitioner")
public Object statisticsPractitioner(@RequestBody StatisticsPractitionerRequestVO requestVO){
JsonResult result = new JsonResult();
StatisticsPractitionerResponseVO responseVO = agmsDashboardService.statisticsPractitioner(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
/**
* AGMS -- 商机统计报表
* @param requestVO
* @return
*/
@RequestMapping(value="/leadsStatistics")
public Object leadsStatistics(@RequestBody LeadsStatisticsRequestVO requestVO,HttpServletResponse response) {
JsonResult result = new JsonResult();
LeadsStatisticsResponseVO responseVO = agmsStatisticsService.leadsStatistics(requestVO,response);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
}
......@@ -23,4 +23,18 @@ public interface AgmsDashboardService {
* @return 响应数据
*/
StatisticsForecastTotalResponseVO statisticsForecastTotal(StatisticsForecastTotalRequestVO requestVO);
/**
* AGMS -- Dashboard查询 销售统计查询
* @param requestVO 请求数据
* @return 响应数据
*/
StatisticsSalesResponseVO statisticsSales(StatisticsSalesRequestVO requestVO);
/**
* AGMS -- Dashboard查询 经纪人统计查询
* @param requestVO 请求数据
* @return 响应数据
*/
StatisticsPractitionerResponseVO statisticsPractitioner(StatisticsPractitionerRequestVO requestVO);
}
package com.yd.api.agms.service;
import com.yd.api.agms.vo.statement.FinancialStatementRequestVO;
import com.yd.api.agms.vo.statement.FinancialStatementResponseVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.FinancialStatisticsResponseVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsRequestVO;
import com.yd.api.agms.vo.statistics.LeadsStatisticsResponseVO;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
@Service("agmsStatementService")
public interface AgmsStatementService {
public interface AgmsStatisticsService {
/**
* 线下寿险预估数据管理报表
* @param requestVO 请求报文
* @return 响应报文
*/
FinancialStatementResponseVO financialPredictStatement(FinancialStatementRequestVO requestVO, HttpServletResponse response);
FinancialStatisticsResponseVO financialPredictStatistics(FinancialStatisticsRequestVO requestVO, HttpServletResponse response);
/**
* 商机统计报表
* @param requestVO 请求报文
* @return 响应报文
*/
LeadsStatisticsResponseVO leadsStatistics(LeadsStatisticsRequestVO requestVO,HttpServletResponse response);
}
package com.yd.api.agms.service.impl;
import com.google.common.base.Strings;
import com.yd.api.agms.service.AgmsDashboardService;
import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.result.CommonResult;
......@@ -12,6 +13,9 @@ import com.yd.util.config.ZHBErrorConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
@Service("agmsDashboardService")
......@@ -84,4 +88,73 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
@Override
public StatisticsSalesResponseVO statisticsSales(StatisticsSalesRequestVO requestVO) {
StatisticsSalesResponseVO responseVO = new StatisticsSalesResponseVO();
String category = requestVO.getCategory();
String time = requestVO.getTime();
String type = requestVO.getType();
category = Strings.isNullOrEmpty(category) ? "all" : category;
time = Strings.isNullOrEmpty(time) ? "m" : time;
type = Strings.isNullOrEmpty(type) ? "b" : type;
List<StatisticsSalesInfo> statisticsSalesInfos;
if("life".equals(category)){//寿险
statisticsSalesInfos = agmsDashboardDALService.statisticsSalesEG(type,time);
}else if("pc".equals(category)){//产险
statisticsSalesInfos = agmsDashboardDALService.statisticsSalesYD(type,time);
}else{
statisticsSalesInfos = getAll(type,time);
}
responseVO.setStatisticsSalesInfos(statisticsSalesInfos);
responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
/**
* dashBoard -- 寿险+产险销售统计
* @param type 类型
* @param time 时间
* @return 数据
*/
private List<StatisticsSalesInfo> getAll(String type, String time) {
StatisticsSalesInfo statisticsSalesInfo = new StatisticsSalesInfo();
List<StatisticsSalesInfo> statisticsSalesInfos = new ArrayList<>();
String unitPremium = "0";
double fyp = 0D,fyc = 0D;
Integer pieces = 0;
List<StatisticsSalesInfo> statisticsSalesInfosLife = agmsDashboardDALService.statisticsSalesEG(type,time);
List<StatisticsSalesInfo> statisticsSalesInfosPC = agmsDashboardDALService.statisticsSalesYD(type,time);
statisticsSalesInfosLife.addAll(statisticsSalesInfosPC);
if(statisticsSalesInfosLife.size() > 0){
for(StatisticsSalesInfo item : statisticsSalesInfosLife){
fyp += Double.parseDouble(item.getFyp());
fyc += Double.parseDouble(item.getFyc());
pieces += item.getPieces();
}
if(pieces != 0){
unitPremium = BigDecimal.valueOf(fyp / pieces).setScale(2,BigDecimal.ROUND_HALF_UP).toString();
}
}
statisticsSalesInfo.setFyc(new DecimalFormat("0.00").format(fyc));
statisticsSalesInfo.setFyp(new DecimalFormat("0.00").format(fyp));
statisticsSalesInfo.setPieces(pieces);
statisticsSalesInfo.setUnitPremium(unitPremium);
statisticsSalesInfo.setTypeName("寿险+财险");
statisticsSalesInfos.add(statisticsSalesInfo);
return statisticsSalesInfos;
}
@Override
public StatisticsPractitionerResponseVO statisticsPractitioner(StatisticsPractitionerRequestVO requestVO) {
StatisticsPractitionerResponseVO responseVO = new StatisticsPractitionerResponseVO();
String type = requestVO.getType();
type = Strings.isNullOrEmpty(type) ? "b" : type;
List<StatisticsPractitionerInfo> statisticsPractitionerInfos = agmsDashboardDALService.statisticsPractitioner(type);
responseVO.setStatisticsPractitionerInfos(statisticsPractitionerInfos);
responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
}
package com.yd.api.agms.service.impl;
import com.github.pagehelper.PageInfo;
import com.google.common.base.Strings;
import com.yd.api.agms.service.AgmsStatementService;
import com.yd.api.agms.vo.statement.FinancialStatementRequestVO;
import com.yd.api.agms.vo.statement.FinancialStatementResponseVO;
import com.yd.api.agms.vo.statement.statementData;
import com.yd.api.commission.service.CommissionService;
import com.yd.api.result.CommonResult;
import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Service("agmsStatementService")
public class AgmsStatementServiceImpl implements AgmsStatementService {
@Autowired
private CommissionService commissionService;
@Override
public FinancialStatementResponseVO financialPredictStatement(FinancialStatementRequestVO requestVO, HttpServletResponse response) {
FinancialStatementResponseVO responseVO = new FinancialStatementResponseVO();
PageInfo<statementData> pageInfo = requestVO.getPageInfo();
String inCommissionDateSpan = requestVO.getInCommissionDateSpan();//来佣开始时间
String outCommissionDateSpan = requestVO.getOutCommissionDateSpan();//发佣开始时间
String inCommissionStartTime = null;//来佣开始时间
String inCommissionEndTime = null;//发佣开始时间
String outCommissionStartTime= null;//来佣开始时间
String outCommissionEndTime= null;//发佣开始时间
if(!Strings.isNullOrEmpty(inCommissionDateSpan)){
String[] inDataSpan = inCommissionDateSpan.split(":");
if(inDataSpan.length == 1){
inCommissionStartTime = CommonUtil.dateParseString(CommonUtil.stringParseDate(inDataSpan[0],"yyyy-MM-dd"),"yyyyMM");
}else if(inDataSpan.length == 2){
inCommissionStartTime = CommonUtil.dateParseString(CommonUtil.stringParseDate(inDataSpan[0],"yyyy-MM-dd"),"yyyyMM");
inCommissionEndTime = getTime(inDataSpan[1]);
// inCommissionEndTime = CommonUtil.dateParseString(CommonUtil.stringParseDate(inDataSpan[1],"yyyy-MM-dd"),"yyyyMM");
}
}
if(!Strings.isNullOrEmpty(outCommissionDateSpan)){
String[] outDataSpan = outCommissionDateSpan.split(":");
if(outDataSpan.length == 1){
outCommissionStartTime = CommonUtil.dateParseString(CommonUtil.stringParseDate(outDataSpan[0],"yyyy-MM-dd"),"yyyyMM");
}else if(outDataSpan.length == 2){
outCommissionStartTime = CommonUtil.dateParseString(CommonUtil.stringParseDate(outDataSpan[0],"yyyy-MM-dd"),"yyyyMM");
outCommissionEndTime = getTime(outDataSpan[1]);
// outCommissionEndTime = CommonUtil.dateParseString(CommonUtil.stringParseDate(outDataSpan[1],"yyyy-MM-dd"),"yyyyMM");
}
}
String insurerBranchId = requestVO.getInsurerBranchId();//分公司
String deptId = requestVO.getDeptId();//营业部
String subordinateId = requestVO.getSubordinateId();//体系
Integer type = requestVO.getType();
Integer isStatement = requestVO.getIsStatement();
if(isStatement == 1){
List<statementData> dataList = commissionService.getStatementData(isStatement,type, inCommissionStartTime, outCommissionStartTime,inCommissionEndTime,outCommissionEndTime,insurerBranchId,deptId,subordinateId);
createCSV(type,dataList,response);
}else{
PageInfo<statementData> dataPage = commissionService.getStatementDataByPage(pageInfo.getPageNum(),pageInfo.getSize(),isStatement,type, inCommissionStartTime, outCommissionStartTime,inCommissionEndTime,outCommissionEndTime,insurerBranchId,deptId,subordinateId);
responseVO.setPredictStatementDataList(dataPage);
}
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
private String getTime(String time) {
Date date = CommonUtil.stringParseDate(time,"yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH,-1);
date = calendar.getTime();
return CommonUtil.dateParseString(date,"yyyyMM");
}
private void createCSV(Integer type, List<statementData> dataList, HttpServletResponse response) {
String CSV_COLUMN_SEPARATOR = ",";//CSV文件列分隔符
String CSV_ROW_SEPARATOR = "\r\n";//CSV文件行分隔符
String charset = "UTF-8"; // 读取字符编码
String[] columnName ;
String tableName ;
if(type == 2){
tableName = "YD_FinancialStatement_predict_";
columnName = new String[]{"序号","预估来佣年月","预估发佣年月","保单号","分公司","营业部","体系","经纪人姓名","员工编号","职阶","职阶率","保费","FYC","RYC","应收佣金","应发佣金","佣奖类型"};
}else{
tableName = "YD_FinancialStatement_actual_";
columnName = new String[]{"序号","实际来佣年月","实际发佣年月","保单号","分公司","营业部","体系","经纪人姓名","员工编号","职阶","职阶率","保费","FYC","RYC","应收佣金","应发佣金","佣奖类型"};
}
// 保证线程安全
StringBuilder buf = new StringBuilder();
// 组装表头
for (String title : columnName) {
buf.append(title).append(CSV_COLUMN_SEPARATOR);
}
buf.append(CSV_ROW_SEPARATOR);
// 组装数据
if (CollectionUtils.isNotEmpty(dataList)) {
for (int i = 0; i < dataList.size(); i++) {
statementData statementData = dataList.get(i);//遍历每个对象
buf.append(i + 1).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getInCommissionTime()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getOutCommissionTime()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getPolicyNo()+"\t").append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getInsurerBranch()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getDept()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getSubordinate()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getPractitioner()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getPractitionerIdEG()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getTitle()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getTitleRate()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getPremium()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getFYC()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getRYC()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getRightReceiveCommission()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getRightPayCommission()).append(CSV_COLUMN_SEPARATOR);
buf.append(statementData.getCommissionType()).append(CSV_COLUMN_SEPARATOR);
buf.append(CSV_ROW_SEPARATOR);
}
}
// 设置文件后缀
String fn = tableName + System.currentTimeMillis() + ".csv";
String headStr = "attachment; filename=\"" + fn + "\"";
// 设置响应
response.setContentType("APPLICATION/ms-csv.numberformat");
response.setCharacterEncoding(charset);
response.setHeader("Content-Disposition", headStr);
response.setHeader("Cache-Control", "max-age=30");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Pragma", "public");
OutputStream os = null;
try {
os = response.getOutputStream();
os.write(buf.toString().getBytes("GBK"));
os.flush();
} catch (IOException e) {
e.printStackTrace();
}finally {
if(os != null){
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
package com.yd.api.agms.vo.dashboard;
public class StatisticsPractitionerInfo {
private String typeName;
private Long typeId;
private Integer amount;
private Integer realAmount;
private Double realRate;
private Integer mdrt;
public Long getTypeId() {
return typeId;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public Integer getAmount() {
return amount;
}
public void setAmount(Integer amount) {
this.amount = amount;
}
public Integer getRealAmount() {
return realAmount;
}
public void setRealAmount(Integer realAmount) {
this.realAmount = realAmount;
}
public Double getRealRate() {
return realRate;
}
public void setRealRate(Double realRate) {
this.realRate = realRate;
}
public Integer getMdrt() {
return mdrt;
}
public void setMdrt(Integer mdrt) {
this.mdrt = mdrt;
}
}
package com.yd.api.agms.vo.dashboard;
public class StatisticsPractitionerRequestVO {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.yd.api.agms.vo.dashboard;
import com.yd.api.result.CommonResult;
import java.util.List;
public class StatisticsPractitionerResponseVO {
private List<StatisticsPractitionerInfo> statisticsPractitionerInfos;
private CommonResult commonResult;
public List<StatisticsPractitionerInfo> getStatisticsPractitionerInfos() {
return statisticsPractitionerInfos;
}
public void setStatisticsPractitionerInfos(List<StatisticsPractitionerInfo> statisticsPractitionerInfos) {
this.statisticsPractitionerInfos = statisticsPractitionerInfos;
}
public CommonResult getCommonResult() {
return commonResult;
}
public void setCommonResult(CommonResult commonResult) {
this.commonResult = commonResult;
}
}
package com.yd.api.agms.vo.dashboard;
public class StatisticsSalesInfo {
private String typeName;
private Long typeId;
private String fyp;
private String fyc;
private Double api;
private Integer pieces;
private String unitPremium;
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public Long getTypeId() {
return typeId;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
public String getFyp() {
return fyp;
}
public void setFyp(String fyp) {
this.fyp = fyp;
}
public String getFyc() {
return fyc;
}
public void setFyc(String fyc) {
this.fyc = fyc;
}
public Double getApi() {
return api;
}
public void setApi(Double api) {
this.api = api;
}
public Integer getPieces() {
return pieces;
}
public void setPieces(Integer pieces) {
this.pieces = pieces;
}
public String getUnitPremium() {
return unitPremium;
}
public void setUnitPremium(String unitPremium) {
this.unitPremium = unitPremium;
}
}
package com.yd.api.agms.vo.dashboard;
public class StatisticsSalesRequestVO {
private String type;// d:整体,t:团体
private String time;//d:天,w:周,m:月,q:季,y:年
private String category;//life:寿险,pc:财险,all:全部
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
}
package com.yd.api.agms.vo.dashboard;
import com.yd.api.result.CommonResult;
import java.util.List;
public class StatisticsSalesResponseVO {
private List<StatisticsSalesInfo> statisticsSalesInfos;
private CommonResult commonResult;
public List<StatisticsSalesInfo> getStatisticsSalesInfos() {
return statisticsSalesInfos;
}
public void setStatisticsSalesInfos(List<StatisticsSalesInfo> statisticsSalesInfos) {
this.statisticsSalesInfos = statisticsSalesInfos;
}
public CommonResult getCommonResult() {
return commonResult;
}
public void setCommonResult(CommonResult commonResult) {
this.commonResult = commonResult;
}
}
package com.yd.api.agms.vo.statement;
package com.yd.api.agms.vo.statistics;
import com.github.pagehelper.PageInfo;
public class FinancialStatementRequestVO {
public class FinancialStatisticsRequestVO {
private Integer type ; //2、预测,1、实际
private Integer isStatement;//0=非报表,1=报表
private String inCommissionDateSpan;
......
package com.yd.api.agms.vo.statement;
package com.yd.api.agms.vo.statistics;
import com.github.pagehelper.PageInfo;
import com.yd.api.result.CommonResult;
public class FinancialStatementResponseVO {
public class FinancialStatisticsResponseVO {
private PageInfo<statementData> predictStatementDataList;
private CommonResult commonResult;
......
package com.yd.api.agms.vo.statistics;
public class LeadsStatisticsInfo {
private String requestSMEDate;//专家请求时间
private String assignSMEDate;//专家派遣时间
private Long smePractitionerId;//专家id
private String sme; //SME
private String smeMobileNo; //SME手机号
private String talkTime; //开谈时间
private Long assignId; //分派Id
private Long practitionerId;//经纪人id
private String practitionerName; //经纪人姓名
private String practitionerMobileNo; //经纪人手机号
private String leadsCreateTime; //商机创建时间
private String leadsAssignTime; //商机派遣时间
private Long leadsCustomerId;//商机id
private String leadsName; //商机姓名
private String leadsMobileNo; //商机手机号码
private String leadsWeChatId; //商机微信号
private String leadsAge; //商机年龄
private String leadsGender; //商机性别
private String leadsCity; //商机城市
private String leadsBloodType; //商机血型
private String leadsZodiacType; //商机星座
private Double predictFYP; //预计FYP
private Double predictFYC; //预计FYC
private Double predictPieces; //件数
private String dealTime; //成交时间
private String leadsSource; //商机来源
private String leadsStatus; //商机状态
private Long leadsSourceId;
private Long leadsZodiacTypeId;
private Long leadsBloodTypeId;
public String getSme() {
return sme;
}
public void setSme(String sme) {
this.sme = sme;
}
public String getSmeMobileNo() {
return smeMobileNo;
}
public void setSmeMobileNo(String smeMobileNo) {
this.smeMobileNo = smeMobileNo;
}
public String getTalkTime() {
return talkTime;
}
public void setTalkTime(String talkTime) {
this.talkTime = talkTime;
}
public String getPractitionerName() {
return practitionerName;
}
public void setPractitionerName(String practitionerName) {
this.practitionerName = practitionerName;
}
public String getPractitionerMobileNo() {
return practitionerMobileNo;
}
public void setPractitionerMobileNo(String practitionerMobileNo) {
this.practitionerMobileNo = practitionerMobileNo;
}
public String getLeadsCreateTime() {
return leadsCreateTime;
}
public void setLeadsCreateTime(String leadsCreateTime) {
this.leadsCreateTime = leadsCreateTime;
}
public String getLeadsName() {
return leadsName;
}
public void setLeadsName(String leadsName) {
this.leadsName = leadsName;
}
public String getLeadsMobileNo() {
return leadsMobileNo;
}
public void setLeadsMobileNo(String leadsMobileNo) {
this.leadsMobileNo = leadsMobileNo;
}
public String getLeadsWeChatId() {
return leadsWeChatId;
}
public void setLeadsWeChatId(String leadsWeChatId) {
this.leadsWeChatId = leadsWeChatId;
}
public String getLeadsAge() {
return leadsAge;
}
public void setLeadsAge(String leadsAge) {
this.leadsAge = leadsAge;
}
public String getLeadsGender() {
return leadsGender;
}
public void setLeadsGender(String leadsGender) {
this.leadsGender = leadsGender;
}
public String getLeadsCity() {
return leadsCity;
}
public void setLeadsCity(String leadsCity) {
this.leadsCity = leadsCity;
}
public String getLeadsBloodType() {
return leadsBloodType;
}
public void setLeadsBloodType(String leadsBloodType) {
this.leadsBloodType = leadsBloodType;
}
public String getLeadsZodiacType() {
return leadsZodiacType;
}
public void setLeadsZodiacType(String leadsZodiacType) {
this.leadsZodiacType = leadsZodiacType;
}
public Double getPredictFYP() {
return predictFYP;
}
public void setPredictFYP(Double predictFYP) {
this.predictFYP = predictFYP;
}
public Double getPredictFYC() {
return predictFYC;
}
public void setPredictFYC(Double predictFYC) {
this.predictFYC = predictFYC;
}
public Double getPredictPieces() {
return predictPieces;
}
public void setPredictPieces(Double predictPieces) {
this.predictPieces = predictPieces;
}
public String getDealTime() {
return dealTime;
}
public void setDealTime(String dealTime) {
this.dealTime = dealTime;
}
public String getLeadsSource() {
return leadsSource;
}
public void setLeadsSource(String leadsSource) {
this.leadsSource = leadsSource;
}
public String getLeadsStatus() {
return leadsStatus;
}
public void setLeadsStatus(String leadsStatus) {
this.leadsStatus = leadsStatus;
}
public Long getSmePractitionerId() {
return smePractitionerId;
}
public void setSmePractitionerId(Long smePractitionerId) {
this.smePractitionerId = smePractitionerId;
}
public Long getPractitionerId() {
return practitionerId;
}
public void setPractitionerId(Long practitionerId) {
this.practitionerId = practitionerId;
}
public String getLeadsAssignTime() {
return leadsAssignTime;
}
public void setLeadsAssignTime(String leadsAssignTime) {
this.leadsAssignTime = leadsAssignTime;
}
public Long getLeadsCustomerId() {
return leadsCustomerId;
}
public void setLeadsCustomerId(Long leadsCustomerId) {
this.leadsCustomerId = leadsCustomerId;
}
public Long getAssignId() {
return assignId;
}
public void setAssignId(Long assignId) {
this.assignId = assignId;
}
public String getRequestSMEDate() {
return requestSMEDate;
}
public void setRequestSMEDate(String requestSMEDate) {
this.requestSMEDate = requestSMEDate;
}
public String getAssignSMEDate() {
return assignSMEDate;
}
public void setAssignSMEDate(String assignSMEDate) {
this.assignSMEDate = assignSMEDate;
}
public Long getLeadsSourceId() {
return leadsSourceId;
}
public void setLeadsSourceId(Long leadsSourceId) {
this.leadsSourceId = leadsSourceId;
}
public Long getLeadsZodiacTypeId() {
return leadsZodiacTypeId;
}
public void setLeadsZodiacTypeId(Long leadsZodiacTypeId) {
this.leadsZodiacTypeId = leadsZodiacTypeId;
}
public Long getLeadsBloodTypeId() {
return leadsBloodTypeId;
}
public void setLeadsBloodTypeId(Long leadsBloodTypeId) {
this.leadsBloodTypeId = leadsBloodTypeId;
}
}
package com.yd.api.agms.vo.statistics;
import com.github.pagehelper.PageInfo;
public class LeadsStatisticsRequestVO {
private Integer isStatement;//0=非报表,1=报表
private String leadsDateSpan;//null:全部,0:今天,1:昨天,
private Integer leadsStatus; // 0/null:全部,1:未派遣,2:已派遣
private Integer expertApplyStatus; // 0/null:全部,1:未申请,2:申请中,3:已指派,
private PageInfo<LeadsStatisticsInfo> pageInfo;
public Integer getIsStatement() {
return isStatement;
}
public void setIsStatement(Integer isStatement) {
this.isStatement = isStatement;
}
public String getLeadsDateSpan() {
return leadsDateSpan;
}
public void setLeadsDateSpan(String leadsDateSpan) {
this.leadsDateSpan = leadsDateSpan;
}
public Integer getLeadsStatus() {
return leadsStatus;
}
public void setLeadsStatus(Integer leadsStatus) {
this.leadsStatus = leadsStatus;
}
public Integer getExpertApplyStatus() {
return expertApplyStatus;
}
public void setExpertApplyStatus(Integer expertApplyStatus) {
this.expertApplyStatus = expertApplyStatus;
}
public PageInfo<LeadsStatisticsInfo> getPageInfo() {
return pageInfo;
}
public void setPageInfo(PageInfo<LeadsStatisticsInfo> pageInfo) {
this.pageInfo = pageInfo;
}
}
package com.yd.api.agms.vo.statistics;
import com.github.pagehelper.PageInfo;
import com.yd.api.result.CommonResult;
public class LeadsStatisticsResponseVO {
private PageInfo<LeadsStatisticsInfo> statisticsPageInfo;
private CommonResult commonResult;
public PageInfo<LeadsStatisticsInfo> getStatisticsPageInfo() {
return statisticsPageInfo;
}
public void setStatisticsPageInfo(PageInfo<LeadsStatisticsInfo> statisticsPageInfo) {
this.statisticsPageInfo = statisticsPageInfo;
}
public CommonResult getCommonResult() {
return commonResult;
}
public void setCommonResult(CommonResult commonResult) {
this.commonResult = commonResult;
}
}
package com.yd.api.agms.vo.statement;
package com.yd.api.agms.vo.statistics;
public class statementData {
private String inCommissionTime;
......
......@@ -3,7 +3,7 @@ package com.yd.api.commission.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.yd.api.agms.vo.statement.statementData;
import com.yd.api.agms.vo.statistics.statementData;
import com.yd.api.commission.vo.CommissionEGoldenVO;
import com.yd.api.commission.vo.CommissionVO;
......
......@@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.yd.api.agms.vo.statement.statementData;
import com.yd.api.agms.vo.statistics.statementData;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
package com.yd.dal.entity.leads;
public class LeadsStatusInfo {
private Long leadsCustomerId;
private Long leadsStatusId;
public Long getLeadsCustomerId() {
return leadsCustomerId;
}
public void setLeadsCustomerId(Long leadsCustomerId) {
this.leadsCustomerId = leadsCustomerId;
}
public Long getLeadsStatusId() {
return leadsStatusId;
}
public void setLeadsStatusId(Long leadsStatusId) {
this.leadsStatusId = leadsStatusId;
}
}
package com.yd.dal.entity.meta;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ag_md_city
* @author
*/
@Data
public class MdCity implements Serializable {
/**
* serial id
*/
private Long id;
/**
* FK ag_md_province.id
*/
private Long provinceId;
/**
* FK ag_md_product.id
*/
private Long productId;
/**
* City name
*/
private String cityName;
/**
* City English name
*/
private String cityNameEn;
/**
* 国际码
*/
private String cityCode;
/**
* 几线城市
*/
private String cityLine;
/**
* 国际码
*/
private String globalCode;
/**
* Zip Code 邮政编码
*/
private String zipCode;
/**
* 0=No, 1=Yes
*/
private Integer isActive;
/**
* FK ag_acl_insurer.id
*/
private Long insurerId;
private Date createdAt;
private Long createdBy;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.yd.dal.mapper.agms;
import com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo;
import com.yd.api.agms.vo.dashboard.StatisticsSalesInfo;
import com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo;
import com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo;
import org.apache.ibatis.annotations.Param;
......@@ -14,4 +16,10 @@ public interface AgmsDashboardMapper {
List<StatisticsOpportunityInfo> statisticsOpportunity(@Param("type")String type,@Param("time") String time, @Param("dropOptionId") Long dropOptionId);
List<Map<String, Long>> getPractitionerNums(@Param("type")String type);
List<StatisticsSalesInfo> statisticsSalesYD(@Param("type")String type, @Param("time")String time);
List<StatisticsPractitionerInfo> statisticsPractitioner(@Param("type")String type);
List<StatisticsSalesInfo> statisticsSalesEG(@Param("type")String type, @Param("time")String time);
}
......@@ -3,7 +3,7 @@ package com.yd.dal.mapper.commission;
import java.util.List;
import com.github.pagehelper.Page;
import com.yd.api.agms.vo.statement.statementData;
import com.yd.api.agms.vo.statistics.statementData;
import org.apache.ibatis.annotations.Param;
import com.yd.dal.entity.commission.CommissionEGolden;
......
......@@ -64,4 +64,6 @@ public interface AclPractitionerMapper {
PractitionerBasicInfo findByIdEG(@Param("practitionerIdEG")String practitionerIdEG);
AclPractitioner findPractitionerByLeadsAssignedId(Long leadsAssignedId);
List<AclPractitioner> findAll();
}
\ No newline at end of file
package com.yd.dal.mapper.marketing;
import com.yd.api.agms.vo.statistics.LeadsStatisticsInfo;
import com.yd.dal.entity.leads.LeadsStatusInfo;
import com.yd.dal.entity.marketing.MktLeadsPool;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface MktLeadsPoolMapper {
int deleteByPrimaryKey(Long id);
......@@ -16,4 +22,14 @@ public interface MktLeadsPoolMapper {
int updateByPrimaryKey(MktLeadsPool record);
MktLeadsPool findByCustomerId(Long customerId);
List<LeadsStatisticsInfo> findALLByDate(@Param("leadsStartTime")String leadsStartTime, @Param("leadsEndTime")String leadsEndTime);
List<LeadsStatisticsInfo> findIsAssignByDate(@Param("leadsStartTime")String leadsStartTime, @Param("leadsEndTime")String leadsEndTime);
List<LeadsStatisticsInfo> findIsNotAssignByDate(@Param("leadsStartTime")String leadsStartTime, @Param("leadsEndTime")String leadsEndTime);
List<LeadsStatisticsInfo> findIsAssignLeads();
List<LeadsStatusInfo> findLeadsStatusMap();
}
\ No newline at end of file
package com.yd.dal.mapper.meta;
import com.yd.dal.entity.meta.MdCity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MdCityMapper {
int deleteByPrimaryKey(Long id);
int insert(MdCity record);
int insertSelective(MdCity record);
MdCity selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(MdCity record);
int updateByPrimaryKey(MdCity record);
List<MdCity> findByInsurerId(@Param("insurerId") Long insurerId);
}
\ No newline at end of file
......@@ -48,4 +48,6 @@ public interface MdDropOptionsMapper {
List<InsurerBranchInfo> findInsurerBranchInfoByIdEG(@Param("insurerBranchIds")List<String> insurerBranchIds);
List<InsurerBranchInfo> findInsurerBranchInfoEG();
List<MdDropOptions> findByDropMasterCodes(@Param("masterCodeList")List<String> masterCodeList);
}
\ No newline at end of file
package com.yd.dal.service.agms;
import com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo;
import com.yd.api.agms.vo.dashboard.StatisticsSalesInfo;
import com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo;
import com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo;
......@@ -9,4 +11,10 @@ public interface AgmsDashboardDALService {
List<StatisticsPEPInfo> statisticsPEP(String type,Long dropOptionId);
List<StatisticsOpportunityInfo> statisticsOpportunity(String type,String time, Long id);
List<StatisticsSalesInfo> statisticsSalesYD(String type, String time);
List<StatisticsPractitionerInfo> statisticsPractitioner(String type);
List<StatisticsSalesInfo> statisticsSalesEG(String type, String time);
}
package com.yd.dal.service.agms.impl;
import com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo;
import com.yd.api.agms.vo.dashboard.StatisticsSalesInfo;
import com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo;
import com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo;
import com.yd.dal.mapper.agms.AgmsDashboardMapper;
import com.yd.dal.service.agms.AgmsDashboardDALService;
import com.yd.util.intercept.annotation.TargetDataSource;
import com.yd.util.intercept.commons.DataSourceKey;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -84,4 +88,54 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
public List<StatisticsOpportunityInfo> statisticsOpportunity(String type,String time, Long dropOptionId) {
return agmsDashboardMapper.statisticsOpportunity(type , time, dropOptionId);
}
@Override
public List<StatisticsSalesInfo> statisticsSalesYD(String type, String time) {
List<StatisticsSalesInfo> statisticsSalesInfos = agmsDashboardMapper.statisticsSalesYD(type,time);
getUnitPremium(statisticsSalesInfos);
return statisticsSalesInfos;
}
/**
* 获取均件保费
* @param statisticsSalesInfos
*/
private void getUnitPremium(List<StatisticsSalesInfo> statisticsSalesInfos) {
if(statisticsSalesInfos != null && statisticsSalesInfos.size() > 0){
String fyp;
Integer pieces;
for(StatisticsSalesInfo item : statisticsSalesInfos){
fyp = item.getFyp();
pieces = item.getPieces();
if(pieces != null && pieces != 0){
item.setUnitPremium(BigDecimal.valueOf(Double.parseDouble(fyp) / pieces).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
}
}
}
}
@Override
public List<StatisticsPractitionerInfo> statisticsPractitioner(String type) {
List<StatisticsPractitionerInfo> statisticsPractitionerInfos = agmsDashboardMapper.statisticsPractitioner(type);
//计算实动率
if(statisticsPractitionerInfos != null && statisticsPractitionerInfos.size() > 0){
Integer realAmount,amount;
for(StatisticsPractitionerInfo item : statisticsPractitionerInfos){
realAmount = item.getRealAmount();
amount = item.getAmount();
if(amount > 0){
item.setRealRate(BigDecimal.valueOf((realAmount.doubleValue() / amount.doubleValue()) * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
}
return statisticsPractitionerInfos;
}
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public List<StatisticsSalesInfo> statisticsSalesEG(String type, String time) {
List<StatisticsSalesInfo> statisticsSalesInfos = agmsDashboardMapper.statisticsSalesEG(type,time);
getUnitPremium(statisticsSalesInfos);
return statisticsSalesInfos;
}
}
......@@ -3,7 +3,7 @@ package com.yd.dal.service.commission;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.yd.api.agms.vo.statement.statementData;
import com.yd.api.agms.vo.statistics.statementData;
import com.yd.dal.entity.commission.CommissionEGolden;
/**
......
......@@ -3,7 +3,7 @@ package com.yd.dal.service.commission;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yd.api.agms.vo.statement.statementData;
import com.yd.api.agms.vo.statistics.statementData;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
......
......@@ -169,4 +169,10 @@ public interface AclPractitionerDALService {
* @return
*/
AclPractitioner findPractitionerByLeadsAssignedId(Long leadsAssignedId);
/**
* 查询所有经纪人
* @return 结果
*/
List<AclPractitioner> findAll();
}
......@@ -160,4 +160,9 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService
public AclPractitioner findPractitionerByLeadsAssignedId(Long leadsAssignedId) {
return aclPractitionerMapper.findPractitionerByLeadsAssignedId(leadsAssignedId);
}
@Override
public List<AclPractitioner> findAll() {
return aclPractitionerMapper.findAll();
}
}
package com.yd.dal.service.marketing.Impl;
import com.yd.api.agms.vo.statistics.LeadsStatisticsInfo;
import com.yd.dal.entity.leads.LeadsStatusInfo;
import com.yd.dal.entity.marketing.MktLeadsPool;
import com.yd.dal.mapper.marketing.MktLeadsPoolMapper;
import com.yd.dal.service.marketing.MktLeadsPoolDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("mktLeadsPoolDALService")
public class MktLeadsPoolDALServiceImpl implements MktLeadsPoolDALService {
......@@ -21,4 +26,32 @@ public class MktLeadsPoolDALServiceImpl implements MktLeadsPoolDALService {
public void save(MktLeadsPool pool) {
mktLeadsPoolMapper.insertSelective(pool);
}
@Override
public List<LeadsStatisticsInfo> findALLByDate(String leadsStartTime, String leadsEndTime) {
return mktLeadsPoolMapper.findALLByDate(leadsStartTime,leadsEndTime);
}
@Override
public List<LeadsStatisticsInfo> findIsAssignByDate(String leadsStartTime, String leadsEndTime) {
return mktLeadsPoolMapper.findIsAssignByDate(leadsStartTime,leadsEndTime);
}
@Override
public List<LeadsStatisticsInfo> findIsNotAssignByDate(String leadsStartTime, String leadsEndTime) {
return mktLeadsPoolMapper.findIsNotAssignByDate(leadsStartTime,leadsEndTime);
}
@Override
public List<LeadsStatisticsInfo> findIsAssignLeads() {
return mktLeadsPoolMapper.findIsAssignLeads();
}
@Override
public Map<Long, Long> findLeadsStatusMap() {
Map<Long, Long> leadsMap = new HashMap<>();
List<LeadsStatusInfo> leadsStatusInfoList = mktLeadsPoolMapper.findLeadsStatusMap();
leadsStatusInfoList.forEach(i->leadsMap.put(i.getLeadsCustomerId(),i.getLeadsStatusId()));
return leadsMap;
}
}
package com.yd.dal.service.marketing;
import com.yd.api.agms.vo.statistics.LeadsStatisticsInfo;
import com.yd.dal.entity.marketing.MktLeadsPool;
import java.util.List;
import java.util.Map;
public interface MktLeadsPoolDALService {
MktLeadsPool findByCustomerId(Long customerId);
void save(MktLeadsPool pool);
List<LeadsStatisticsInfo> findALLByDate(String leadsStartTime, String leadsEndTime);
List<LeadsStatisticsInfo> findIsAssignByDate(String leadsStartTime, String leadsEndTime);
List<LeadsStatisticsInfo> findIsNotAssignByDate(String leadsStartTime, String leadsEndTime);
List<LeadsStatisticsInfo> findIsAssignLeads();
Map<Long, Long> findLeadsStatusMap();
}
package com.yd.dal.service.meta;
import com.yd.dal.entity.meta.MdCity;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("mdCityDALService")
public interface MdCityDALService {
List<MdCity> findByInsurerId(Long i);
}
......@@ -38,4 +38,6 @@ public interface MdDropOptionsDALService {
List<InsurerBranchInfo> findInsurerBranchInfoByIdEG(List<String> insurerBranchIds);
List<InsurerBranchInfo> findInsurerBranchInfoEG();
List<MdDropOptions> findByDropMasterCodes(List<String> asList);
}
package com.yd.dal.service.meta.impl;
import com.yd.dal.entity.meta.MdCity;
import com.yd.dal.mapper.meta.MdCityMapper;
import com.yd.dal.service.meta.MdCityDALService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("mdCityDALService")
public class MdCityDALServiceImpl implements MdCityDALService {
@Resource
private MdCityMapper mdCityMapper;
@Override
public List<MdCity> findByInsurerId(Long insurerId) {
return mdCityMapper.findByInsurerId(insurerId);
}
}
......@@ -106,4 +106,9 @@ public class MdDropOptionsDALServiceImpl implements MdDropOptionsDALService {
public List<InsurerBranchInfo> findInsurerBranchInfoEG() {
return mdDropOptionsMapper.findInsurerBranchInfoEG();
}
@Override
public List<MdDropOptions> findByDropMasterCodes(List<String> masterCodeList) {
return mdDropOptionsMapper.findByDropMasterCodes(masterCodeList);
}
}
package com.yd.util.page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.LinkedList;
import java.util.List;
public class PageInfoUtils {
public static <T> PageInfo<T> list2PageInfo(List<T> arrayList, Integer pageNum, Integer pageSize) {
//实现list分页
PageHelper.startPage(pageNum, pageSize);
int pageStart = pageNum == 1 ? 0 : (pageNum - 1) * pageSize;
int pageEnd = arrayList.size() < pageSize * pageNum ? arrayList.size() : pageSize * pageNum;
List<T> pageResult = new LinkedList<T>();
if (arrayList.size() > pageStart) {
pageResult = arrayList.subList(pageStart, pageEnd);
}
PageInfo<T> pageInfo = new PageInfo<T>(pageResult);
//获取PageInfo其他参数
pageInfo.setTotal(arrayList.size());
int endRow = pageInfo.getEndRow() == 0 ? 0 : (pageNum - 1) * pageSize + pageInfo.getEndRow() + 1;
pageInfo.setEndRow(endRow);
boolean hasNextPage = arrayList.size() <= pageSize * pageNum ? false : true;
pageInfo.setHasNextPage(hasNextPage);
boolean hasPreviousPage = pageNum == 1 ? false : true;
pageInfo.setHasPreviousPage(hasPreviousPage);
pageInfo.setIsFirstPage(!hasPreviousPage);
boolean isLastPage = (arrayList.size() > pageSize * (pageNum - 1) && arrayList.size() <= pageSize * pageNum) ? true : false;
pageInfo.setIsLastPage(isLastPage);
int pages = arrayList.size() % pageSize == 0 ? arrayList.size() / pageSize : (arrayList.size() / pageSize) + 1;
pageInfo.setNavigateLastPage(pages);
int[] navigatePageNums = new int[pages];
for (int i = 1; i < pages; i++) {
navigatePageNums[i - 1] = i;
}
pageInfo.setNavigatepageNums(navigatePageNums);
int nextPage = pageNum < pages ? pageNum + 1 : 0;
pageInfo.setNextPage(nextPage);
pageInfo.setPageNum(pageNum);
pageInfo.setPageSize(pageSize);
pageInfo.setPages(pages);
pageInfo.setPrePage(pageNum - 1);
pageInfo.setSize(pageInfo.getList().size());
int starRow = arrayList.size() < pageSize * pageNum ? 1 + pageSize * (pageNum - 1) : 0;
pageInfo.setStartRow(starRow);
return pageInfo;
}
}
......@@ -96,6 +96,7 @@ where
</choose>
order by predictFYC desc ,predictFYP desc ,pieces desc ,opportunityNum desc;
</select>
<select id="getPractitionerNums" resultType="java.util.Map">
select
<choose>
......@@ -124,5 +125,160 @@ where ps.practitioner_type_id = 28
</choose>
</select>
<select id="statisticsSalesYD" resultType="com.yd.api.agms.vo.dashboard.StatisticsSalesInfo">
select
<choose>
<when test="type.equalsIgnoreCase('B')">
b.branch_name as typeName,
b.id as typeId,
</when>
<otherwise>
s.name as typeName,
s.id as typeId,
</otherwise>
</choose>
concat(ifnull(sum(cf.order_price),0),'') as fyp,
concat(ifnull(sum(cf.fyc_amount),0),'') as fyc,
ifnull(count(cf.order_id),0) as pieces
from ag_acl_practitioner p inner join ag_acl_customer_fortune cf on p.customer_id = cf.customer_id and cf.drop_option_code = "S01"
inner join ag_po_order o on cf.order_id = o.id and o.status = 3
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
where
<choose>
<when test="type.equalsIgnoreCase('B')">
p.insurer_branch_id is not null
</when>
<otherwise>
p.subordinate_system_id is not null
</otherwise>
</choose>
<choose>
<when test="time.equalsIgnoreCase('D')">
and TO_DAYS(o.order_date) = TO_DAYS(now())
</when>
<when test="time.equalsIgnoreCase('W')">
and YEARWEEK(DATE_FORMAT(o.order_date,'%Y-%m-%d')) = YEARWEEK(NOW())
</when>
<when test="time.equalsIgnoreCase('M')">
and DATE_FORMAT(o.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time.equalsIgnoreCase('Q')">
and QUARTER(o.order_date) = QUARTER(NOW()) AND year(o.order_date)=year(now())
</when>
<otherwise>
and YEAR(o.order_date) = YEAR(now())
</otherwise>
</choose>
<choose>
<when test="type.equalsIgnoreCase('B')">
group by p.insurer_branch_id
</when>
<otherwise>
group by p.subordinate_system_id
</otherwise>
</choose>
order by sum(cf.fyc_amount) desc
</select>
<select id="statisticsPractitioner" resultType="com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo">
<choose>
<when test="type.equalsIgnoreCase('B')">
select
ib.branch_name as typeName,
ib.id as typeId,
ifnull(count(p.id),0) as amount,
ifnull(a.real_count,0) as realAmount,
ifnull(b.mdrt_count,0) as mdrt
from ag_acl_practitioner p left join
(
select p.insurer_branch_id insurer_branch_id,count(distinct f.customer_id) as real_count
from ag_acl_customer_fortune f inner join ag_po_order o on f.order_id = o.id and o.status = 3 and f.drop_option_code = "S01"
inner join ag_acl_practitioner p on f.customer_id = p.customer_id
group by p.insurer_branch_id
)a on a.insurer_branch_id = p.insurer_branch_id
left join
(
select t.insurer_branch_id,count(t.id) as mdrt_count from ag_acl_practitioner t where t.cert_list is not null and t.cert_list like "%1%" group by t.insurer_branch_id
)b on b.insurer_branch_id = p.insurer_branch_id
left join ag_acl_insurer_branch ib on ib.id = p.insurer_branch_id
where p.is_active = 1
and p.insurer_branch_id is not null
group by p.insurer_branch_id order by amount desc ;
</when>
<otherwise>
select
s.id as typeId,
s.name as typeName,
ifnull(count(p.id),0) as amount,
ifnull(a.real_count,0) as realAmount,
ifnull(b.mdrt_count,0) as mdrt
from ag_acl_practitioner p left join
(
select p.subordinate_system_id subordinate_system_id,count(distinct f.customer_id) as real_count
from ag_acl_customer_fortune f inner join ag_po_order o on f.order_id = o.id and o.status = 3 and f.drop_option_code = "S01"
inner join ag_acl_practitioner p on f.customer_id = p.customer_id
group by p.subordinate_system_id
)a on a.subordinate_system_id = p.subordinate_system_id
left join
(
select t.subordinate_system_id,count(t.id) as mdrt_count from ag_acl_practitioner t where t.cert_list is not null and t.cert_list like "%1%" group by t.subordinate_system_id
)b on b.subordinate_system_id = p.subordinate_system_id
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
where p.is_active = 1
and p.subordinate_system_id is not null
group by p.subordinate_system_id order by amount desc ;
</otherwise>
</choose>
</select>
<select id="statisticsSalesEG" resultType="com.yd.api.agms.vo.dashboard.StatisticsSalesInfo">
select
<choose>
<when test="type.equalsIgnoreCase('B')">
spc1.SPC_AREA_NAME as typeName,
</when>
<otherwise>
spc4.SPC_DIV_NAME as typeName,
</otherwise>
</choose>
ifnull(count(distinct policy.INS_MST_ID),0) as pieces,
concat(ifnull(sum(policy.INS_MST_TOTAL_PREIUM),0),'') as fyp,
concat(ifnull(sum(policy.INS001_FYCTOTAL),0),'') as fyc
FROM
ins001 policy INNER JOIN mon025 m on policy.INS_MST_ID = m.MON025_002 and m.MON025_109 IN (1,2,3) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'
INNER JOIN (
SELECT mon025_002,MAX(MON025_405) as MON025_405 FROM mon025 group by mon025_002 ORDER BY mon025_002
) b on m.mon025_002 = b.mon025_002 AND m.MON025_405 = b.MON025_405
inner join spc004 spc4 on m.MON025_006 = spc4.SPC_DIV_ID -- 体系
inner join spc002 spc2 on spc4.FK_BUS_ID = spc2.SPC_BUS_ID -- 营业部
inner join spc001 spc1 on spc2.FK_AREA_ID = spc1.SPC_AREA_ID -- 分公司
where
<choose>
<when test="time.equalsIgnoreCase('D')">
TO_DAYS(policy.INS_MST_ACCEPT_DATE) = TO_DAYS(now())
</when>
<when test="time.equalsIgnoreCase('W')">
YEARWEEK(DATE_FORMAT(policy.INS_MST_ACCEPT_DATE,'%Y-%m-%d')) = YEARWEEK(NOW())
</when>
<when test="time.equalsIgnoreCase('M')">
DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time.equalsIgnoreCase('Q')">
QUARTER(policy.INS_MST_ACCEPT_DATE) = QUARTER(NOW()) AND year(policy.INS_MST_ACCEPT_DATE)=year(now())
</when>
<otherwise>
YEAR(policy.INS_MST_ACCEPT_DATE) = YEAR(now())
</otherwise>
</choose>
<choose>
<when test="type.equalsIgnoreCase('B')">
group by spc1.SPC_AREA_ID
</when>
<otherwise>
group by m.MON025_006
</otherwise>
</choose>
order by sum(policy.INS001_FYCTOTAL) desc
</select>
</mapper>
\ No newline at end of file
......@@ -27,7 +27,7 @@
WHERE policy.INS_MST_REPEAL != 1 AND sales.SAL_MST_MOBILE = #{login}
</select>
<select id="getStatementDataByPage" resultType="com.yd.api.agms.vo.statement.statementData">
<select id="getStatementDataByPage" resultType="com.yd.api.agms.vo.statistics.statementData">
select if(#{type,jdbcType=INTEGER} = 1,receive.mon024_302,receive.MON024_301) as inCommissionTime, -- 预计来佣年月
if(#{type,jdbcType=INTEGER} = 1,pay.MON025_302,pay.mon025_301) as outCommissionTime,
policy.INS_MST_POLICY_NUM as policyNo, -- 保单号
......
......@@ -10,8 +10,6 @@
<result column="order_price" jdbcType="DECIMAL" property="orderPrice" />
<result column="commission_rate" jdbcType="DECIMAL" property="commissionRate" />
<result column="commission_amount" jdbcType="DECIMAL" property="commissionAmount" />
<result column="announcement_commission_rate" jdbcType="DECIMAL" property="announcementCommissionRate" />
<result column="announcement_commission_amount" jdbcType="DECIMAL" property="announcementCommissionAmount" />
<result column="grade_commission_rate" jdbcType="DECIMAL" property="gradeCommissionRate" />
<result column="referral_rate" jdbcType="DECIMAL" property="referralRate" />
<result column="referral_amount" jdbcType="DECIMAL" property="referralAmount" />
......@@ -27,7 +25,7 @@
</resultMap>
<sql id="Base_Column_List">
id, share_id, customer_id, order_id, order_date, order_price, commission_rate, commission_amount,
announcement_commission_rate, announcement_commission_amount, grade_commission_rate,
grade_commission_rate,
referral_rate, referral_amount, is_tax, tax_amount,
net_amount, campaign_id, withdrawable_date, withdrawed_id, fortune_payed_id, created_at,
created_by
......@@ -45,8 +43,7 @@
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerFortune" useGeneratedKeys="true">
insert into ag_acl_customer_fortune (share_id, customer_id, order_id,
order_date, order_price, commission_rate,
commission_amount, announcement_commission_rate,
announcement_commission_amount, grade_commission_rate,
commission_amount, grade_commission_rate,
referral_rate, referral_amount,
is_tax, tax_amount, net_amount,
campaign_id, withdrawable_date, withdrawed_id,
......@@ -54,8 +51,8 @@
)
values (#{shareId,jdbcType=BIGINT}, #{customerId,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT},
#{orderDate,jdbcType=TIMESTAMP}, #{orderPrice,jdbcType=DECIMAL}, #{commissionRate,jdbcType=DECIMAL},
#{commissionAmount,jdbcType=DECIMAL}, #{announcementCommissionRate,jdbcType=DECIMAL},
#{announcementCommissionAmount,jdbcType=DECIMAL}, #{gradeCommissionRate,jdbcType=DECIMAL},
#{commissionAmount,jdbcType=DECIMAL},
#{gradeCommissionRate,jdbcType=DECIMAL},
#{referralRate,jdbcType=DECIMAL}, #{referralAmount,jdbcType=DECIMAL},
#{isTax,jdbcType=INTEGER}, #{taxAmount,jdbcType=DECIMAL}, #{netAmount,jdbcType=DECIMAL},
#{campaignId,jdbcType=BIGINT}, #{withdrawableDate,jdbcType=TIMESTAMP}, #{withdrawedId,jdbcType=BIGINT},
......@@ -151,12 +148,6 @@
<if test="commissionAmount != null">
#{commissionAmount,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionRate != null">
#{announcementCommissionRate,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionAmount != null">
#{announcementCommissionAmount,jdbcType=DECIMAL},
</if>
<if test="gradeCommissionRate != null">
#{gradeCommissionRate,jdbcType=DECIMAL},
</if>
......@@ -219,12 +210,6 @@
<if test="commissionAmount != null">
commission_amount = #{commissionAmount,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionRate != null">
announcement_commission_rate = #{announcementCommissionRate,jdbcType=DECIMAL},
</if>
<if test="announcementCommissionAmount != null">
announcement_commission_amount = #{announcementCommissionAmount,jdbcType=DECIMAL},
</if>
<if test="gradeCommissionRate != null">
grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL},
</if>
......@@ -273,8 +258,6 @@
order_price = #{orderPrice,jdbcType=DECIMAL},
commission_rate = #{commissionRate,jdbcType=DECIMAL},
commission_amount = #{commissionAmount,jdbcType=DECIMAL},
announcement_commission_rate = #{announcementCommissionRate,jdbcType=DECIMAL},
announcement_commission_amount = #{announcementCommissionAmount,jdbcType=DECIMAL},
grade_commission_rate = #{gradeCommissionRate,jdbcType=DECIMAL},
referral_rate = #{referralRate,jdbcType=DECIMAL},
referral_amount = #{referralAmount,jdbcType=DECIMAL},
......@@ -302,7 +285,7 @@
s.practitioner_level practitionerLevelId
FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id )
INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id and f.drop_option_code = "S01")
INNER JOIN ag_po_order o ON f.order_id = o.id
WHERE
o.status = 3 and o.order_price > 0
......
......@@ -614,7 +614,7 @@
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_practitioner_setting s on p.id = s.practitioner_id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
WHERE o.status = 3
WHERE o.status = 3 and f.drop_option_code = "S01"
<if test="practitionerTypeId != null">
and s.practitioner_type_id = #{practitionerTypeId}
</if>
......@@ -646,7 +646,7 @@
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_customer c on p.customer_id = c.id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
WHERE o.status = 3
WHERE o.status = 3 and f.drop_option_code = "S01"
and c.login in
<foreach collection="mobileSpecials" index="index" item="item" open="(" separator="," close=")">
#{item}
......@@ -861,7 +861,7 @@
inner JOIN ag_acl_practitioner p ON f.customer_id = p.customer_id
left join ag_acl_practitioner_setting s on p.id = s.practitioner_id
left join ag_acl_practitioner_subordinate_system ss on p.subordinate_system_id = ss.id
WHERE p.id = #{practitionerId,jdbcType=BIGINT}
WHERE p.id = #{practitionerId,jdbcType=BIGINT} and f.drop_option_code = "S01"
<choose>
<when test="time == 1">
and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
......@@ -922,4 +922,9 @@
left join ag_mkt_leads_assigneds a on a.assigned_practitioner_id = p.id
where a.id = #{leadsAssignedId,jdbcType=BIGINT}
</select>
<select id="findAll" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_acl_practitioner
</select>
</mapper>
\ No newline at end of file
......@@ -154,4 +154,101 @@
from ag_mkt_leads_pool
where customer_id = #{customerId,jdbcType=BIGINT}
</select>
<select id="findALLByDate" resultType="com.yd.api.agms.vo.statistics.LeadsStatisticsInfo">
select c.id as leadsCustomerId,
c.`name` as leadsName,
c.login as leadsMobileNo,
c.wechat_no as leadsWeChatId,
c.age as leadsAge,
c.address as leadsCity,
c.blood_type_id as leadsBloodTypeId,
c.zodiac_type_id as leadsZodiacTypeId,
IF(c.gender = 1, '男', '女') as leadsGender,
date_format(pool.added_at , '%Y-%m-%d %H:%i:%s') as leadsCreateTime,
assign.id as assignId,
assign.assigned_practitioner_id as practitionerId,
pool.source_from as leadsSourceId,
date_format(assign.created_at, '%Y-%m-%d %H:%i:%s') as leadsAssignTime
from ag_mkt_leads_pool pool LEFT JOIN ag_acl_customer c on pool.customer_id = c.id
left join ag_mkt_leads_assigneds assign on assign.customer_id = pool.customer_id
where pool.is_active = 1
<if test="leadsStartTime != null">
and pool.added_at &gt;= #{leadsStartTime,jdbcType=VARCHAR}
</if>
<if test="leadsEndTime != null">
and pool.added_at &lt;= #{leadsEndTime,jdbcType=VARCHAR}
</if>
order by pool.added_at desc
</select>
<select id="findIsAssignByDate" resultType="com.yd.api.agms.vo.statistics.LeadsStatisticsInfo">
select c.`name` as leadsName,
c.login as leadsMobileNo,
c.wechat_no as leadsWeChatId,
c.age as leadsAge,
c.city_id as cityId,
c.blood_type_id as bloodTypeId,
c.zodiac_type_id as zodiacTypeId,
IF(c.gender = 1, '男', '女') as leadsGender,
date_format(pool.added_at , '%Y-%m-%d %H:%i:%s') as leadsCreatTime,
assgin.assigned_practitioner_id as practitionerId,
date_format(assgin.created_at, '%Y-%m-%d %H:%i:%s') as leadsAssignTime
from ag_mkt_leads_pool pool LEFT JOIN ag_acl_customer c on pool.customer_id = c.id
inner join ag_mkt_leads_assigneds assgin on assgin.customer_id = pool.customer_id
# where 1 == 1
<!-- <if test="leadsStartTime != null">-->
<!-- and pool.added_at >= #{leadsStartTime,jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- <if test="leadsEndTime != null">-->
<!-- and pool.added_at <= #{leadsEndTime,jdbcType=VARCHAR}-->
<!-- </if>-->
order by pool.added_at desc
</select>
<select id="findIsNotAssignByDate" resultType="com.yd.api.agms.vo.statistics.LeadsStatisticsInfo">
select c.`name` as leadsName,
c.login as leadsMobileNo,
c.wechat_no as leadsWeChatId,
c.age as leadsAge,
c.city_id as cityId,
c.blood_type_id as bloodTypeId,
c.zodiac_type_id as zodiacTypeId,
IF(c.gender = 1, '男', '女') as leadsGender,
date_format(pool.added_at , '%Y-%m-%d %H:%i:%s') as leadsCreatTime,
assgin.assigned_practitioner_id as practitionerId,
date_format(assgin.created_at, '%Y-%m-%d %H:%i:%s') as leadsAssignTime
from ag_mkt_leads_pool pool LEFT JOIN ag_acl_customer c on pool.customer_id = c.id
left outer join ag_mkt_leads_assigneds assgin on assgin.customer_id = pool.customer_id
where assgin.customer_id is null
<!-- <if test="leadsStartTime != null">-->
<!-- and pool.added_at >= #{leadsStartTime,jdbcType=VARCHAR}-->
<!-- </if>-->
<!-- <if test="leadsEndTime != null">-->
<!-- and pool.added_at <= #{leadsEndTime,jdbcType=VARCHAR}-->
<!-- </if>-->
order by pool.added_at desc
</select>
<select id="findIsAssignLeads" resultType="com.yd.api.agms.vo.statistics.LeadsStatisticsInfo">
SELECT
assign.id as assignId, -- 派遣id
assign.customer_id as leadsCustomerId, -- 商机id
assign.assigned_practitioner_id as practitionerId, -- 经纪人id
expertAssign.expert_practitioner_id as smePractitionerId, -- 专家经纪人id
date_format(expertAssign.created_at , '%Y-%m-%d %H:%i:%s') as assignSMEDate, -- 专家派遣时间
date_format(assign.created_at , '%Y-%m-%d %H:%i:%s') as leadsAssignTime, -- 商机派遣时间
date_format(request.created_at , '%Y-%m-%d %H:%i:%s') as requestSMEDate, -- 专家请求时间
assign.FYC as predictFYP, -- 预计FYP
assign.FYP as predictFYC, -- 预计FYC
assign.pieces as predictPieces, -- 预计件数
date_format(assign.time_to_close , '%Y-%m-%d %H:%i:%s') as dealTime -- 预计成交时间
FROM ag_mkt_leads_assigneds assign left join ag_mkt_leads_expert_request request on request.leads_assigned_id = assign.id
left join ag_mkt_leads_expert_assign expertAssign on request.id = expertAssign.leads_expert_request_id
</select>
<select id="findLeadsStatusMap" resultType="com.yd.dal.entity.leads.LeadsStatusInfo">
SELECT maxt.customer_id as leadsCustomerId,
# tr.leads_assigned_id as assignId,
tr.md_drop_option_id as leadsStatusId -- 商机状态id
FROM(SELECT customer_id,max(updated_at) as track_time FROM ag_mkt_leads_assigned_track tr GROUP BY tr.customer_id) maxt
INNER JOIN ag_mkt_leads_assigned_track tr on maxt.customer_id=tr.customer_id AND maxt.track_time = tr.updated_at order by tr.leads_assigned_id
</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.meta.MdCityMapper">
<resultMap id="BaseResultMap" type="com.yd.dal.entity.meta.MdCity">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="province_id" jdbcType="BIGINT" property="provinceId" />
<result column="product_id" jdbcType="BIGINT" property="productId" />
<result column="city_name" jdbcType="VARCHAR" property="cityName" />
<result column="city_name_en" jdbcType="VARCHAR" property="cityNameEn" />
<result column="city_code" jdbcType="VARCHAR" property="cityCode" />
<result column="city_line" jdbcType="VARCHAR" property="cityLine" />
<result column="global_code" jdbcType="VARCHAR" property="globalCode" />
<result column="zip_code" jdbcType="VARCHAR" property="zipCode" />
<result column="is_active" jdbcType="INTEGER" property="isActive" />
<result column="insurer_id" jdbcType="BIGINT" property="insurerId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="created_by" jdbcType="BIGINT" property="createdBy" />
</resultMap>
<sql id="Base_Column_List">
id, province_id, product_id, city_name, city_name_en, city_code, city_line, global_code,
zip_code, is_active, insurer_id, created_at, created_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_md_city
where id = #{id,jdbcType=BIGINT}
</select>
<select id="findByInsurerId" resultType="com.yd.dal.entity.meta.MdCity">
select
<include refid="Base_Column_List" />
from ag_md_city
where insurer_id = #{insurerId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ag_md_city
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.meta.MdCity" useGeneratedKeys="true">
insert into ag_md_city (province_id, product_id, city_name,
city_name_en, city_code, city_line,
global_code, zip_code, is_active,
insurer_id, created_at, created_by
)
values (#{provinceId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT}, #{cityName,jdbcType=VARCHAR},
#{cityNameEn,jdbcType=VARCHAR}, #{cityCode,jdbcType=VARCHAR}, #{cityLine,jdbcType=VARCHAR},
#{globalCode,jdbcType=VARCHAR}, #{zipCode,jdbcType=VARCHAR}, #{isActive,jdbcType=INTEGER},
#{insurerId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.meta.MdCity" useGeneratedKeys="true">
insert into ag_md_city
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="provinceId != null">
province_id,
</if>
<if test="productId != null">
product_id,
</if>
<if test="cityName != null">
city_name,
</if>
<if test="cityNameEn != null">
city_name_en,
</if>
<if test="cityCode != null">
city_code,
</if>
<if test="cityLine != null">
city_line,
</if>
<if test="globalCode != null">
global_code,
</if>
<if test="zipCode != null">
zip_code,
</if>
<if test="isActive != null">
is_active,
</if>
<if test="insurerId != null">
insurer_id,
</if>
<if test="createdAt != null">
created_at,
</if>
<if test="createdBy != null">
created_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="provinceId != null">
#{provinceId,jdbcType=BIGINT},
</if>
<if test="productId != null">
#{productId,jdbcType=BIGINT},
</if>
<if test="cityName != null">
#{cityName,jdbcType=VARCHAR},
</if>
<if test="cityNameEn != null">
#{cityNameEn,jdbcType=VARCHAR},
</if>
<if test="cityCode != null">
#{cityCode,jdbcType=VARCHAR},
</if>
<if test="cityLine != null">
#{cityLine,jdbcType=VARCHAR},
</if>
<if test="globalCode != null">
#{globalCode,jdbcType=VARCHAR},
</if>
<if test="zipCode != null">
#{zipCode,jdbcType=VARCHAR},
</if>
<if test="isActive != null">
#{isActive,jdbcType=INTEGER},
</if>
<if test="insurerId != null">
#{insurerId,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=BIGINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.meta.MdCity">
update ag_md_city
<set>
<if test="provinceId != null">
province_id = #{provinceId,jdbcType=BIGINT},
</if>
<if test="productId != null">
product_id = #{productId,jdbcType=BIGINT},
</if>
<if test="cityName != null">
city_name = #{cityName,jdbcType=VARCHAR},
</if>
<if test="cityNameEn != null">
city_name_en = #{cityNameEn,jdbcType=VARCHAR},
</if>
<if test="cityCode != null">
city_code = #{cityCode,jdbcType=VARCHAR},
</if>
<if test="cityLine != null">
city_line = #{cityLine,jdbcType=VARCHAR},
</if>
<if test="globalCode != null">
global_code = #{globalCode,jdbcType=VARCHAR},
</if>
<if test="zipCode != null">
zip_code = #{zipCode,jdbcType=VARCHAR},
</if>
<if test="isActive != null">
is_active = #{isActive,jdbcType=INTEGER},
</if>
<if test="insurerId != null">
insurer_id = #{insurerId,jdbcType=BIGINT},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.meta.MdCity">
update ag_md_city
set province_id = #{provinceId,jdbcType=BIGINT},
product_id = #{productId,jdbcType=BIGINT},
city_name = #{cityName,jdbcType=VARCHAR},
city_name_en = #{cityNameEn,jdbcType=VARCHAR},
city_code = #{cityCode,jdbcType=VARCHAR},
city_line = #{cityLine,jdbcType=VARCHAR},
global_code = #{globalCode,jdbcType=VARCHAR},
zip_code = #{zipCode,jdbcType=VARCHAR},
is_active = #{isActive,jdbcType=INTEGER},
insurer_id = #{insurerId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
created_by = #{createdBy,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
......@@ -335,4 +335,22 @@
t.SPC_TEL_NUM as contactNo
from spc001 t where t.SPC_CANCEL = 0;
</select>
<select id="findByDropMasterCodes" resultType="com.yd.dal.entity.meta.MdDropOptions">
select
o.id id,
o.drop_master_id dropMasterId,
o.drop_option_name dropOptionName,
o.drop_option_code dropOptionCode,
o.drop_option_order dropOptionOrder,
o.drop_option_score dropOptionScore,
o.drop_option_remark dropOptionRemark,
o.is_active isActive,
o.created_at createdAt,
o.created_by createdBy
from ag_md_drop_master m left join ag_md_drop_options o on m.id = o.drop_master_id and o.is_active = 1
where m.scenario_code in
<foreach collection="masterCodeList" index="index" item="item" open="(" separator="," close=")">
#{item}
</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