From 28759c5d681385b4ec6c77d00eb9854c192bde76 Mon Sep 17 00:00:00 2001 From: DB <2502523450@qq.com> Date: Wed, 21 Feb 2024 17:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E7=B4=A2=E5=BB=B6=E6=9C=9F;=E7=BA=BF?= =?UTF-8?q?=E7=B4=A2=E8=AE=B0=E5=BD=95;=E7=BA=BF=E7=B4=A2=E6=9B=B4?= =?UTF-8?q?=E6=96=B0;=E5=BB=B6=E6=9C=9F=E5=AE=A1=E6=A0=B8;=E7=BA=BF?= =?UTF-8?q?=E7=B4=A2=E8=B7=9F=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../location/core/constant/TencentApiUrl.java | 16 + .../handler/TencentLocationHandler.java | 38 ++ .../com/cpop/core/base/entity/PageDomain.java | 4 + .../java/com/cpop/oam/web/CpopApiTests.java | 8 + .../java/com/cpop/oam/web/CpopClueTests.java | 54 ++ .../oam/web/CpopEasyLearnDataAnalyseTest.java | 81 +++ .../com/cpop/oam/web/CpopEasyLearnTest.java | 10 +- .../cpop/oam/web/CpopOldDataSyncTests.java | 3 +- .../cpop/oam/business/bo/ClueFollowUpBo.java | 39 ++ .../cpop/oam/business/bo/CluePutOffBo.java | 51 ++ .../cpop/oam/business/bo/ClueUpdateBo.java | 56 ++ .../cpop/oam/business/bo/PutOffAuditBo.java | 34 ++ .../backstage/BackstageClueController.java | 226 ++++++- .../backstage/BackstagePutOffController.java | 57 ++ .../com/cpop/oam/business/entity/Clue.java | 7 +- .../cpop/oam/business/entity/CluePutOff.java | 80 +++ .../cpop/oam/business/entity/ClueRecord.java | 65 ++ .../cpop/oam/business/entity/ClueUpdate.java | 86 +++ .../cpop/oam/business/entity/SignGoal.java | 4 - .../oam/business/mapper/CluePutOffMapper.java | 14 + .../oam/business/mapper/ClueRecordMapper.java | 14 + .../oam/business/mapper/ClueUpdateMapper.java | 14 + .../business/service/CluePutOffService.java | 33 + .../business/service/ClueRecordService.java | 16 + .../oam/business/service/ClueService.java | 111 +++- .../business/service/ClueUpdateService.java | 14 + .../service/impl/BusinessServiceImpl.java | 83 ++- .../service/impl/CluePutOffServiceImpl.java | 115 ++++ .../service/impl/ClueRecordServiceImpl.java | 32 + .../service/impl/ClueServiceImpl.java | 566 +++++++++++++++++- .../service/impl/ClueUpdateServiceImpl.java | 18 + .../oam/business/vo/ClueFollowUpRecordVo.java | 45 ++ .../com/cpop/oam/business/vo/CluePageVo.java | 95 ++- .../cpop/oam/business/vo/CluePutOffVo.java | 63 ++ .../cpop/oam/business/vo/ClueRecordVo.java | 39 ++ .../cpop/oam/business/vo/ClueUpdateVo.java | 118 ++++ .../oam/business/vo/PersonSignGoalVo.java | 41 ++ .../oam/business/vo/PutOffAuditPageVo.java | 115 ++++ .../framework/tasks/OamScheduledTasks.java | 124 +++- .../resources/mapper/CluePutOffMapper.xml | 7 + .../resources/mapper/ClueRecordMapper.xml | 7 + .../resources/mapper/ClueUpdateMapper.xml | 7 + .../cpop/system/business/bo/StoreRenewBo.java | 2 +- .../service/impl/StoreServiceImpl.java | 27 + 44 files changed, 2599 insertions(+), 40 deletions(-) create mode 100644 Cpop-Api/src/main/java/com/cpop/api/tencent/location/core/constant/TencentApiUrl.java create mode 100644 Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java create mode 100644 Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java create mode 100644 Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueFollowUpBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/CluePutOffBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueUpdateBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/PutOffAuditBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/CluePutOff.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueRecord.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueUpdate.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/CluePutOffMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueRecordMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueUpdateMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/CluePutOffService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueRecordService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueUpdateService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueUpdateServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueFollowUpRecordVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePutOffVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueRecordVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueUpdateVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonSignGoalVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PutOffAuditPageVo.java create mode 100644 Cpop-Oam/src/main/resources/mapper/CluePutOffMapper.xml create mode 100644 Cpop-Oam/src/main/resources/mapper/ClueRecordMapper.xml create mode 100644 Cpop-Oam/src/main/resources/mapper/ClueUpdateMapper.xml diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/location/core/constant/TencentApiUrl.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/location/core/constant/TencentApiUrl.java new file mode 100644 index 0000000..a8bb10e --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/location/core/constant/TencentApiUrl.java @@ -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/"; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java new file mode 100644 index 0000000..1a0009c --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java @@ -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); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java index d89ef7b..9bac547 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java @@ -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)) { // 兼容前端排序类型 diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java index 092ed0f..edc0a96 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java @@ -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); + } } diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java new file mode 100644 index 0000000..4516df7 --- /dev/null +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java @@ -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); + } +} diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java new file mode 100644 index 0000000..4b25abc --- /dev/null +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnDataAnalyseTest.java @@ -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 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 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(); + } + } +} diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java index ee5ddfb..3c5daa6 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java @@ -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)); } diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java index 030a9ab..510da12 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java @@ -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(); diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueFollowUpBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueFollowUpBo.java new file mode 100644 index 0000000..b7f359c --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueFollowUpBo.java @@ -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; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/CluePutOffBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/CluePutOffBo.java new file mode 100644 index 0000000..eb0abfe --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/CluePutOffBo.java @@ -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; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueUpdateBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueUpdateBo.java new file mode 100644 index 0000000..8dcd9b8 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/ClueUpdateBo.java @@ -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; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/PutOffAuditBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/PutOffAuditBo.java new file mode 100644 index 0000000..96ae791 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/PutOffAuditBo.java @@ -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; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java index 04fc904..beed5b9 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java @@ -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> getPersonCluePage(@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 pageVo = clueService.getPersonCluePage(city, brandId, storeId, chargeOrPhone, staffId, signMonth); + public R> 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) { + Page pageVo = clueService.getPersonCluePage(clueStatus, city, brandId, storeId, chargeOrPhone, staffId); return R.ok(pageVo); } + /** + * 获取个人签约目标 + * @author DB + * @since 2024/2/20 + * @param signMonth 签约月份 + * @return R + */ + @ApiOperation("获取个人签约目标") + @GetMapping("/getPersonSignGoal") + public R 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 + */ + @ApiOperation("线索跟进") + @PostMapping("/clueFollowUp") + public R clueFollowUp(@Validated @RequestBody ClueFollowUpBo bo) { + clueService.clueFollowUp(bo); + return R.ok(); + } + + /** + * 线索跟进记录 + * @author DB + * @since 2024/2/20 + * @param clueId 线索id + * @return R> + */ + @ApiOperation("线索跟进记录") + @GetMapping("/getClueFollowUpRecord") + public R> getClueFollowUpRecord(@ApiParam(value = "线索id") @RequestParam(value = "clueId") String clueId) { + List 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> + */ + @ApiOperation("线索记录") + @GetMapping("/getClueRecordList") + public R> getClueRecordList(@ApiParam(value = "线索id") @RequestParam(value = "clueId") String clueId) { + List 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 + */ + @ApiOperation("线索更新") + @PostMapping("/clueUpdate") + public R clueUpdate(@Validated @RequestBody ClueUpdateBo bo) { + clueService.clueUpdate(bo); + return R.ok(); + } + + /** + * 线索更新记录 + * @author DB + * @since 2024/2/20 + * @param clueId 线索id + * @return R> + */ + @ApiOperation("线索更新记录") + @GetMapping("/getClueUpdateRecord") + public R 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 + */ + @ApiOperation("线索延期") + @PostMapping("/cluePutOff") + public R cluePutOff(@Validated @RequestBody CluePutOffBo bo) { + clueService.cluePutOff(bo); + return R.ok(); + } + + /** + * 线索延期记录 + * @author DB + * @since 2024/2/20 + * @param clueId 线索id + * @return R> + */ + @ApiOperation("线索延期记录") + @GetMapping("/getCluePutOffRecord") + public R> getCluePutOffRecord(@ApiParam(value = "线索id") @RequestParam(value = "clueId") String clueId) { + List vos = clueService.getCluePutOffRecord(clueId); + return R.ok(vos); + } + + /** + * 线索脱离 + * @author DB + * @since 2024/2/20 + * @param id 线索id + * @return R + */ + @ApiOperation("线索脱离") + @PutMapping("/clueDetachment/{id}") + public R clueDetachment(@PathVariable @ApiParam(value = "线索id") String id) { + clueService.clueDetachment(id); + return R.ok(); + } + + /** + * 地区线索分页 + * @author DB + * @since 2024/2/19 + * @return R> + */ + @ApiOperation("地区线索分页") + @GetMapping("/getAreaCluePage") + public R> 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 pageVo = clueService.getAreaCluePage( city, brandId, storeId, chargeOrPhone); + return R.ok(pageVo); + } + + /** + * 公共线索分页 + * @author DB + * @since 2024/2/19 + * @return R> + */ + @ApiOperation("公共线索分页") + @GetMapping("/getPublicCluePage") + public R> 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 pageVo = clueService.getPublicCluePage( city, brandId, storeId, chargeOrPhone); + return R.ok(pageVo); + } + + /** + * 线索领取 + * @author DB + * @since 2024/2/20 + * @param id 线索id + * @return R + */ + @ApiOperation("线索领取") + @PutMapping("/clueCollection/{id}") + public R clueCollection(@PathVariable @ApiParam(value = "线索id") String id) { + clueService.clueCollection(id); + return R.ok(); + } + + /** + * 我的开发分页 + * @author DB + * @since 2024/2/19 + * @return R> + */ + @ApiOperation("我的开发分页") + @GetMapping("/getMyDevCluePage") + public R> 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 pageVo = clueService.getMyDevCluePage( city, brandId, storeId, chargeOrPhone); + return R.ok(pageVo); + } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java new file mode 100644 index 0000000..e0e798b --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java @@ -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> + */ + @ApiOperation("延期审核分页") + @GetMapping("/getPutOffAuditPage") + public R> getPutOffAuditPage() { + Page pageVo = cluePutOffService.getPutOffAuditPage(); + return R.ok(pageVo); + } + + /** + * 延期审核选择 + * @author DB + * @since 2024/2/21 + * @param bo 通过与驳回 + * @return R + */ + @ApiOperation("延期审核选择") + @PutMapping("/putOffAuditSelect") + public R putOffAuditSelect(@RequestBody @Validated PutOffAuditBo bo) { + cluePutOffService.putOffAuditSelect(bo); + return R.ok(); + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Clue.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Clue.java index 8d7f47a..afe420a 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Clue.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Clue.java @@ -69,9 +69,10 @@ public class Clue extends BaseEntity implements Serializable { */ private LocalDateTime receiptTime; - - - + /** + * 签约状态(0:待签约;1:已签约;2:警告线索) + */ + private Integer clueStatus; /** * 是否删除(0否1是) diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/CluePutOff.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/CluePutOff.java new file mode 100644 index 0000000..af9da78 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/CluePutOff.java @@ -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; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueRecord.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueRecord.java new file mode 100644 index 0000000..187ec42 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueRecord.java @@ -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; + + + + + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueUpdate.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueUpdate.java new file mode 100644 index 0000000..54093f0 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/ClueUpdate.java @@ -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; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SignGoal.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SignGoal.java index 1be1231..3e258d3 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SignGoal.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/SignGoal.java @@ -164,10 +164,6 @@ public class SignGoal extends BaseEntity implements Serializable { */ private Integer decFinish; - - - - /** * 逻辑删除(0否1是) */ diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/CluePutOffMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/CluePutOffMapper.java new file mode 100644 index 0000000..06497d1 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/CluePutOffMapper.java @@ -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 { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueRecordMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueRecordMapper.java new file mode 100644 index 0000000..45bc038 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueRecordMapper.java @@ -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 { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueUpdateMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueUpdateMapper.java new file mode 100644 index 0000000..2cf87a1 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/ClueUpdateMapper.java @@ -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 { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/CluePutOffService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/CluePutOffService.java new file mode 100644 index 0000000..9426903 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/CluePutOffService.java @@ -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 { + + /** + * 延期审核分页 + * @author DB + * @since 2024/2/21 + * @return Page + */ + Page getPutOffAuditPage();; + + /** + * 延期审核选择 + * @author DB + * @since 2024/2/21 + * @param bo 通过与驳回 + * @return R + */ + void putOffAuditSelect(PutOffAuditBo bo); +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueRecordService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueRecordService.java new file mode 100644 index 0000000..eb25116 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueRecordService.java @@ -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 { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueService.java index 12c6353..7a47c4e 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueService.java @@ -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 { * @since 2024/2/19 * @return R> */ - Page getPersonCluePage(String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth); + Page 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 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 + */ + Page 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 + */ + Page 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 + */ + Page getMyDevCluePage(String city, String brandId, String storeId, String chargeOrPhone); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueUpdateService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueUpdateService.java new file mode 100644 index 0000000..1180d5d --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/ClueUpdateService.java @@ -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 { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java index c943238..2ced07e 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java @@ -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 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 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; + } + } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java new file mode 100644 index 0000000..b1a14f6 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java @@ -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 implements CluePutOffService { + + /** + * 延期审核分页 + * @author DB + * @since 2024/2/21 + * @return Page + */ + @Override + public Page 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); + } + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java new file mode 100644 index 0000000..37aa988 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java @@ -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 implements ClueRecordService { + + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java index edf321b..51dd4c4 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java @@ -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 implements Cl * @return R> */ @Override - public Page getPersonCluePage(String city, String brandId, String storeId, String chargeOrPhone, String staffId, String signMonth) { - return null; + public Page 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 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> + */ + @Override + public List 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 + */ + @Override + public Page 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 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 + */ + @Override + public Page getPublicCluePage(String city, String brandId, String storeId, String chargeOrPhone) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + QueryWrapper queryWrapper = QueryWrapper.create(); + int year = LocalDate.now().getYear(); + List 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 + */ + @Override + public Page 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; + } + })); } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueUpdateServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueUpdateServiceImpl.java new file mode 100644 index 0000000..67012fd --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueUpdateServiceImpl.java @@ -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 implements ClueUpdateService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueFollowUpRecordVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueFollowUpRecordVo.java new file mode 100644 index 0000000..c564383 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueFollowUpRecordVo.java @@ -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; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePageVo.java index 3e44eb6..df783cc 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePageVo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePageVo.java @@ -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; + } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePutOffVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePutOffVo.java new file mode 100644 index 0000000..ce31380 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/CluePutOffVo.java @@ -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; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueRecordVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueRecordVo.java new file mode 100644 index 0000000..dc80995 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueRecordVo.java @@ -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; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueUpdateVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueUpdateVo.java new file mode 100644 index 0000000..8d01d62 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/ClueUpdateVo.java @@ -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 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; + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonSignGoalVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonSignGoalVo.java new file mode 100644 index 0000000..46717d2 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonSignGoalVo.java @@ -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; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PutOffAuditPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PutOffAuditPageVo.java new file mode 100644 index 0000000..064aca1 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PutOffAuditPageVo.java @@ -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; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java index 1a66f35..c06d724 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java @@ -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 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 clueList = clueService.queryChain() + .where(CLUE.RESPONSIBLE_STAFF_ID.isNotNull()) + .and(CLUE.CLUE_STATUS.ne(1)) + .list(); + if (!clueList.isEmpty()){ + List followOffClueList = new ArrayList<>(); + List signOffClueList = new ArrayList<>(); + List 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 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); + } + } + } + } } diff --git a/Cpop-Oam/src/main/resources/mapper/CluePutOffMapper.xml b/Cpop-Oam/src/main/resources/mapper/CluePutOffMapper.xml new file mode 100644 index 0000000..f644293 --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/CluePutOffMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/src/main/resources/mapper/ClueRecordMapper.xml b/Cpop-Oam/src/main/resources/mapper/ClueRecordMapper.xml new file mode 100644 index 0000000..36a7ac1 --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/ClueRecordMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/src/main/resources/mapper/ClueUpdateMapper.xml b/Cpop-Oam/src/main/resources/mapper/ClueUpdateMapper.xml new file mode 100644 index 0000000..7daf610 --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/ClueUpdateMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-System/src/main/java/com/cpop/system/business/bo/StoreRenewBo.java b/Cpop-System/src/main/java/com/cpop/system/business/bo/StoreRenewBo.java index a333d60..cc83d3b 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/bo/StoreRenewBo.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/bo/StoreRenewBo.java @@ -56,7 +56,7 @@ public class StoreRenewBo { private String annexUrl; /** - * 类型(0:续费;1:延期) + * 类型(0:续费;1:延期;2:激活) */ @NotNull(message = "类型不能为空") @ApiModelProperty(value = "类型(0:续费;1:延期;2:激活)", required = true) diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java index bf4350a..c281313 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java @@ -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 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); } /**