线索延期;线索记录;线索更新;延期审核;线索跟进
This commit is contained in:
parent
32ab3e1782
commit
28759c5d68
@ -0,0 +1,16 @@
|
||||
package com.cpop.api.tencent.location.core.constant;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-21 9:28
|
||||
*/
|
||||
public interface TencentApiUrl {
|
||||
|
||||
String BASE_URL = "https://apis.map.qq.com";
|
||||
|
||||
/**
|
||||
* 腾讯逆地址编码
|
||||
*/
|
||||
String GEOCODER = "/ws/geocoder/v1/";
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.cpop.api.tencent.location.handler;
|
||||
|
||||
import cn.hutool.crypto.digest.MD5;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.api.tencent.location.core.constant.TencentApiUrl;
|
||||
import com.cpop.common.utils.http.HttpUtils;
|
||||
import com.cpop.core.base.exception.UtilException;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 腾讯位置服务工具类
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-21 9:26
|
||||
*/
|
||||
@Component
|
||||
public class TencentLocationHandler {
|
||||
|
||||
/**
|
||||
* 根据经纬度获取位置信息
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @param key 密钥
|
||||
*/
|
||||
public JSONObject geocoder(String longitude, String latitude, String key) {
|
||||
String url = TencentApiUrl.GEOCODER + "?key=" + key + "&location=" + latitude + "," + longitude;
|
||||
RestTemplate restTemplate = SpringUtils.getBean(RestTemplate.class);
|
||||
return restTemplate.getForObject(TencentApiUrl.BASE_URL + url, JSONObject.class);
|
||||
}
|
||||
}
|
||||
@ -68,6 +68,10 @@ public class PageDomain {
|
||||
return isAsc;
|
||||
}
|
||||
|
||||
public Boolean getBoolAsc() {
|
||||
return StringUtils.equals(isAsc, "asc");
|
||||
}
|
||||
|
||||
public void setIsAsc(String isAsc) {
|
||||
if (StringUtils.isNotEmpty(isAsc)) {
|
||||
// 兼容前端排序类型
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.cpop.oam.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.api.tencent.location.handler.TencentLocationHandler;
|
||||
import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler;
|
||||
import com.cpop.core.utils.RsaUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
@ -52,4 +54,10 @@ public class CpopApiTests {
|
||||
public void getSecurityKeyTest(){
|
||||
SpringUtils.getBean(EcppHandler.class).getSecurityKey();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTencentLocationApi() {
|
||||
JSONObject geocoder = SpringUtils.getBean(TencentLocationHandler.class).geocoder("114.4246835", "23.12707132", "UGLBZ-LBF3I-ETCGO-UUH5X-QDV45-3LFKA");
|
||||
System.out.println(geocoder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.cpop.oam.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.api.tencent.location.handler.TencentLocationHandler;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.mybatisflex.core.row.Db;
|
||||
import com.mybatisflex.core.row.Row;
|
||||
import com.mybatisflex.core.row.RowKey;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-21 14:44
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class CpopClueTests {
|
||||
|
||||
@Test
|
||||
public void insertClue() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
//添加线索以及
|
||||
Row clue = Row.ofKey(RowKey.SNOW_FLAKE_ID);
|
||||
clue.set("store_id","81892317270687744");
|
||||
//校区城市
|
||||
JSONObject geocoder = SpringUtils.getBean(TencentLocationHandler.class).geocoder("113.93041", "22.53332", "UGLBZ-LBF3I-ETCGO-UUH5X-QDV45-3LFKA");
|
||||
if (geocoder.getInteger("status") == 0){
|
||||
clue.set("city",geocoder.getJSONObject("result").getJSONObject("ad_info").getString("city"));
|
||||
}
|
||||
clue.set("clue_status",0);
|
||||
clue.set("create_time", now);
|
||||
clue.set("update_time", now);
|
||||
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
|
||||
clue.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
clue.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
Db.insert("cp_oam_clue",clue);
|
||||
//录入记录
|
||||
Row clueRecord = Row.ofKey(RowKey.SNOW_FLAKE_ID);
|
||||
clueRecord.set("clue_id",clue.getString("id"));
|
||||
clueRecord.set("record_type",0);
|
||||
clueRecord.set("record_content", "机构负责人" + "测试" + "创建线索");
|
||||
clueRecord.set("record_staff_id", "1");
|
||||
clueRecord.set("create_time", now);
|
||||
clueRecord.set("update_time", now);
|
||||
clueRecord.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
clueRecord.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
Db.insert("cp_oam_clue_record",clueRecord);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.cpop.oam.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.pay.framewok.handler.wxPay.WxPayHandler;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.mybatisflex.core.datasource.DataSourceKey;
|
||||
import com.mybatisflex.core.row.Db;
|
||||
import com.mybatisflex.core.row.DbChain;
|
||||
import com.mybatisflex.core.row.Row;
|
||||
import com.mybatisflex.core.row.RowKey;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 11:29
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@ActiveProfiles(profiles = {"prod","core","pay"})
|
||||
public class CpopEasyLearnDataAnalyseTest{
|
||||
|
||||
@Autowired
|
||||
private WxPayHandler wxPayHandler;
|
||||
|
||||
/**
|
||||
* 查询先学后付数据
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
*/
|
||||
@Test
|
||||
public void insertLearnNowPayLaterData() throws WxPayException {
|
||||
try {
|
||||
//查询旧表
|
||||
DataSourceKey.use("jambox");
|
||||
List<Row> list = DbChain.table("j_wx_pay_profit_sharing")
|
||||
.select("sub_mch_id")
|
||||
.select("transaction_id")
|
||||
.select("rate")
|
||||
.select("total_amount")
|
||||
.select("sharing_amount")
|
||||
.select("out_order_no")
|
||||
.select("create_time")
|
||||
.from("j_wx_pay_profit_sharing")
|
||||
.where("create_time >= ?", "2024-01-01 00:00:00")
|
||||
.list();
|
||||
List<Row> insertList = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService(null, item.getString("subMchId"));
|
||||
try {
|
||||
WxPayOrderQueryResult wxPayOrderQueryResult = wxPayService.queryOrder(item.getString("transactionId"), null);
|
||||
String[] split = wxPayOrderQueryResult.getAttach().split("\\|");
|
||||
if (split.length > 1) {
|
||||
Row row = Row.ofKey(RowKey.AUTO);
|
||||
row.set("amount",item.getInt("totalAmount"));
|
||||
row.set("create_time",item.getLocalDateTime("createTime"));
|
||||
row.set("rate",item.getDouble("rate"));
|
||||
row.set("sharing_amount",item.getInt("sharingAmount"));
|
||||
row.set("sharing_order_id",item.getString("outOrderNo"));
|
||||
row.set("transaction_id",item.getString("transactionId"));
|
||||
row.set("detail_order_id",split[2]);
|
||||
insertList.add(row);
|
||||
}
|
||||
} catch (WxPayException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
Db.insertBatch("data_analyse",insertList);
|
||||
} finally {
|
||||
DataSourceKey.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ public class CpopEasyLearnTest {
|
||||
@Test
|
||||
public void queryServiceOrder() throws WxPayException {
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService();
|
||||
WxPartnerPayScoreResult wxPartnerPayScoreResult = wxPayService.getPartnerPayScoreService().queryServiceOrder("00003053000000169450961228104460", "1661323640", "1759141081982881793", null);
|
||||
WxPartnerPayScoreResult wxPartnerPayScoreResult = wxPayService.getPartnerPayScoreService().queryServiceOrder("00003053000000169450961228104460", "1650816616", "1000000000202310231164117852485", null);
|
||||
System.out.println(JSONObject.toJSONString(wxPartnerPayScoreResult));
|
||||
}
|
||||
|
||||
@ -316,10 +316,10 @@ public class CpopEasyLearnTest {
|
||||
|
||||
@Test
|
||||
public void getWxPayPlan() {
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService(null,"1618925571");
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService(null,"1650816616");
|
||||
PartnerUserSignPlanEntity result = null;
|
||||
try {
|
||||
result = wxPayService.getPartnerPayScoreSignPlanService().queryUserSignPlans("1759141081982881794", "1618925571");
|
||||
result = wxPayService.getPartnerPayScoreSignPlanService().queryUserSignPlans("1716417300529303582", "1650816616");
|
||||
System.out.println(JSONObject.toJSONString(result));
|
||||
} catch (WxPayException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -328,8 +328,8 @@ public class CpopEasyLearnTest {
|
||||
|
||||
@Test
|
||||
public void queryOrder() throws WxPayException {
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService(null, "1618925571");
|
||||
WxPayOrderQueryResult wxPayOrderQueryResult = wxPayService.queryOrder("4200002123202402194880609914",null);
|
||||
WxPayService wxPayService = wxPayHandler.getWxPayService(null, "1661323640");
|
||||
WxPayOrderQueryResult wxPayOrderQueryResult = wxPayService.queryOrder("4200002111202401103536519415",null);
|
||||
System.out.println(JSONObject.toJSONString(wxPayOrderQueryResult));
|
||||
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ import static com.cpop.system.business.entity.table.WxPayScoreTableDef.WX_PAY_SC
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@ActiveProfiles(profiles = {"dev","core","pay"})
|
||||
@ActiveProfiles(profiles = {"prod","core","pay"})
|
||||
public class CpopOldDataSyncTests {
|
||||
|
||||
@Autowired
|
||||
@ -175,6 +175,7 @@ public class CpopOldDataSyncTests {
|
||||
.and("jct.pay_status = 'PAY'")
|
||||
.and("jct.deleted = 1")
|
||||
.and("jct.card_no is not null")
|
||||
.and("jct.creation_time >= ?", LocalDateTime.of(2024, 1, 12, 16, 42))
|
||||
.list();
|
||||
} finally {
|
||||
DataSourceKey.clear();
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.cpop.oam.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 15:22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "线索跟进请求对象")
|
||||
public class ClueFollowUpBo {
|
||||
|
||||
/**
|
||||
* 线索id
|
||||
*/
|
||||
@NotBlank(message = "线索id不能为空")
|
||||
@ApiModelProperty(value = "线索id",required = true)
|
||||
private String clueId;
|
||||
|
||||
/**
|
||||
* 记录内容
|
||||
*/
|
||||
@NotBlank(message = "记录内容不能为空")
|
||||
@ApiModelProperty(value = "记录内容",required = true)
|
||||
private String recordContent;
|
||||
|
||||
/**
|
||||
* 记录文件地址
|
||||
*/
|
||||
@ApiModelProperty(value = "记录文件地址")
|
||||
private String recordFileUrl;
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.cpop.oam.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.sql.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 16:11
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "校区延期请求对象")
|
||||
public class CluePutOffBo {
|
||||
|
||||
/**
|
||||
* 线索id
|
||||
*/
|
||||
@NotBlank(message = "线索id不能为空")
|
||||
@ApiModelProperty(value = "线索id",required = true)
|
||||
private String clueId;
|
||||
|
||||
/**
|
||||
* 延期原因
|
||||
*/
|
||||
@NotBlank(message = "延期原因不能为空")
|
||||
@ApiModelProperty(value = "延期原因",required = true)
|
||||
private String putOffReason;
|
||||
|
||||
/**
|
||||
* 延期文件路径
|
||||
*/
|
||||
@NotBlank(message = "延期文件路径不能为空")
|
||||
@ApiModelProperty(value = "延期文件路径",required = true)
|
||||
private String putOffFileUrl;
|
||||
|
||||
/**
|
||||
* 延期到期日期
|
||||
*/
|
||||
@NotNull(message = "不能为空")
|
||||
@ApiModelProperty(value = "延期到期日期",required = true)
|
||||
private LocalDate putOffDate;
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.cpop.oam.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 15:47
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "线索更新请求对象")
|
||||
public class ClueUpdateBo {
|
||||
|
||||
/**
|
||||
* 线索id
|
||||
*/
|
||||
@NotBlank(message = "线索id不能为空")
|
||||
@ApiModelProperty(value = "线索id",required = true)
|
||||
private String clueId;
|
||||
|
||||
/**
|
||||
* 新校区名
|
||||
*/
|
||||
@NotBlank(message = "校区名不能为空")
|
||||
@ApiModelProperty(value = "校区名",required = true)
|
||||
private String newStoreName;
|
||||
|
||||
/**
|
||||
* 新负责人
|
||||
*/
|
||||
@NotBlank(message = "负责人不能为空")
|
||||
@ApiModelProperty(value = "负责人",required = true)
|
||||
private String newPersonCharge;
|
||||
|
||||
/**
|
||||
* 新手机号
|
||||
*/
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@ApiModelProperty(value = "手机号",required = true)
|
||||
private String newPhone;
|
||||
|
||||
|
||||
/**
|
||||
* 新校区地址
|
||||
*/
|
||||
@NotBlank(message = "校区地址不能为空")
|
||||
@ApiModelProperty(value = "校区地址",required = true)
|
||||
private String newStoreAddr;
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.cpop.oam.business.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-21 14:09
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "延期审核请求对象")
|
||||
public class PutOffAuditBo {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotBlank(message = "主键不能为空")
|
||||
@ApiModelProperty(value = "主键",required = true)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 审核结果
|
||||
*/
|
||||
@NotNull(message = "审核结果不能为空")
|
||||
@ApiModelProperty(value = "审核结果",required = true)
|
||||
private Boolean auditResult;
|
||||
}
|
||||
@ -1,8 +1,15 @@
|
||||
package com.cpop.oam.business.controller.backstage;
|
||||
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.oam.business.vo.SignGoalPageVo;
|
||||
import com.cpop.oam.business.bo.ClueFollowUpBo;
|
||||
import com.cpop.oam.business.bo.CluePutOffBo;
|
||||
import com.cpop.oam.business.bo.ClueUpdateBo;
|
||||
import com.cpop.oam.business.bo.DeptBo;
|
||||
import com.cpop.oam.business.service.ClueRecordService;
|
||||
import com.cpop.oam.business.vo.*;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.cpop.oam.business.entity.Clue;
|
||||
@ -13,6 +20,9 @@ import io.swagger.annotations.ApiParam;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD;
|
||||
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
|
||||
|
||||
/**
|
||||
* 线索表 控制层。
|
||||
*
|
||||
@ -27,6 +37,9 @@ public class BackstageClueController {
|
||||
@Autowired
|
||||
private ClueService clueService;
|
||||
|
||||
@Autowired
|
||||
private ClueRecordService clueRecordService;
|
||||
|
||||
/**
|
||||
* 个人线索分页
|
||||
* @author DB
|
||||
@ -35,14 +48,211 @@ public class BackstageClueController {
|
||||
*/
|
||||
@ApiOperation("个人线索分页")
|
||||
@GetMapping("/getPersonCluePage")
|
||||
public R<Page<SignGoalPageVo>> getPersonCluePage(@ApiParam(value = "地区") @RequestParam(value = "city", required = false) String city,
|
||||
public R<Page<CluePageVo>> getPersonCluePage(@ApiParam(value = "线索状态") @RequestParam(value = "clueStatus", required = false) Integer clueStatus,
|
||||
@ApiParam(value = "地区") @RequestParam(value = "city", required = false) String city,
|
||||
@ApiParam(value = "品牌") @RequestParam(value = "brandId", required = false) String brandId,
|
||||
@ApiParam(value = "校区") @RequestParam(value = "storeId", required = false) String storeId,
|
||||
@ApiParam(value = "负责人或手机号") @RequestParam(value = "chargeOrPhone", required = false) String chargeOrPhone,
|
||||
@ApiParam(value = "员工id") @RequestParam(value = "staffId", required = false) String staffId,
|
||||
@ApiParam(value = "签约月份") @RequestParam(value = "signMonth", required = false) String signMonth) {
|
||||
Page<SignGoalPageVo> pageVo = clueService.getPersonCluePage(city, brandId, storeId, chargeOrPhone, staffId, signMonth);
|
||||
@ApiParam(value = "员工id") @RequestParam(value = "staffId", required = false) String staffId) {
|
||||
Page<CluePageVo> pageVo = clueService.getPersonCluePage(clueStatus, city, brandId, storeId, chargeOrPhone, staffId);
|
||||
return R.ok(pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人签约目标
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param signMonth 签约月份
|
||||
* @return R<PersonSignGoalVo>
|
||||
*/
|
||||
@ApiOperation("获取个人签约目标")
|
||||
@GetMapping("/getPersonSignGoal")
|
||||
public R<PersonSignGoalVo> getPersonSignGoal(@ApiParam(value = "签约月份") @RequestParam(value = "signMonth", required = false) String signMonth,
|
||||
@ApiParam(value = "员工id") @RequestParam(value = "staffId", required = false) String staffId) {
|
||||
PersonSignGoalVo vo = clueService.getPersonSignGoal(signMonth, staffId);
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索跟进
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param bo 请求对象
|
||||
* @return R<Void>
|
||||
*/
|
||||
@ApiOperation("线索跟进")
|
||||
@PostMapping("/clueFollowUp")
|
||||
public R<Void> clueFollowUp(@Validated @RequestBody ClueFollowUpBo bo) {
|
||||
clueService.clueFollowUp(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索跟进记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return R<List<ClueFollowUpRecordVo>>
|
||||
*/
|
||||
@ApiOperation("线索跟进记录")
|
||||
@GetMapping("/getClueFollowUpRecord")
|
||||
public R<List<ClueFollowUpRecordVo>> getClueFollowUpRecord(@ApiParam(value = "线索id") @RequestParam(value = "clueId") String clueId) {
|
||||
List<ClueFollowUpRecordVo> vos = clueRecordService.listAs(QueryWrapper.create()
|
||||
.select(CLUE_RECORD.CREATE_TIME,CLUE_RECORD.RECORD_CONTENT,CLUE_RECORD.RECORD_FILE_URL)
|
||||
.select(STAFF.NAME.as(ClueFollowUpRecordVo::getStaffName))
|
||||
.leftJoin(STAFF).on(STAFF.ID.eq(CLUE_RECORD.RECORD_STAFF_ID))
|
||||
.where(CLUE_RECORD.RECORD_TYPE.eq(2)
|
||||
.and(CLUE_RECORD.CLUE_ID.eq(clueId))),
|
||||
ClueFollowUpRecordVo.class);
|
||||
return R.ok(vos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return R<List<ClueRecordVo>>
|
||||
*/
|
||||
@ApiOperation("线索记录")
|
||||
@GetMapping("/getClueRecordList")
|
||||
public R<List<ClueRecordVo>> getClueRecordList(@ApiParam(value = "线索id") @RequestParam(value = "clueId") String clueId) {
|
||||
List<ClueRecordVo> vos = clueRecordService.listAs(QueryWrapper.create()
|
||||
.select(CLUE_RECORD.CREATE_TIME, CLUE_RECORD.RECORD_CONTENT)
|
||||
.and(CLUE_RECORD.CLUE_ID.eq(clueId)),
|
||||
ClueRecordVo.class);
|
||||
return R.ok(vos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索更新
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param bo 请求对象
|
||||
* @return R<Void>
|
||||
*/
|
||||
@ApiOperation("线索更新")
|
||||
@PostMapping("/clueUpdate")
|
||||
public R<Void> clueUpdate(@Validated @RequestBody ClueUpdateBo bo) {
|
||||
clueService.clueUpdate(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索更新记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return R<List<ClueFollowUpRecordVo>>
|
||||
*/
|
||||
@ApiOperation("线索更新记录")
|
||||
@GetMapping("/getClueUpdateRecord")
|
||||
public R<ClueUpdateVo> getClueUpdateRecord(@ApiParam(value = "线索id") @RequestParam(value = "clueId") String clueId) {
|
||||
ClueUpdateVo vo = clueService.getClueUpdateRecord(clueId);
|
||||
return R.ok(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索延期
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param bo 请求对象
|
||||
* @return R<Void>
|
||||
*/
|
||||
@ApiOperation("线索延期")
|
||||
@PostMapping("/cluePutOff")
|
||||
public R<Void> cluePutOff(@Validated @RequestBody CluePutOffBo bo) {
|
||||
clueService.cluePutOff(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索延期记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return R<List<CluePutOffVo>>
|
||||
*/
|
||||
@ApiOperation("线索延期记录")
|
||||
@GetMapping("/getCluePutOffRecord")
|
||||
public R<List<CluePutOffVo>> getCluePutOffRecord(@ApiParam(value = "线索id") @RequestParam(value = "clueId") String clueId) {
|
||||
List<CluePutOffVo> vos = clueService.getCluePutOffRecord(clueId);
|
||||
return R.ok(vos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索脱离
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param id 线索id
|
||||
* @return R<Void>
|
||||
*/
|
||||
@ApiOperation("线索脱离")
|
||||
@PutMapping("/clueDetachment/{id}")
|
||||
public R<Void> clueDetachment(@PathVariable @ApiParam(value = "线索id") String id) {
|
||||
clueService.clueDetachment(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 地区线索分页
|
||||
* @author DB
|
||||
* @since 2024/2/19
|
||||
* @return R<Page<SignGoalPageVo>>
|
||||
*/
|
||||
@ApiOperation("地区线索分页")
|
||||
@GetMapping("/getAreaCluePage")
|
||||
public R<Page<CluePageVo>> getAreaCluePage(@ApiParam(value = "地区") @RequestParam(value = "city", required = false) String city,
|
||||
@ApiParam(value = "品牌") @RequestParam(value = "brandId", required = false) String brandId,
|
||||
@ApiParam(value = "校区") @RequestParam(value = "storeId", required = false) String storeId,
|
||||
@ApiParam(value = "负责人或手机号") @RequestParam(value = "chargeOrPhone", required = false) String chargeOrPhone) {
|
||||
Page<CluePageVo> pageVo = clueService.getAreaCluePage( city, brandId, storeId, chargeOrPhone);
|
||||
return R.ok(pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共线索分页
|
||||
* @author DB
|
||||
* @since 2024/2/19
|
||||
* @return R<Page<SignGoalPageVo>>
|
||||
*/
|
||||
@ApiOperation("公共线索分页")
|
||||
@GetMapping("/getPublicCluePage")
|
||||
public R<Page<CluePageVo>> getPublicCluePage(@ApiParam(value = "地区") @RequestParam(value = "city", required = false) String city,
|
||||
@ApiParam(value = "品牌") @RequestParam(value = "brandId", required = false) String brandId,
|
||||
@ApiParam(value = "校区") @RequestParam(value = "storeId", required = false) String storeId,
|
||||
@ApiParam(value = "负责人或手机号") @RequestParam(value = "chargeOrPhone", required = false) String chargeOrPhone) {
|
||||
Page<CluePageVo> pageVo = clueService.getPublicCluePage( city, brandId, storeId, chargeOrPhone);
|
||||
return R.ok(pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索领取
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param id 线索id
|
||||
* @return R<Void>
|
||||
*/
|
||||
@ApiOperation("线索领取")
|
||||
@PutMapping("/clueCollection/{id}")
|
||||
public R<Void> clueCollection(@PathVariable @ApiParam(value = "线索id") String id) {
|
||||
clueService.clueCollection(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的开发分页
|
||||
* @author DB
|
||||
* @since 2024/2/19
|
||||
* @return R<Page<SignGoalPageVo>>
|
||||
*/
|
||||
@ApiOperation("我的开发分页")
|
||||
@GetMapping("/getMyDevCluePage")
|
||||
public R<Page<CluePageVo>> getMyDevCluePage(@ApiParam(value = "地区") @RequestParam(value = "city", required = false) String city,
|
||||
@ApiParam(value = "品牌") @RequestParam(value = "brandId", required = false) String brandId,
|
||||
@ApiParam(value = "校区") @RequestParam(value = "storeId", required = false) String storeId,
|
||||
@ApiParam(value = "负责人或手机号") @RequestParam(value = "chargeOrPhone", required = false) String chargeOrPhone) {
|
||||
Page<CluePageVo> pageVo = clueService.getMyDevCluePage( city, brandId, storeId, chargeOrPhone);
|
||||
return R.ok(pageVo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package com.cpop.oam.business.controller.backstage;
|
||||
|
||||
import com.cpop.core.base.R;
|
||||
import com.cpop.oam.business.bo.PutOffAuditBo;
|
||||
import com.cpop.oam.business.service.CluePutOffService;
|
||||
import com.cpop.oam.business.service.ClueRecordService;
|
||||
import com.cpop.oam.business.vo.CluePageVo;
|
||||
import com.cpop.oam.business.vo.PutOffAuditPageVo;
|
||||
import com.cpop.system.business.service.StoreRenewService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-21 13:40
|
||||
*/
|
||||
@Api(tags = "延期审核接口")
|
||||
@RestController
|
||||
@RequestMapping("/backstage/putOff")
|
||||
public class BackstagePutOffController {
|
||||
|
||||
@Autowired
|
||||
private CluePutOffService cluePutOffService;
|
||||
|
||||
/**
|
||||
* 延期审核分页
|
||||
* @author DB
|
||||
* @since 2024/2/19
|
||||
* @return R<Page<SignGoalPageVo>>
|
||||
*/
|
||||
@ApiOperation("延期审核分页")
|
||||
@GetMapping("/getPutOffAuditPage")
|
||||
public R<Page<PutOffAuditPageVo>> getPutOffAuditPage() {
|
||||
Page<PutOffAuditPageVo> pageVo = cluePutOffService.getPutOffAuditPage();
|
||||
return R.ok(pageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 延期审核选择
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param bo 通过与驳回
|
||||
* @return R<Void>
|
||||
*/
|
||||
@ApiOperation("延期审核选择")
|
||||
@PutMapping("/putOffAuditSelect")
|
||||
public R<Void> putOffAuditSelect(@RequestBody @Validated PutOffAuditBo bo) {
|
||||
cluePutOffService.putOffAuditSelect(bo);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@ -69,9 +69,10 @@ public class Clue extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private LocalDateTime receiptTime;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 签约状态(0:待签约;1:已签约;2:警告线索)
|
||||
*/
|
||||
private Integer clueStatus;
|
||||
|
||||
/**
|
||||
* 是否删除(0否1是)
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.cpop.oam.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 校区延期表 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_oam_clue_put_off", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class CluePutOff extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 线索id
|
||||
*/
|
||||
private String clueId;
|
||||
|
||||
/**
|
||||
* 延期原因
|
||||
*/
|
||||
private String putOffReason;
|
||||
|
||||
/**
|
||||
* 延期文件路径
|
||||
*/
|
||||
private String putOffFileUrl;
|
||||
|
||||
/**
|
||||
* 延期到期日期
|
||||
*/
|
||||
private LocalDate putOffDate;
|
||||
|
||||
/**
|
||||
* 审核状态(0:待审核,1:审核通过,2:审核不通过)
|
||||
*/
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 延迟员工id
|
||||
*/
|
||||
private String putOffStaffId;
|
||||
|
||||
/**
|
||||
* 审核员工id
|
||||
*/
|
||||
private String auditStaffId;
|
||||
|
||||
/**
|
||||
* 是否删除(0否1是)
|
||||
*/
|
||||
@Column(isLogicDelete = true)
|
||||
private Boolean isDelete;
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.cpop.oam.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 线索记录表 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_oam_clue_record", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class ClueRecord extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 线索id
|
||||
*/
|
||||
private String clueId;
|
||||
|
||||
/**
|
||||
* 记录类型(0:创建;1:领取;2:跟进;3:转交;4:脱离;5:成交;6:更新;7:延期)
|
||||
*/
|
||||
private Integer recordType;
|
||||
|
||||
/**
|
||||
* 记录内容
|
||||
*/
|
||||
private String recordContent;
|
||||
|
||||
/**
|
||||
* 记录文件地址
|
||||
*/
|
||||
private String recordFileUrl;
|
||||
|
||||
/**
|
||||
* 记录员工id
|
||||
*/
|
||||
private String recordStaffId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,86 @@
|
||||
package com.cpop.oam.business.entity;
|
||||
|
||||
import com.cpop.core.base.entity.BaseEntity;
|
||||
import com.cpop.core.base.entity.BaseInsertListener;
|
||||
import com.cpop.core.base.entity.BaseUpdateListener;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 线索更新 实体类。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(value = "cp_oam_clue_update", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false)
|
||||
public class ClueUpdate extends BaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 线索id
|
||||
*/
|
||||
private String clueId;
|
||||
|
||||
/**
|
||||
* 旧校区名
|
||||
*/
|
||||
private String oldStoreName;
|
||||
|
||||
/**
|
||||
* 新校区名
|
||||
*/
|
||||
private String newStoreName;
|
||||
|
||||
/**
|
||||
* 旧负责人
|
||||
*/
|
||||
private String oldPersonCharge;
|
||||
|
||||
/**
|
||||
* 新负责人
|
||||
*/
|
||||
private String newPersonCharge;
|
||||
|
||||
/**
|
||||
* 旧手机号
|
||||
*/
|
||||
private String oldPhone;
|
||||
|
||||
/**
|
||||
* 新手机号
|
||||
*/
|
||||
private String newPhone;
|
||||
|
||||
/**
|
||||
* 旧校区地址
|
||||
*/
|
||||
private String oldStoreAddr;
|
||||
|
||||
/**
|
||||
* 新校区地址
|
||||
*/
|
||||
private String newStoreAddr;
|
||||
|
||||
/**
|
||||
* 更新员工id
|
||||
*/
|
||||
private String updateStaffId;
|
||||
|
||||
}
|
||||
@ -164,10 +164,6 @@ public class SignGoal extends BaseEntity implements Serializable {
|
||||
*/
|
||||
private Integer decFinish;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 逻辑删除(0否1是)
|
||||
*/
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.oam.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.oam.business.entity.CluePutOff;
|
||||
|
||||
/**
|
||||
* 校区延期表 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
public interface CluePutOffMapper extends BaseMapper<CluePutOff> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.oam.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.oam.business.entity.ClueRecord;
|
||||
|
||||
/**
|
||||
* 线索记录表 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
public interface ClueRecordMapper extends BaseMapper<ClueRecord> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.oam.business.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cpop.oam.business.entity.ClueUpdate;
|
||||
|
||||
/**
|
||||
* 线索更新 映射层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
public interface ClueUpdateMapper extends BaseMapper<ClueUpdate> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.cpop.oam.business.service;
|
||||
|
||||
import com.cpop.oam.business.bo.PutOffAuditBo;
|
||||
import com.cpop.oam.business.vo.PutOffAuditPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.oam.business.entity.CluePutOff;
|
||||
|
||||
/**
|
||||
* 校区延期表 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
public interface CluePutOffService extends IService<CluePutOff> {
|
||||
|
||||
/**
|
||||
* 延期审核分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @return Page<PutOffAuditPageVo>
|
||||
*/
|
||||
Page<PutOffAuditPageVo> getPutOffAuditPage();;
|
||||
|
||||
/**
|
||||
* 延期审核选择
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param bo 通过与驳回
|
||||
* @return R<Void>
|
||||
*/
|
||||
void putOffAuditSelect(PutOffAuditBo bo);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.cpop.oam.business.service;
|
||||
|
||||
import com.cpop.oam.business.vo.PutOffAuditPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.oam.business.entity.ClueRecord;
|
||||
|
||||
/**
|
||||
* 线索记录表 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
public interface ClueRecordService extends IService<ClueRecord> {
|
||||
|
||||
}
|
||||
@ -1,10 +1,15 @@
|
||||
package com.cpop.oam.business.service;
|
||||
|
||||
import com.cpop.oam.business.vo.SignGoalPageVo;
|
||||
import com.cpop.oam.business.bo.ClueFollowUpBo;
|
||||
import com.cpop.oam.business.bo.CluePutOffBo;
|
||||
import com.cpop.oam.business.bo.ClueUpdateBo;
|
||||
import com.cpop.oam.business.vo.*;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.oam.business.entity.Clue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 线索表 服务层。
|
||||
*
|
||||
@ -19,5 +24,107 @@ public interface ClueService extends IService<Clue> {
|
||||
* @since 2024/2/19
|
||||
* @return R<Page<SignGoalPageVo>>
|
||||
*/
|
||||
Page<SignGoalPageVo> getPersonCluePage(String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth);
|
||||
Page<CluePageVo> getPersonCluePage(Integer clueStatus, String city, String brandId, String storeId, String chargeOrPhone, String staffId);
|
||||
|
||||
/**
|
||||
* 个人签约目标
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param signMonth 签约月份
|
||||
* @return PersonSignGoalVo
|
||||
*/
|
||||
PersonSignGoalVo getPersonSignGoal(String signMonth,String staffId);
|
||||
|
||||
/**
|
||||
* 线索跟进
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
*/
|
||||
void clueFollowUp(ClueFollowUpBo bo);
|
||||
|
||||
/**
|
||||
* 线索更新
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param bo 请求对象
|
||||
*/
|
||||
void clueUpdate(ClueUpdateBo bo);
|
||||
|
||||
/**
|
||||
* 线索更新记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return ClueUpdateVo
|
||||
*/
|
||||
ClueUpdateVo getClueUpdateRecord(String clueId);
|
||||
|
||||
/**
|
||||
* 线索延期
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param bo 请求对象
|
||||
*/
|
||||
void cluePutOff(CluePutOffBo bo);
|
||||
|
||||
/**
|
||||
* 线索延期记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return R<List<CluePutOffVo>>
|
||||
*/
|
||||
List<CluePutOffVo> getCluePutOffRecord(String clueId);
|
||||
|
||||
/**
|
||||
* 线索脱离
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param id 线索id
|
||||
*/
|
||||
void clueDetachment(String id);
|
||||
|
||||
/**
|
||||
* 地区线索分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param city 城市
|
||||
* @param brandId 品牌id
|
||||
* @param storeId 校区id
|
||||
* @param chargeOrPhone 负责人或手机号
|
||||
* @return Page<CluePageVo>
|
||||
*/
|
||||
Page<CluePageVo> getAreaCluePage( String city, String brandId, String storeId, String chargeOrPhone);
|
||||
|
||||
/**
|
||||
* 公共线索分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param city 城市
|
||||
* @param brandId 品牌id
|
||||
* @param storeId 校区id
|
||||
* @param chargeOrPhone 负责人或手机号
|
||||
* @return Page<CluePageVo>
|
||||
*/
|
||||
Page<CluePageVo> getPublicCluePage(String city, String brandId, String storeId, String chargeOrPhone);
|
||||
|
||||
/**
|
||||
* 线索领取
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param id 线索id
|
||||
*/
|
||||
void clueCollection(String id);
|
||||
|
||||
/**
|
||||
* 我的开发分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param city 城市
|
||||
* @param brandId 品牌id
|
||||
* @param storeId 校区id
|
||||
* @param chargeOrPhone 负责人或手机号
|
||||
* @return Page<CluePageVo>
|
||||
*/
|
||||
Page<CluePageVo> getMyDevCluePage(String city, String brandId, String storeId, String chargeOrPhone);
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.cpop.oam.business.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cpop.oam.business.entity.ClueUpdate;
|
||||
|
||||
/**
|
||||
* 线索更新 服务层。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
public interface ClueUpdateService extends IService<ClueUpdate> {
|
||||
|
||||
}
|
||||
@ -18,13 +18,9 @@ import com.cpop.oam.business.bo.BusinessDistributeBo;
|
||||
import com.cpop.oam.business.bo.BusinessInfoPageBo;
|
||||
import com.cpop.oam.business.bo.BusinessRemoveBo;
|
||||
import com.cpop.oam.business.dto.BusinessDistributeDto;
|
||||
import com.cpop.oam.business.entity.Business;
|
||||
import com.cpop.oam.business.entity.BusinessDetail;
|
||||
import com.cpop.oam.business.entity.BusinessStaff;
|
||||
import com.cpop.oam.business.entity.*;
|
||||
import com.cpop.oam.business.mapper.BusinessMapper;
|
||||
import com.cpop.oam.business.service.BusinessDetailService;
|
||||
import com.cpop.oam.business.service.BusinessService;
|
||||
import com.cpop.oam.business.service.BusinessStaffService;
|
||||
import com.cpop.oam.business.service.*;
|
||||
import com.cpop.oam.business.vo.BusinessInfoPageVo;
|
||||
import com.cpop.oam.business.vo.BusinessPageVo;
|
||||
import com.cpop.oam.business.vo.BusinessUnSignPageVo;
|
||||
@ -46,6 +42,7 @@ import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Month;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -57,6 +54,9 @@ import static com.cpop.jambox.business.entity.table.StoreExtendTableDef.STORE_EX
|
||||
import static com.cpop.oam.business.entity.table.BusinessDetailTableDef.BUSINESS_DETAIL;
|
||||
import static com.cpop.oam.business.entity.table.BusinessStaffTableDef.BUSINESS_STAFF;
|
||||
import static com.cpop.oam.business.entity.table.BusinessTableDef.BUSINESS;
|
||||
import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD;
|
||||
import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE;
|
||||
import static com.cpop.oam.business.entity.table.SignGoalTableDef.SIGN_GOAL;
|
||||
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
|
||||
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
||||
import static com.cpop.system.business.entity.table.StoreLicenseTableDef.STORE_LICENSE;
|
||||
@ -394,6 +394,7 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||
* @param id 主键
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void storeSign(String id) {
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
StoreSign storeSign = new StoreSign();
|
||||
@ -406,5 +407,75 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
|
||||
.set(STORE.HAVE_COUNSELOR,true)
|
||||
.where(STORE.ID.eq(id))
|
||||
.update();
|
||||
//线索归档
|
||||
ClueService clueService = SpringUtils.getBean(ClueService.class);
|
||||
Clue clue = clueService.queryChain().where(CLUE.STORE_ID.eq(id)).one();
|
||||
clue.setClueStatus(1);
|
||||
clueService.updateById(clue);
|
||||
//线索记录
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
clueRecord.setRecordType(5)
|
||||
.setClueId(clue.getId())
|
||||
.setRecordContent("机构签约")
|
||||
.setRecordStaffId(loginUserInfo.getString("id"));
|
||||
SpringUtils.getBean(ClueRecordServiceImpl.class).save(clueRecord);
|
||||
//签约目标更新
|
||||
LocalDate now = LocalDate.now();
|
||||
Month month = now.getMonth();
|
||||
int year = now.getYear();
|
||||
SignGoalService signGoalService = SpringUtils.getBean(SignGoalService.class);
|
||||
SignGoal signGoal = signGoalService.getOne(QueryWrapper.create()
|
||||
.where(SIGN_GOAL.STAFF_ID.eq(loginUserInfo.getString("id")))
|
||||
.and(SIGN_GOAL.YEAR.eq(year)));
|
||||
changeMonthGoal(signGoal,month);
|
||||
signGoalService.updateById(signGoal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加完成目标
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param signGoal 签约目标
|
||||
* @param month 月份
|
||||
*/
|
||||
private void changeMonthGoal(SignGoal signGoal, Month month) {
|
||||
switch (month) {
|
||||
case JANUARY:
|
||||
signGoal.setJanGoal(signGoal.getJanGoal() + 1);
|
||||
break;
|
||||
case FEBRUARY:
|
||||
signGoal.setFebGoal(signGoal.getFebGoal() + 1);
|
||||
break;
|
||||
case MARCH:
|
||||
signGoal.setMarGoal(signGoal.getMarGoal() + 1);
|
||||
break;
|
||||
case APRIL:
|
||||
signGoal.setAprGoal(signGoal.getAprGoal() + 1);
|
||||
break;
|
||||
case MAY:
|
||||
signGoal.setMayGoal(signGoal.getMayGoal() + 1);
|
||||
break;
|
||||
case JUNE:
|
||||
signGoal.setJunGoal(signGoal.getJunGoal() + 1);
|
||||
break;
|
||||
case JULY:
|
||||
signGoal.setJulGoal(signGoal.getJulGoal() + 1);
|
||||
break;
|
||||
case AUGUST:
|
||||
signGoal.setAugGoal(signGoal.getAugGoal() + 1);
|
||||
break;
|
||||
case SEPTEMBER:
|
||||
signGoal.setSepGoal(signGoal.getSepGoal() + 1);
|
||||
break;
|
||||
case OCTOBER:
|
||||
signGoal.setOctGoal(signGoal.getOctGoal() + 1);
|
||||
break;
|
||||
case NOVEMBER:
|
||||
signGoal.setNovGoal(signGoal.getNovGoal() + 1);
|
||||
break;
|
||||
case DECEMBER:
|
||||
signGoal.setDecGoal(signGoal.getDecGoal() + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,115 @@
|
||||
package com.cpop.oam.business.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.oam.business.bo.PutOffAuditBo;
|
||||
import com.cpop.oam.business.entity.Clue;
|
||||
import com.cpop.oam.business.entity.ClueRecord;
|
||||
import com.cpop.oam.business.service.ClueRecordService;
|
||||
import com.cpop.oam.business.service.ClueService;
|
||||
import com.cpop.oam.business.vo.CluePageVo;
|
||||
import com.cpop.oam.business.vo.PutOffAuditPageVo;
|
||||
import com.cpop.oam.business.vo.TaskArchivingPagVo;
|
||||
import com.cpop.system.business.bo.StoreRenewBo;
|
||||
import com.cpop.system.business.service.StoreRenewService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.oam.business.entity.CluePutOff;
|
||||
import com.cpop.oam.business.mapper.CluePutOffMapper;
|
||||
import com.cpop.oam.business.service.CluePutOffService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import static com.cpop.oam.business.entity.table.CluePutOffTableDef.CLUE_PUT_OFF;
|
||||
import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD;
|
||||
import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE;
|
||||
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
|
||||
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
||||
import static com.cpop.system.business.entity.table.StoreSignTableDef.STORE_SIGN;
|
||||
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
|
||||
import static com.mybatisflex.core.query.QueryMethods.dateDiff;
|
||||
import static com.mybatisflex.core.query.QueryMethods.now;
|
||||
|
||||
/**
|
||||
* 校区延期表 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
@Service("cluePutOffService")
|
||||
public class CluePutOffServiceImpl extends ServiceImpl<CluePutOffMapper, CluePutOff> implements CluePutOffService {
|
||||
|
||||
/**
|
||||
* 延期审核分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @return Page<PutOffAuditPageVo>
|
||||
*/
|
||||
@Override
|
||||
public Page<PutOffAuditPageVo> getPutOffAuditPage() {
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()),
|
||||
QueryWrapper.create()
|
||||
.select(CLUE_PUT_OFF.ID,CLUE_PUT_OFF.PUT_OFF_STAFF_ID,CLUE_PUT_OFF.PUT_OFF_REASON,CLUE_PUT_OFF.PUT_OFF_FILE_URL,CLUE_PUT_OFF.CREATE_TIME,CLUE_PUT_OFF.PUT_OFF_DATE)
|
||||
.select(CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.CITY)
|
||||
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
|
||||
.select(BRAND.BRAND_NAME)
|
||||
.select(STORE_SIGN.EXPIRE_DATE)
|
||||
// 跟进间隔
|
||||
.select(dateDiff(now(), CLUE.LAST_FOLLOW_UP_TIME).as(CluePageVo::getFollowUpInterval))
|
||||
// 签约时间
|
||||
.select(dateDiff(now(), CLUE.RECEIPT_TIME).as(CluePageVo::getSignInterval))
|
||||
.from(CLUE_PUT_OFF)
|
||||
.leftJoin(CLUE).on(CLUE.ID.eq(CLUE_PUT_OFF.CLUE_ID))
|
||||
.leftJoin(STORE).on(STORE.ID.eq(CLUE.STORE_ID))
|
||||
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
|
||||
.leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID))
|
||||
.where(CLUE_PUT_OFF.AUDIT_STATUS.eq(0)),
|
||||
PutOffAuditPageVo.class,
|
||||
// 负责人
|
||||
item -> item.field(PutOffAuditPageVo::getPutOffStaffName)
|
||||
.queryWrapper(putOffStaff -> queryChain().select(STAFF.NAME.as(PutOffAuditPageVo::getPutOffStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(putOffStaff.getPutOffStaffId()))));
|
||||
}
|
||||
|
||||
/**
|
||||
* 延期审核选择
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param bo 通过与驳回
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void putOffAuditSelect(PutOffAuditBo bo) {
|
||||
CluePutOff cluePutOff = this.getById(bo.getId());
|
||||
this.updateChain()
|
||||
.set(CLUE_PUT_OFF.AUDIT_STATUS, bo.getAuditResult() ? 1 : 2)
|
||||
.where(CLUE_PUT_OFF.ID.eq(bo.getId()))
|
||||
.update();
|
||||
//添加记录
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
clueRecord.setRecordStaffId(loginUserInfo.getString("id"))
|
||||
.setRecordType(7)
|
||||
.setRecordContent(bo.getAuditResult() ? "延期通过" : "延期拒绝")
|
||||
.setClueId(cluePutOff.getClueId());
|
||||
SpringUtils.getBean(ClueRecordService.class).save(clueRecord);
|
||||
//通过
|
||||
if (bo.getAuditResult()){
|
||||
//校区延期
|
||||
StoreRenewBo storeRenewBo = new StoreRenewBo();
|
||||
Clue clue = SpringUtils.getBean(ClueService.class).getById(cluePutOff.getClueId());
|
||||
storeRenewBo.setStoreId(clue.getStoreId())
|
||||
.setRenewDesc(cluePutOff.getPutOffReason())
|
||||
.setRenewType(1)
|
||||
.setRenewDate(cluePutOff.getPutOffDate())
|
||||
.setAnnexUrl(cluePutOff.getPutOffFileUrl());
|
||||
SpringUtils.getBean(StoreRenewService.class).storeRenew(storeRenewBo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.cpop.oam.business.service.impl;
|
||||
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.oam.business.vo.CluePageVo;
|
||||
import com.cpop.oam.business.vo.PutOffAuditPageVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.oam.business.entity.ClueRecord;
|
||||
import com.cpop.oam.business.mapper.ClueRecordMapper;
|
||||
import com.cpop.oam.business.service.ClueRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD;
|
||||
import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE;
|
||||
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
||||
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
|
||||
import static com.mybatisflex.core.query.QueryMethods.dateDiff;
|
||||
import static com.mybatisflex.core.query.QueryMethods.now;
|
||||
|
||||
/**
|
||||
* 线索记录表 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
@Service("clueRecordService")
|
||||
public class ClueRecordServiceImpl extends ServiceImpl<ClueRecordMapper, ClueRecord> implements ClueRecordService {
|
||||
|
||||
|
||||
}
|
||||
@ -1,12 +1,44 @@
|
||||
package com.cpop.oam.business.service.impl;
|
||||
|
||||
import com.cpop.oam.business.vo.SignGoalPageVo;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
import com.cpop.core.base.exception.ServiceException;
|
||||
import com.cpop.core.utils.SecurityUtils;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.core.utils.sql.SqlUtils;
|
||||
import com.cpop.oam.business.bo.ClueFollowUpBo;
|
||||
import com.cpop.oam.business.bo.CluePutOffBo;
|
||||
import com.cpop.oam.business.bo.ClueUpdateBo;
|
||||
import com.cpop.oam.business.entity.*;
|
||||
import com.cpop.oam.business.mapper.CluePutOffMapper;
|
||||
import com.cpop.oam.business.service.*;
|
||||
import com.cpop.oam.business.vo.*;
|
||||
import com.cpop.system.business.entity.Store;
|
||||
import com.cpop.system.business.service.StoreService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryOrderBy;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.oam.business.entity.Clue;
|
||||
import com.cpop.oam.business.mapper.ClueMapper;
|
||||
import com.cpop.oam.business.service.ClueService;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cpop.oam.business.entity.table.CluePutOffTableDef.CLUE_PUT_OFF;
|
||||
import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE;
|
||||
import static com.cpop.oam.business.entity.table.ClueUpdateTableDef.CLUE_UPDATE;
|
||||
import static com.cpop.oam.business.entity.table.SignAreaTableDef.SIGN_AREA;
|
||||
import static com.cpop.oam.business.entity.table.SignGoalTableDef.SIGN_GOAL;
|
||||
import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF;
|
||||
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
||||
import static com.cpop.system.business.entity.table.StoreTableDef.STORE;
|
||||
import static com.mybatisflex.core.query.QueryMethods.*;
|
||||
|
||||
/**
|
||||
* 线索表 服务层实现。
|
||||
@ -24,7 +56,531 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
|
||||
* @return R<Page<SignGoalPageVo>>
|
||||
*/
|
||||
@Override
|
||||
public Page<SignGoalPageVo> getPersonCluePage(String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth) {
|
||||
public Page<CluePageVo> getPersonCluePage(Integer clueStatus, String city, String brandId, String storeId, String chargeOrPhone, String staffId) {
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
if (clueStatus != null){
|
||||
//待签约
|
||||
if (clueStatus == 0){
|
||||
queryWrapper.and(CLUE.CLUE_STATUS.in(0, 2));
|
||||
} else {
|
||||
queryWrapper.and(CLUE.CLUE_STATUS.eq(clueStatus));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(staffId)) {
|
||||
queryWrapper.and(CLUE.RESPONSIBLE_STAFF_ID.eq(staffId));
|
||||
} else {
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
queryWrapper.and(CLUE.RESPONSIBLE_STAFF_ID.eq(loginUserInfo.getString("id")));
|
||||
}
|
||||
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
|
||||
queryWrapper
|
||||
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID)
|
||||
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
|
||||
.select(BRAND.BRAND_NAME)
|
||||
// 跟进间隔
|
||||
.select(dateDiff(now(), CLUE.LAST_FOLLOW_UP_TIME).as(CluePageVo::getFollowUpInterval))
|
||||
// 签约时间
|
||||
.select(dateDiff(now(), CLUE.RECEIPT_TIME).as(CluePageVo::getSignInterval))
|
||||
.from(CLUE)
|
||||
.leftJoin(STORE).on(STORE.ID.eq(CLUE.STORE_ID))
|
||||
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
|
||||
//地区
|
||||
.and(CLUE.CITY.eq(city))
|
||||
//品牌
|
||||
.and(BRAND.ID.eq(brandId))
|
||||
//校区
|
||||
.and(CLUE.STORE_ID.eq(storeId))
|
||||
.and(STORE.PERSON_CHARGE.likeLeft(chargeOrPhone).or(STORE.PHONE.eq(chargeOrPhone)))
|
||||
.orderBy(changeOrderColumn(pageDomain)),
|
||||
CluePageVo.class,
|
||||
//开发员工
|
||||
item -> item.field(CluePageVo::getDevStaffName)
|
||||
.queryWrapper(devStaff -> queryChain().select(STAFF.NAME.as(CluePageVo::getDevStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(devStaff.getDevStaffId()))));
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序调整
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param pageDomain 排序请求参数
|
||||
* @return QueryOrderBy
|
||||
*/
|
||||
private QueryOrderBy changeOrderColumn(PageDomain pageDomain) {
|
||||
switch (pageDomain.getOrderByColumn()) {
|
||||
case "createTime":
|
||||
if (pageDomain.getBoolAsc()) {
|
||||
return CLUE.CREATE_TIME.asc();
|
||||
} else {
|
||||
return CLUE.CREATE_TIME.desc();
|
||||
}
|
||||
case "receiptTime":
|
||||
if (pageDomain.getBoolAsc()) {
|
||||
return CLUE.RECEIPT_TIME.asc();
|
||||
} else {
|
||||
return CLUE.RECEIPT_TIME.desc();
|
||||
}
|
||||
case "followUpInterval":
|
||||
if (pageDomain.getBoolAsc()) {
|
||||
return column(CluePageVo::getFollowUpInterval).asc();
|
||||
} else {
|
||||
return column(CluePageVo::getFollowUpInterval).desc();
|
||||
}
|
||||
case "signInterval":
|
||||
if (pageDomain.getBoolAsc()) {
|
||||
return column(CluePageVo::getSignInterval).asc();
|
||||
} else {
|
||||
return column(CluePageVo::getSignInterval).desc();
|
||||
}
|
||||
default:
|
||||
return CLUE.CREATE_TIME.desc();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人签约目标
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param signMonth 签约月份
|
||||
* @return PersonSignGoalVo
|
||||
*/
|
||||
@Override
|
||||
public PersonSignGoalVo getPersonSignGoal(String signMonth,String staffId) {
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
if (StringUtils.isNotBlank(staffId)) {
|
||||
queryWrapper.and(SIGN_GOAL.STAFF_ID.eq(staffId));
|
||||
} else {
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
queryWrapper.and(SIGN_GOAL.STAFF_ID.eq(loginUserInfo.getString("id")));
|
||||
}
|
||||
SignGoalService signGoalService = SpringUtils.getBean(SignGoalService.class);
|
||||
String[] split = signMonth.split("-");
|
||||
SignGoal signGoal = signGoalService.getOne(queryWrapper.where(SIGN_GOAL.YEAR.eq(Integer.parseInt(split[0]))));
|
||||
PersonSignGoalVo vo = new PersonSignGoalVo();
|
||||
if (signGoal == null){
|
||||
return vo;
|
||||
}
|
||||
switch (Integer.parseInt(split[1])){
|
||||
case 1:
|
||||
vo.setGoalNum(signGoal.getJanGoal());
|
||||
vo.setFinishNum(signGoal.getJanFinish());
|
||||
break;
|
||||
case 2:
|
||||
vo.setGoalNum(signGoal.getFebGoal());
|
||||
vo.setFinishNum(signGoal.getFebFinish());
|
||||
break;
|
||||
case 3:
|
||||
vo.setGoalNum(signGoal.getMarGoal());
|
||||
vo.setFinishNum(signGoal.getMarFinish());
|
||||
break;
|
||||
case 4:
|
||||
vo.setGoalNum(signGoal.getAprGoal());
|
||||
vo.setFinishNum(signGoal.getAprFinish());
|
||||
break;
|
||||
case 5:
|
||||
vo.setGoalNum(signGoal.getMayGoal());
|
||||
vo.setFinishNum(signGoal.getMayFinish());
|
||||
break;
|
||||
case 6:
|
||||
vo.setGoalNum(signGoal.getJunGoal());
|
||||
vo.setFinishNum(signGoal.getJunFinish());
|
||||
break;
|
||||
case 7:
|
||||
vo.setGoalNum(signGoal.getJulGoal());
|
||||
vo.setFinishNum(signGoal.getJulFinish());
|
||||
break;
|
||||
case 8:
|
||||
vo.setGoalNum(signGoal.getAugGoal());
|
||||
vo.setFinishNum(signGoal.getAugFinish());
|
||||
break;
|
||||
case 9:
|
||||
vo.setGoalNum(signGoal.getSepGoal());
|
||||
vo.setFinishNum(signGoal.getSepFinish());
|
||||
break;
|
||||
case 10:
|
||||
vo.setGoalNum(signGoal.getOctGoal());
|
||||
vo.setFinishNum(signGoal.getOctFinish());
|
||||
break;
|
||||
case 11:
|
||||
vo.setGoalNum(signGoal.getNovGoal());
|
||||
vo.setFinishNum(signGoal.getNovFinish());
|
||||
break;
|
||||
case 12:
|
||||
vo.setGoalNum(signGoal.getDecGoal());
|
||||
vo.setFinishNum(signGoal.getDecFinish());
|
||||
break;
|
||||
}
|
||||
Long signNum = this.count(QueryWrapper.create().where(CLUE.RESPONSIBLE_STAFF_ID.eq(staffId)).and(CLUE.CLUE_STATUS.eq(1)));
|
||||
vo.setSignNum(signNum.intValue());
|
||||
Long totalNum = this.count(QueryWrapper.create().where(CLUE.RESPONSIBLE_STAFF_ID.eq(staffId)));
|
||||
vo.setTotalNum(totalNum.intValue());
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索跟进
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
*/
|
||||
@Override
|
||||
public void clueFollowUp(ClueFollowUpBo bo) {
|
||||
ClueRecord clueRecord = BeanUtils.mapToClass(bo, ClueRecord.class);
|
||||
clueRecord.setRecordType(2);
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
clueRecord.setRecordStaffId(loginUserInfo.getString("id"));
|
||||
SpringUtils.getBean(ClueRecordService.class).save(clueRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索更新
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param bo 请求对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void clueUpdate(ClueUpdateBo bo) {
|
||||
Clue clue = this.getById(bo.getClueId());
|
||||
StoreService storeService = SpringUtils.getBean(StoreService.class);
|
||||
Store store = storeService.getById(clue.getStoreId());
|
||||
ClueUpdate clueUpdate = BeanUtils.mapToClass(bo,ClueUpdate.class);
|
||||
clueUpdate.setOldPersonCharge(store.getPersonCharge())
|
||||
.setOldPhone(store.getPhone())
|
||||
.setOldStoreAddr(store.getStoreAddr())
|
||||
.setOldStoreName(store.getStoreName());
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
clueUpdate.setUpdateStaffId(loginUserInfo.getString("id"));
|
||||
//保存记录
|
||||
SpringUtils.getBean(ClueUpdateService.class).save(clueUpdate);
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
clueRecord.setClueId(bo.getClueId())
|
||||
.setRecordStaffId(loginUserInfo.getString("id"))
|
||||
.setRecordType(6)
|
||||
.setRecordContent("校区更新");
|
||||
SpringUtils.getBean(ClueRecordService.class).save(clueRecord);
|
||||
//更新校区
|
||||
store.setStoreName(bo.getNewStoreName())
|
||||
.setPersonCharge(bo.getNewPersonCharge())
|
||||
.setPhone(bo.getNewPhone())
|
||||
.setStoreAddr(bo.getNewStoreAddr());
|
||||
storeService.updateById(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索更新记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return ClueUpdateVo
|
||||
*/
|
||||
@Override
|
||||
public ClueUpdateVo getClueUpdateRecord(String clueId) {
|
||||
ClueUpdateVo clueUpdateVo = new ClueUpdateVo();
|
||||
List<ClueUpdateVo.ClueUpdateRecordVo> recordVos = SpringUtils.getBean(ClueUpdateService.class).queryChain()
|
||||
.select(CLUE_UPDATE.NEW_PERSON_CHARGE,CLUE_UPDATE.NEW_PHONE,CLUE_UPDATE.NEW_STORE_ADDR,CLUE_UPDATE.NEW_STORE_NAME,
|
||||
CLUE_UPDATE.OLD_PERSON_CHARGE,CLUE_UPDATE.OLD_PHONE,CLUE_UPDATE.OLD_STORE_ADDR,CLUE_UPDATE.OLD_STORE_NAME,CLUE_UPDATE.CREATE_TIME)
|
||||
.select(STAFF.NAME.as(ClueUpdateVo.ClueUpdateRecordVo::getStaffName))
|
||||
.leftJoin(STAFF).on(STAFF.ID.eq(CLUE_UPDATE.UPDATE_STAFF_ID))
|
||||
.where(CLUE_UPDATE.CLUE_ID.eq(clueId))
|
||||
.listAs(ClueUpdateVo.ClueUpdateRecordVo.class);
|
||||
clueUpdateVo.setRecordVos(recordVos);
|
||||
//获取现有校区数据
|
||||
Clue clue = this.getById(clueId);
|
||||
Store store = SpringUtils.getBean(StoreService.class).getById(clue.getStoreId());
|
||||
clueUpdateVo.setStoreName(store.getStoreName())
|
||||
.setPhone(store.getPhone())
|
||||
.setPersonCharge(store.getPersonCharge())
|
||||
.setStoreAddr(store.getStoreAddr());
|
||||
return clueUpdateVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索延期
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param bo 请求对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cluePutOff(CluePutOffBo bo) {
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
CluePutOff cluePutOff = BeanUtils.mapToClass(bo, CluePutOff.class);
|
||||
cluePutOff.setAuditStatus(0)
|
||||
.setPutOffStaffId(loginUserInfo.getString("id"));
|
||||
SpringUtils.getBean(CluePutOffService.class).save(cluePutOff);
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
clueRecord.setClueId(bo.getClueId())
|
||||
.setRecordStaffId(loginUserInfo.getString("id"))
|
||||
.setRecordType(7)
|
||||
.setRecordContent(bo.getPutOffReason());
|
||||
SpringUtils.getBean(ClueRecordService.class).save(clueRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索延期记录
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param clueId 线索id
|
||||
* @return R<List<CluePutOffVo>>
|
||||
*/
|
||||
@Override
|
||||
public List<CluePutOffVo> getCluePutOffRecord(String clueId) {
|
||||
return SpringUtils.getBean(CluePutOffService.class).getMapper().selectListByQueryAs(QueryWrapper.create()
|
||||
.select(CLUE_PUT_OFF.PUT_OFF_DATE, CLUE_PUT_OFF.PUT_OFF_REASON, CLUE_PUT_OFF.CREATE_TIME, CLUE_PUT_OFF.PUT_OFF_STAFF_ID, CLUE_PUT_OFF.AUDIT_STAFF_ID, CLUE_PUT_OFF.AUDIT_STATUS),
|
||||
CluePutOffVo.class,
|
||||
//延迟员工
|
||||
item -> item.field(CluePutOffVo::getPutOffStaffName)
|
||||
.queryWrapper(putOffStaff -> {
|
||||
if (StringUtils.isNotBlank(putOffStaff.getPutOffStaffId())) {
|
||||
return queryChain().select(STAFF.NAME.as(CluePutOffVo::getPutOffStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(putOffStaff.getPutOffStaffId()));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}),
|
||||
//审核员工
|
||||
item -> item.field(CluePutOffVo::getAuditStaffName)
|
||||
.queryWrapper(auditStaff -> {
|
||||
if (StringUtils.isNotBlank(auditStaff.getAuditStaffId())) {
|
||||
return queryChain().select(STAFF.NAME.as(CluePutOffVo::getAuditStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(auditStaff.getPutOffStaffId()));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索脱离
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param id 线索id
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void clueDetachment(String id) {
|
||||
Clue clue = this.getById(id);
|
||||
if (clue.getClueStatus() == 1) {
|
||||
throw new ServiceException("当前线索已签约,不允许脱离");
|
||||
}
|
||||
clue.setClueStatus(0).setResponsibleStaffId(null);
|
||||
this.updateById(clue);
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
clueRecord.setClueId(id)
|
||||
.setRecordStaffId(loginUserInfo.getString("id"))
|
||||
.setRecordType(4)
|
||||
.setRecordContent("主动脱离");
|
||||
SpringUtils.getBean(ClueRecordService.class).save(clueRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 地区线索分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param city 城市
|
||||
* @param brandId 品牌id
|
||||
* @param storeId 校区id
|
||||
* @param chargeOrPhone 负责人或手机号
|
||||
* @return Page<CluePageVo>
|
||||
*/
|
||||
@Override
|
||||
public Page<CluePageVo> getAreaCluePage(String city, String brandId, String storeId, String chargeOrPhone) {
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
//获取员工区域信息
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
int year = LocalDate.now().getYear();
|
||||
List<String> cityList = SpringUtils.getBean(SignAreaService.class).queryChain()
|
||||
.select(distinct(SIGN_AREA.CITY))
|
||||
.leftJoin(SIGN_GOAL).on(SIGN_GOAL.ID.eq(SIGN_AREA.SIGN_GOAL_ID))
|
||||
.where(SIGN_GOAL.STAFF_ID.eq(loginUserInfo.getString("id")))
|
||||
.and(SIGN_GOAL.YEAR.eq(year))
|
||||
.listAs(String.class);
|
||||
if (cityList == null || cityList.isEmpty()){
|
||||
throw new ServiceException("您尚未被分配区域,无法查看线索");
|
||||
}
|
||||
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
|
||||
queryWrapper
|
||||
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID)
|
||||
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
|
||||
.select(BRAND.BRAND_NAME)
|
||||
// 跟进间隔
|
||||
.select(dateDiff(now(), CLUE.LAST_FOLLOW_UP_TIME).as(CluePageVo::getFollowUpInterval))
|
||||
// 签约时间
|
||||
.select(dateDiff(now(), CLUE.RECEIPT_TIME).as(CluePageVo::getSignInterval))
|
||||
.from(CLUE)
|
||||
.leftJoin(STORE).on(STORE.ID.eq(CLUE.STORE_ID))
|
||||
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
|
||||
//地区
|
||||
.and(CLUE.CITY.in(cityList))
|
||||
.and(CLUE.CITY.eq(city))
|
||||
//品牌
|
||||
.and(BRAND.ID.eq(brandId))
|
||||
//校区
|
||||
.and(CLUE.STORE_ID.eq(storeId))
|
||||
.and(STORE.PERSON_CHARGE.likeLeft(chargeOrPhone).or(STORE.PHONE.eq(chargeOrPhone)))
|
||||
.and(CLUE.RESPONSIBLE_STAFF_ID.isNull())
|
||||
.orderBy(CLUE.CREATE_TIME.desc()),
|
||||
CluePageVo.class,
|
||||
//开发员工
|
||||
item -> item.field(CluePageVo::getDevStaffName)
|
||||
.queryWrapper(devStaff -> {
|
||||
if (StringUtils.isNotBlank(devStaff.getDevStaffId())) {
|
||||
return queryChain().select(STAFF.NAME.as(CluePageVo::getDevStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(devStaff.getDevStaffId()));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共线索分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param city 城市
|
||||
* @param brandId 品牌id
|
||||
* @param storeId 校区id
|
||||
* @param chargeOrPhone 负责人或手机号
|
||||
* @return Page<CluePageVo>
|
||||
*/
|
||||
@Override
|
||||
public Page<CluePageVo> getPublicCluePage(String city, String brandId, String storeId, String chargeOrPhone) {
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
int year = LocalDate.now().getYear();
|
||||
List<String> cityList = SpringUtils.getBean(SignAreaService.class).queryChain()
|
||||
.select(distinct(SIGN_AREA.CITY))
|
||||
.leftJoin(SIGN_GOAL).on(SIGN_GOAL.ID.eq(SIGN_AREA.SIGN_GOAL_ID))
|
||||
.and(SIGN_GOAL.YEAR.eq(year))
|
||||
.listAs(String.class);
|
||||
if (cityList == null || cityList.isEmpty()){
|
||||
throw new ServiceException("当前年没有设置签约指标,请先设置后再进行操作");
|
||||
}
|
||||
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
|
||||
queryWrapper
|
||||
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID)
|
||||
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
|
||||
.select(BRAND.BRAND_NAME)
|
||||
// 跟进间隔
|
||||
.select(dateDiff(now(), CLUE.LAST_FOLLOW_UP_TIME).as(CluePageVo::getFollowUpInterval))
|
||||
// 签约时间
|
||||
.select(dateDiff(now(), CLUE.RECEIPT_TIME).as(CluePageVo::getSignInterval))
|
||||
.from(CLUE)
|
||||
.leftJoin(STORE).on(STORE.ID.eq(CLUE.STORE_ID))
|
||||
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
|
||||
//地区
|
||||
.and(CLUE.CITY.notIn(cityList))
|
||||
.and(CLUE.CITY.eq(city))
|
||||
//品牌
|
||||
.and(BRAND.ID.eq(brandId))
|
||||
//校区
|
||||
.and(CLUE.STORE_ID.eq(storeId))
|
||||
.and(STORE.PERSON_CHARGE.likeLeft(chargeOrPhone).or(STORE.PHONE.eq(chargeOrPhone)))
|
||||
.and(CLUE.RESPONSIBLE_STAFF_ID.isNull())
|
||||
.orderBy(CLUE.CREATE_TIME.desc()),
|
||||
CluePageVo.class,
|
||||
//开发员工
|
||||
item -> item.field(CluePageVo::getDevStaffName)
|
||||
.queryWrapper(devStaff -> {
|
||||
if(StringUtils.isNotBlank(devStaff.getDevStaffId())){
|
||||
return queryChain().select(STAFF.NAME.as(CluePageVo::getDevStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(devStaff.getDevStaffId()));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 线索领取
|
||||
* @author DB
|
||||
* @since 2024/2/20
|
||||
* @param id 线索id
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void clueCollection(String id) {
|
||||
Clue clue = this.getById(id);
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
if (StringUtils.isBlank(clue.getDevStaffId())) {
|
||||
clue.setDevStaffId(loginUserInfo.getString("id"));
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String content = "员工" + loginUserInfo.getString("name") + "领取了该线索";
|
||||
clue.setResponsibleStaffId(loginUserInfo.getString("id"))
|
||||
.setReceiptTime(now)
|
||||
.setLastFollowUpTime(now)
|
||||
.setLastFollowUpContent(content);
|
||||
this.updateById(clue);
|
||||
//插入记录
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
clueRecord.setClueId(id)
|
||||
.setRecordType(1)
|
||||
.setRecordStaffId(loginUserInfo.getString("id"))
|
||||
.setRecordContent(content);
|
||||
SpringUtils.getBean(ClueRecordService.class).save(clueRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的开发分页
|
||||
* @author DB
|
||||
* @since 2024/2/21
|
||||
* @param city 城市
|
||||
* @param brandId 品牌id
|
||||
* @param storeId 校区id
|
||||
* @param chargeOrPhone 负责人或手机号
|
||||
* @return Page<CluePageVo>
|
||||
*/
|
||||
@Override
|
||||
public Page<CluePageVo> getMyDevCluePage(String city, String brandId, String storeId, String chargeOrPhone) {
|
||||
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain();
|
||||
QueryWrapper queryWrapper = QueryWrapper.create();
|
||||
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||
return this.mapper.paginateAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()),
|
||||
queryWrapper
|
||||
.select(CLUE.CITY,CLUE.ID,CLUE.CREATE_TIME,CLUE.DEV_STAFF_ID,CLUE.LAST_FOLLOW_UP_TIME,CLUE.LAST_FOLLOW_UP_CONTENT,CLUE.RECEIPT_TIME,CLUE.STORE_ID,CLUE.RESPONSIBLE_STAFF_ID)
|
||||
.select(STORE.STORE_NAME,STORE.STORE_ADDR,STORE.PERSON_CHARGE,STORE.PHONE)
|
||||
.select(BRAND.BRAND_NAME)
|
||||
// 跟进间隔
|
||||
.select(dateDiff(now(), CLUE.LAST_FOLLOW_UP_TIME).as(CluePageVo::getFollowUpInterval))
|
||||
// 签约时间
|
||||
.select(dateDiff(now(), CLUE.RECEIPT_TIME).as(CluePageVo::getSignInterval))
|
||||
.from(CLUE)
|
||||
.leftJoin(STORE).on(STORE.ID.eq(CLUE.STORE_ID))
|
||||
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID))
|
||||
.and(CLUE.DEV_STAFF_ID.eq(loginUserInfo.getString("id")))
|
||||
//地区
|
||||
.and(CLUE.CITY.eq(city))
|
||||
//品牌
|
||||
.and(BRAND.ID.eq(brandId))
|
||||
//校区
|
||||
.and(CLUE.STORE_ID.eq(storeId))
|
||||
.and(STORE.PERSON_CHARGE.likeLeft(chargeOrPhone).or(STORE.PHONE.eq(chargeOrPhone)))
|
||||
.orderBy(CLUE.CREATE_TIME.desc()),
|
||||
CluePageVo.class,
|
||||
//开发员工
|
||||
item -> item.field(CluePageVo::getDevStaffName)
|
||||
.queryWrapper(devStaff -> queryChain().select(STAFF.NAME.as(CluePageVo::getDevStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(devStaff.getDevStaffId()))),
|
||||
//负责员工
|
||||
item -> item.field(CluePageVo::getResponsibleStaffName)
|
||||
.queryWrapper(responsibleStaff -> {
|
||||
if (StringUtils.isNotBlank(responsibleStaff.getResponsibleStaffId())){
|
||||
return queryChain().select(STAFF.NAME.as(CluePageVo::getResponsibleStaffName))
|
||||
.from(STAFF)
|
||||
.where(STAFF.ID.eq(responsibleStaff.getResponsibleStaffId()));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.cpop.oam.business.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cpop.oam.business.entity.ClueUpdate;
|
||||
import com.cpop.oam.business.mapper.ClueUpdateMapper;
|
||||
import com.cpop.oam.business.service.ClueUpdateService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 线索更新 服务层实现。
|
||||
*
|
||||
* @author DB
|
||||
* @since 2024-02-20
|
||||
*/
|
||||
@Service("clueUpdateService")
|
||||
public class ClueUpdateServiceImpl extends ServiceImpl<ClueUpdateMapper, ClueUpdate> implements ClueUpdateService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.cpop.oam.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 15:36
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "线索跟进记录返回对象")
|
||||
public class ClueFollowUpRecordVo {
|
||||
|
||||
/**
|
||||
* 记录内容
|
||||
*/
|
||||
@ApiModelProperty(value = "记录内容")
|
||||
private String recordContent;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 员工名
|
||||
*/
|
||||
@ApiModelProperty(value = "员工名")
|
||||
private String staffName;
|
||||
|
||||
/**
|
||||
* 记录文件
|
||||
*/
|
||||
@ApiModelProperty(value = "记录文件")
|
||||
private String recordFileUrl;
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
package com.cpop.oam.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ -17,30 +19,121 @@ import java.time.LocalDateTime;
|
||||
@ApiModel(value = "线索分页返回对象")
|
||||
public class CluePageVo {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 校区id
|
||||
*/
|
||||
@ApiModelProperty(value = "校区id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 校区名
|
||||
*/
|
||||
@ApiModelProperty(value = "校区名")
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@ApiModelProperty(value = "品牌id")
|
||||
private String brandName;
|
||||
|
||||
/**
|
||||
* 地区(省/市)
|
||||
*/
|
||||
@ApiModelProperty(value = "地区(省/市)")
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 店铺/校区地址
|
||||
*/
|
||||
@ApiModelProperty(value = "店铺/校区地址")
|
||||
private String storeAddr;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ApiModelProperty(value = "负责人")
|
||||
private String personCharge;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDate updateTime;
|
||||
/**
|
||||
* 负责员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "负责员工id")
|
||||
private String responsibleStaffId;
|
||||
|
||||
/**
|
||||
* 负责员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "负责员工id")
|
||||
private String responsibleStaffName;
|
||||
|
||||
/**
|
||||
* 开发员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "开发员工id")
|
||||
private String devStaffId;
|
||||
|
||||
/**
|
||||
* 开发员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "开发员工id")
|
||||
private String devStaffName;
|
||||
|
||||
/**
|
||||
* 最后跟进时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "最后跟进时间")
|
||||
private LocalDateTime lastFollowUpTime;
|
||||
|
||||
/**
|
||||
* 最后跟进内容
|
||||
*/
|
||||
@ApiModelProperty(value = "最后跟进内容")
|
||||
private String lastFollowUpContent;
|
||||
|
||||
/**
|
||||
* 接收时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "接收时间")
|
||||
private LocalDateTime receiptTime;
|
||||
|
||||
/**
|
||||
* 跟进间隔
|
||||
*/
|
||||
@ApiModelProperty(value = "跟进间隔")
|
||||
private Integer followUpInterval;
|
||||
|
||||
/**
|
||||
* 签约间隔
|
||||
*/
|
||||
@ApiModelProperty(value = "签约间隔")
|
||||
private Integer signInterval;
|
||||
|
||||
/**
|
||||
* 签约状态(0:待签约;1:已签约;2:警告线索)
|
||||
*/
|
||||
@ApiModelProperty(value = "签约状态(0:待签约;1:已签约;2:警告线索)")
|
||||
private Integer clueStatus;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
package com.cpop.oam.business.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 16:13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "线索延期返回对象")
|
||||
public class CluePutOffVo {
|
||||
|
||||
/**
|
||||
* 延期到期日期
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "延期到期日期")
|
||||
private LocalDate putOffDate;
|
||||
|
||||
/**
|
||||
* 审核状态(0:待审核,1:审核通过,2:审核不通过)
|
||||
*/
|
||||
@ApiModelProperty(value = "审核状态(0:待审核,1:审核通过,2:审核不通过)")
|
||||
private Integer auditStatus;
|
||||
|
||||
/**
|
||||
* 延迟员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "延迟员工id")
|
||||
private String putOffStaffId;
|
||||
|
||||
/**
|
||||
* 延迟员工名
|
||||
*/
|
||||
@ApiModelProperty(value = "延迟员工名")
|
||||
private String putOffStaffName;
|
||||
|
||||
/**
|
||||
* 审核员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "审核员工id")
|
||||
private String auditStaffId;
|
||||
|
||||
/**
|
||||
* 审核员工名
|
||||
*/
|
||||
@ApiModelProperty(value = "审核员工名")
|
||||
private String auditStaffName;
|
||||
|
||||
/**
|
||||
* 延期原因
|
||||
*/
|
||||
@ApiModelProperty(value = "延期原因")
|
||||
private String putOffReason;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.cpop.oam.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 15:44
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "线索记录返回对象")
|
||||
public class ClueRecordVo {
|
||||
|
||||
/**
|
||||
* 记录内容
|
||||
*/
|
||||
@ApiModelProperty(value = "记录内容")
|
||||
private String recordContent;
|
||||
|
||||
/**
|
||||
* 记录类型(0:创建;1:领取;2:跟进;3:转交;4:脱离;5:成交;6:更新)
|
||||
*/
|
||||
@ApiModelProperty(value = "记录类型(0:创建;1:领取;2:跟进;3:转交;4:脱离;5:成交;6:更新)")
|
||||
private Integer recordType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
package com.cpop.oam.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @version 1.0.0
|
||||
* @author DB
|
||||
* @since 2024-02-20 15:51
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "线索更新记录返回对象")
|
||||
public class ClueUpdateVo {
|
||||
|
||||
/**
|
||||
* 店铺/校区地址
|
||||
*/
|
||||
@ApiModelProperty("店铺/校区地址")
|
||||
private String storeAddr;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ApiModelProperty("负责人")
|
||||
private String personCharge;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 店铺/校区名
|
||||
*/
|
||||
@ApiModelProperty("店铺/校区名")
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 更新记录
|
||||
*/
|
||||
@ApiModelProperty("更新记录")
|
||||
private List<ClueUpdateRecordVo> recordVos;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "线索更新记录返回对象")
|
||||
public static class ClueUpdateRecordVo{
|
||||
|
||||
/**
|
||||
* 旧校区名
|
||||
*/
|
||||
@ApiModelProperty("旧校区名")
|
||||
private String oldStoreName;
|
||||
|
||||
/**
|
||||
* 新校区名
|
||||
*/
|
||||
@ApiModelProperty("新校区名")
|
||||
private String newStoreName;
|
||||
|
||||
/**
|
||||
* 旧负责人
|
||||
*/
|
||||
@ApiModelProperty("旧负责人")
|
||||
private String oldPersonCharge;
|
||||
|
||||
/**
|
||||
* 新负责人
|
||||
*/
|
||||
@ApiModelProperty("新负责人")
|
||||
private String newPersonCharge;
|
||||
|
||||
/**
|
||||
* 旧手机号
|
||||
*/
|
||||
@ApiModelProperty("旧手机号")
|
||||
private String oldPhone;
|
||||
|
||||
/**
|
||||
* 新手机号
|
||||
*/
|
||||
@ApiModelProperty("新手机号")
|
||||
private String newPhone;
|
||||
|
||||
/**
|
||||
* 旧校区地址
|
||||
*/
|
||||
@ApiModelProperty("旧校区地址")
|
||||
private String oldStoreAddr;
|
||||
|
||||
/**
|
||||
* 新校区地址
|
||||
*/
|
||||
@ApiModelProperty("新校区地址")
|
||||
private String newStoreAddr;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 员工名
|
||||
*/
|
||||
@ApiModelProperty(value = "员工名")
|
||||
private String staffName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.cpop.oam.business.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-20 14:14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "个人签约目标返回对象")
|
||||
public class PersonSignGoalVo {
|
||||
|
||||
/**
|
||||
* 目标数
|
||||
*/
|
||||
@ApiModelProperty(value = "目标数")
|
||||
private Integer goalNum = 0;
|
||||
|
||||
/**
|
||||
* 完成数
|
||||
*/
|
||||
@ApiModelProperty(value = "完成数")
|
||||
private Integer finishNum = 0;
|
||||
|
||||
/**
|
||||
* 签约数
|
||||
*/
|
||||
@ApiModelProperty(value = "签约数")
|
||||
private Integer signNum = 0;
|
||||
|
||||
/**
|
||||
* 总数
|
||||
*/
|
||||
@ApiModelProperty(value = "总数")
|
||||
private Integer totalNum = 0;
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
package com.cpop.oam.business.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author DB
|
||||
* @version 1.0.0
|
||||
* @since 2024-02-21 13:46
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "线索延期返回对象")
|
||||
public class PutOffAuditPageVo {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 校区id
|
||||
*/
|
||||
@ApiModelProperty(value = "校区id")
|
||||
private String storeId;
|
||||
|
||||
/**
|
||||
* 校区名
|
||||
*/
|
||||
@ApiModelProperty(value = "校区名")
|
||||
private String storeName;
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@ApiModelProperty(value = "品牌id")
|
||||
private String brandName;
|
||||
|
||||
/**
|
||||
* 地区(省/市)
|
||||
*/
|
||||
@ApiModelProperty(value = "地区(省/市)")
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 店铺/校区地址
|
||||
*/
|
||||
@ApiModelProperty(value = "店铺/校区地址")
|
||||
private String storeAddr;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@ApiModelProperty(value = "负责人")
|
||||
private String personCharge;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 到期日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "到期日期")
|
||||
private LocalDate expireDate;
|
||||
|
||||
/**
|
||||
* 延期原因
|
||||
*/
|
||||
@ApiModelProperty(value = "延期原因")
|
||||
private String putOffReason;
|
||||
|
||||
/**
|
||||
* 延期文件路径
|
||||
*/
|
||||
@ApiModelProperty(value = "延期文件路径")
|
||||
private String putOffFileUrl;
|
||||
|
||||
/**
|
||||
* 延期到期日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "延期到期日期")
|
||||
private LocalDate putOffDate;
|
||||
|
||||
/**
|
||||
* 延迟员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "延迟员工id")
|
||||
private String putOffStaffId;
|
||||
|
||||
/**
|
||||
* 延迟员工id
|
||||
*/
|
||||
@ApiModelProperty(value = "延迟员工id")
|
||||
private String putOffStaffName;
|
||||
|
||||
}
|
||||
@ -1,22 +1,34 @@
|
||||
package com.cpop.oam.framework.tasks;
|
||||
|
||||
import com.cpop.common.utils.StringUtils;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.table.SysConfig;
|
||||
import com.cpop.core.service.CoreService;
|
||||
import com.cpop.core.service.RedisService;
|
||||
import com.cpop.core.utils.SpringUtils;
|
||||
import com.cpop.oam.business.entity.Clue;
|
||||
import com.cpop.oam.business.entity.ClueRecord;
|
||||
import com.cpop.oam.business.entity.DataImport;
|
||||
import com.cpop.oam.business.entity.Task;
|
||||
import com.cpop.oam.business.entity.table.DataImportTableDef;
|
||||
import com.cpop.oam.business.service.DataImportService;
|
||||
import com.cpop.oam.business.service.DutyService;
|
||||
import com.cpop.oam.business.service.TaskService;
|
||||
import com.cpop.oam.business.service.*;
|
||||
import com.cpop.oam.business.vo.SignGoalConfigInfoVo;
|
||||
import com.cpop.oam.framework.constant.OamConfigKey;
|
||||
import com.cpop.oam.framework.enums.OamConfigEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE;
|
||||
import static com.cpop.oam.business.entity.table.TaskTableDef.TASK;
|
||||
|
||||
|
||||
@ -80,4 +92,108 @@ public class OamScheduledTasks {
|
||||
taskService.updateChain().set(TASK.TASK_ITEM, -1).where(TASK.ID.in(filterList.stream().map(Task::getId).collect(Collectors.toSet()))).update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 凌晨30分检查线索是否脱离
|
||||
* @author DB
|
||||
* @since 2023/12/10
|
||||
*/
|
||||
@Scheduled(cron = "0 30 0 * * *")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void checkClue() {
|
||||
log.info("==============开始检查线索数据===========");
|
||||
RedisService redisService = SpringUtils.getBean(RedisService.class);
|
||||
CoreService coreService = SpringUtils.getBean(CoreService.class);
|
||||
CommonService commonService = SpringUtils.getBean(CommonService.class);
|
||||
Map<String, String> configMap = new HashMap<>(8);
|
||||
Arrays.asList(OamConfigKey.SIGN_GOAL).forEach(item -> {
|
||||
String cacheInfo = redisService.getCacheObject(commonService.getCacheKey(item));
|
||||
if (StringUtils.isNotBlank(cacheInfo)) {
|
||||
// 获取枚举
|
||||
OamConfigEnum sysConfigEnum = OamConfigEnum.matchKey(item);
|
||||
configMap.put(sysConfigEnum.getField(), cacheInfo);
|
||||
} else {
|
||||
// 查询系统
|
||||
SysConfig sysConfig = coreService.selectConfigByKey(item);
|
||||
if (null != sysConfig) {
|
||||
// 获取枚举
|
||||
OamConfigEnum sysConfigEnum = OamConfigEnum.matchKey(item);
|
||||
configMap.put(sysConfigEnum.getField(), sysConfig.getConfigValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
SignGoalConfigInfoVo signGoalConfigInfoVo = new SignGoalConfigInfoVo();
|
||||
BeanUtils.mapToObj(configMap, signGoalConfigInfoVo);
|
||||
//设置了线索指标
|
||||
if (StringUtils.isNotBlank(signGoalConfigInfoVo.getSignInterval())&&StringUtils.isNotBlank(signGoalConfigInfoVo.getFollowUpInterval())){
|
||||
//查询所有有负责人的线索
|
||||
ClueService clueService = SpringUtils.getBean(ClueService.class);
|
||||
List<Clue> clueList = clueService.queryChain()
|
||||
.where(CLUE.RESPONSIBLE_STAFF_ID.isNotNull())
|
||||
.and(CLUE.CLUE_STATUS.ne(1))
|
||||
.list();
|
||||
if (!clueList.isEmpty()){
|
||||
List<Clue> followOffClueList = new ArrayList<>();
|
||||
List<Clue> signOffClueList = new ArrayList<>();
|
||||
List<Clue> warnClueList = new ArrayList<>();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
clueList.forEach(item->{
|
||||
//对比最后跟进时间
|
||||
Long followInterval = ChronoUnit.DAYS.between(now, item.getLastFollowUpTime());
|
||||
//对比最后跟进时间
|
||||
Long signInterval = ChronoUnit.DAYS.between(LocalDateTime.now(), item.getReceiptTime());
|
||||
if (followInterval.intValue() - Integer.parseInt(signGoalConfigInfoVo.getFollowUpInterval()) >= 0) {
|
||||
followOffClueList.add(item);
|
||||
} else if (signInterval.intValue() - Integer.parseInt(signGoalConfigInfoVo.getSignInterval()) >= 0) {
|
||||
signOffClueList.add(item);
|
||||
} else if (followInterval.intValue() - 5 <= 0) {
|
||||
//跟进警告
|
||||
warnClueList.add(item);
|
||||
} else if (signInterval.intValue() - 10 <= 0) {
|
||||
// 签约警告
|
||||
warnClueList.add(item);
|
||||
}
|
||||
});
|
||||
List<ClueRecord> clueRecords = new ArrayList<>();
|
||||
//跟进脱离
|
||||
if (!followOffClueList.isEmpty()){
|
||||
followOffClueList.forEach(item->{
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
clueRecord.setClueId(item.getId())
|
||||
.setRecordStaffId("1")
|
||||
.setRecordType(4)
|
||||
.setRecordContent("跟进间隔过长");
|
||||
clueRecords.add(clueRecord);
|
||||
item.setResponsibleStaffId(null).setClueStatus(0);
|
||||
});
|
||||
//批量修改
|
||||
clueService.updateBatch(followOffClueList);
|
||||
}
|
||||
//签约脱离
|
||||
if (!signOffClueList.isEmpty()){
|
||||
signOffClueList.forEach(item->{
|
||||
ClueRecord clueRecord = new ClueRecord();
|
||||
clueRecord.setClueId(item.getId())
|
||||
.setRecordStaffId("1")
|
||||
.setRecordType(4)
|
||||
.setRecordContent("签约周期过长");
|
||||
clueRecords.add(clueRecord);
|
||||
item.setResponsibleStaffId(null).setClueStatus(0);
|
||||
});
|
||||
clueService.updateBatch(signOffClueList);
|
||||
}
|
||||
//签约脱离
|
||||
if (!warnClueList.isEmpty()) {
|
||||
warnClueList.forEach(item -> {
|
||||
item.setClueStatus(2);
|
||||
});
|
||||
clueService.updateBatch(warnClueList);
|
||||
}
|
||||
if (!clueRecords.isEmpty()){
|
||||
//保存记录
|
||||
SpringUtils.getBean(ClueRecordService.class).saveBatch(clueRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
7
Cpop-Oam/src/main/resources/mapper/CluePutOffMapper.xml
Normal file
7
Cpop-Oam/src/main/resources/mapper/CluePutOffMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.oam.business.mapper.CluePutOffMapper">
|
||||
|
||||
</mapper>
|
||||
7
Cpop-Oam/src/main/resources/mapper/ClueRecordMapper.xml
Normal file
7
Cpop-Oam/src/main/resources/mapper/ClueRecordMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.oam.business.mapper.ClueRecordMapper">
|
||||
|
||||
</mapper>
|
||||
7
Cpop-Oam/src/main/resources/mapper/ClueUpdateMapper.xml
Normal file
7
Cpop-Oam/src/main/resources/mapper/ClueUpdateMapper.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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.cpop.oam.business.mapper.ClueUpdateMapper">
|
||||
|
||||
</mapper>
|
||||
@ -56,7 +56,7 @@ public class StoreRenewBo {
|
||||
private String annexUrl;
|
||||
|
||||
/**
|
||||
* 类型(0:续费;1:延期)
|
||||
* 类型(0:续费;1:延期;2:激活)
|
||||
*/
|
||||
@NotNull(message = "类型不能为空")
|
||||
@ApiModelProperty(value = "类型(0:续费;1:延期;2:激活)", required = true)
|
||||
|
||||
@ -7,8 +7,10 @@
|
||||
*/
|
||||
package com.cpop.system.business.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpop.api.cloudDb.core.dto.CloudStoreDto;
|
||||
import com.cpop.api.cloudDb.handler.CloudStoreHandler;
|
||||
import com.cpop.api.tencent.location.handler.TencentLocationHandler;
|
||||
import com.cpop.common.utils.bean.BeanUtils;
|
||||
import com.cpop.core.base.entity.LoginUser;
|
||||
import com.cpop.core.base.entity.PageDomain;
|
||||
@ -127,6 +129,31 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
|
||||
StoreLicense storeLicense = BeanUtils.mapToClass(bo.getStoreInfo(), StoreLicense.class);
|
||||
storeLicense.setStoreId(store.getId());
|
||||
SpringUtils.getBean(StoreLicenseService.class).save(storeLicense);
|
||||
//添加线索以及
|
||||
Row clue = Row.ofKey(RowKey.SNOW_FLAKE_ID);
|
||||
clue.set("store_id",store.getId());
|
||||
//校区城市
|
||||
JSONObject geocoder = SpringUtils.getBean(TencentLocationHandler.class).geocoder(bo.getStoreInfo().getLongitude(), bo.getStoreInfo().getLatitude(), "UGLBZ-LBF3I-ETCGO-UUH5X-QDV45-3LFKA");
|
||||
if (geocoder.getInteger("status") == 0){
|
||||
clue.set("city",geocoder.getJSONObject("result").getJSONObject("ad_info").getString("city"));
|
||||
}
|
||||
clue.set("clue_status",0);
|
||||
clue.set("create_time", now);
|
||||
clue.set("update_time", now);
|
||||
clue.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
clue.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
Db.insert("cp_oam_clue",clue);
|
||||
//录入记录
|
||||
Row clueRecord = Row.ofKey(RowKey.SNOW_FLAKE_ID);
|
||||
clueRecord.set("clue_id",clue.getString("id"));
|
||||
clueRecord.set("record_type",0);
|
||||
clueRecord.set("record_content", "机构负责人" + store.getPersonCharge() + "创建线索");
|
||||
clueRecord.set("record_staff_id", "1");
|
||||
clueRecord.set("create_time", now);
|
||||
clueRecord.set("update_time", now);
|
||||
clueRecord.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
clueRecord.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||
Db.insert("cp_oam_clue_record",clueRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user