This commit is contained in:
2024-03-12 09:24:42 +08:00
28 changed files with 726 additions and 208 deletions

View File

@@ -84,7 +84,9 @@ public class SalesServiceImpl implements SalesService {
String sales_code = dto.getSales_code();
SalesDto unitDto = this.findByCode(sales_code);
if (unitDto != null) {
throw new BadRequestException("存在相同的编码");
if (unitDto.getArea().equals(dto.getArea())) {
throw new BadRequestException("存在相同区域的业务员!");
}
}
dto.setSales_id(IdUtil.getSnowflake(1, 1).nextId());

View File

@@ -416,7 +416,9 @@ public class AutoSendSalesIvt {
// 调用接口传送图片名称
JSONObject resultParam = lmsToMesService.sendSalesIvtMsg(fileName);
// 查询此区域的所有业务员
/*
* 查询此区域的所有业务员
*/
String area = result.getString("value");
List<JSONObject> areaList = WQLObject.getWQLObject("md_cs_areasalesinfo")
@@ -431,6 +433,27 @@ public class AutoSendSalesIvt {
})
.collect(Collectors.toList());
// 查询领导对用区域
String region_boss = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("REGION_PIC_BOSS").getValue();
// 截取编码
String[] userArr = region_boss.split(",");
for (String user : userArr) {
// 人员编码
String user_code = user.substring(0, user.indexOf("-"));
// 对应的区域编码
String area_code = user.substring(user.indexOf("-") + 1,user.length());
// 判断是包含此区域
if (area_code.contains(area)) {
JSONObject jsonUser = new JSONObject();
jsonUser.put("User",user_code);
userList.add(jsonUser);
}
}
// 调用接口返回飞书
JSONObject paramFeiShu = new JSONObject();
paramFeiShu.put("UserList", userList);

View File

@@ -40,11 +40,13 @@
IF 输入.flag = "1"
QUERY
SELECT
cust.*,
cust.cust_code,
cust.cust_name,
SUBSTRING_INDEX(cust.sales_owner, '|', 1) AS sales_owner,
info1.area
FROM
md_cs_customerbase cust
INNER JOIN md_cs_areasalesinfo info1 ON info1.sales_name = cust.sales_owner
INNER JOIN md_cs_areasalesinfo info1 ON info1.sales_name = SUBSTRING_INDEX(cust.sales_owner, '|', 1)
WHERE
cust.is_delete = '0'
AND cust.is_used = '1'