Commit 113d6187 by lal

Merge branch 'develop' of develop-gitlab.youlingrc.com:8timerv2/8timerapiv200 into lal

parents 7f676ce7 9433de9d
...@@ -53,17 +53,17 @@ public class CrmSeaRule extends Model<CrmSeaRule> { ...@@ -53,17 +53,17 @@ public class CrmSeaRule extends Model<CrmSeaRule> {
private Integer gid; private Integer gid;
@ApiModelProperty(value = "添加客户之后(one)天没有跟进 (以跟进记录为准)") @ApiModelProperty(value = "添加客户之后(one)天没有跟进 (以跟进记录为准)")
private Integer one; private int one;
@ApiModelProperty(value = "距上次跟进(two)天没有再次跟进 (以跟进记录为准)") @ApiModelProperty(value = "距上次跟进(two)天没有再次跟进 (以跟进记录为准)")
private Integer two; private int two;
@ApiModelProperty(value = "添加客户之后(three)天没有成交 (天数必须大于规则1)") @ApiModelProperty(value = "添加客户之后(three)天没有成交 (天数必须大于规则1)")
private Integer three; private int three;
@ApiModelProperty(value = "系统提前(four)天自动提醒业务员客户将被回收") @ApiModelProperty(value = "系统提前(four)天自动提醒业务员客户将被回收")
private Integer four; private int four;
// @ApiModelProperty(value = "我的客户数量最多(five)人(合作中的不算)") // @ApiModelProperty(value = "我的客户数量最多(five)人(合作中的不算)")
// private Integer five; // private int five;
} }
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
package cn.timer.api.controller.crm; package cn.timer.api.controller.crm;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
...@@ -18,7 +20,6 @@ import java.util.Map; ...@@ -18,7 +20,6 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -34,7 +35,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; ...@@ -34,7 +35,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader; import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
...@@ -52,7 +52,6 @@ import cn.timer.api.bean.crm.CrmSeaRule; ...@@ -52,7 +52,6 @@ import cn.timer.api.bean.crm.CrmSeaRule;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.controller.dzht.cn.tign.hz.comm.FileHelper;
import cn.timer.api.dao.crm.CrmClientContactsMapper; import cn.timer.api.dao.crm.CrmClientContactsMapper;
import cn.timer.api.dao.crm.CrmClientDataMapper; import cn.timer.api.dao.crm.CrmClientDataMapper;
import cn.timer.api.dto.crm.CrmClientDataImportVo; import cn.timer.api.dto.crm.CrmClientDataImportVo;
...@@ -77,8 +76,8 @@ import io.swagger.annotations.ApiOperation; ...@@ -77,8 +76,8 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping(value = "/crm", produces = { "application/json" }) @RequestMapping(value = "/crm", produces = { "application/json" })
public class CrmController { public class CrmController {
@Value(value = "${config-8timer.crm-excel.realPath}") // @Value(value = "${config-8timer.crm-excel.realPath}")
private String realPath; // private String realPath;
@Autowired @Autowired
private CrmClientDataMapper crmClientDataMapper; private CrmClientDataMapper crmClientDataMapper;
...@@ -104,6 +103,13 @@ public class CrmController { ...@@ -104,6 +103,13 @@ public class CrmController {
return getYg(orgCode, empNum).getName(); return getYg(orgCode, empNum).getName();
} }
// private Integer getQyzxManager(Integer orgCode, Integer empNum) {
// return YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager))
// .getIsManager();
// }
@GetMapping("getIndustry") @GetMapping("getIndustry")
@ApiOperation(value = "获取行业列表", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取行业列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<IndustryClass>> getIndustry(@CurrentUser UserBean userBean) { public Result<List<IndustryClass>> getIndustry(@CurrentUser UserBean userBean) {
...@@ -212,67 +218,99 @@ public class CrmController { ...@@ -212,67 +218,99 @@ public class CrmController {
@GetMapping("getBusinessGroup") @GetMapping("getBusinessGroup")
@ApiOperation(value = "获取业务组列表", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取业务组列表", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getBusinessGroup(@CurrentUser UserBean userBean) { public Result<Object> getBusinessGroup(@CurrentUser UserBean userBean) {
List<CrmBusinessGroup> list = CrmBusinessGroup.builder().build() Integer nowEmpNum = getEmpNum(userBean);
.selectList(new QueryWrapper<CrmBusinessGroup>().lambda() Integer orgCode = getOrgCode(userBean);
.eq(CrmBusinessGroup::getOrgCode, getOrgCode(userBean)).select(CrmBusinessGroup::getId,
CrmBusinessGroup::getSort, CrmBusinessGroup::getName, CrmBusinessGroup::getModifyTime));
for (CrmBusinessGroup crmBusinessGroup : list) {
Integer gid = crmBusinessGroup.getId();
List<CrmBusinessGroupMember> crmBusinessGroupManagers = CrmBusinessGroupMember.builder().build().selectList(
new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
.eq(CrmBusinessGroupMember::getType, 1).select(CrmBusinessGroupMember::getEmpNum));
List<CrmBusinessGroupMember> crmBusinessGroupMembers = CrmBusinessGroupMember.builder().build().selectList(
new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, gid)
.eq(CrmBusinessGroupMember::getType, 0).select(CrmBusinessGroupMember::getEmpNum));
List<Map<String, Object>> managers = new ArrayList<Map<String, Object>>();
for (CrmBusinessGroupMember crmBusinessGroupManager : crmBusinessGroupManagers) {
Integer empNum = crmBusinessGroupManager.getEmpNum();
String name = getEmpName(getOrgCode(userBean), empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
map.put("empNum", empNum);
managers.add(map);
}
crmBusinessGroup.setManagers(managers);
List<Map<String, Object>> members = new ArrayList<Map<String, Object>>(); YgglMainEmp yg = YgglMainEmp.builder().build()
for (CrmBusinessGroupMember crmBusinessGroupManager : crmBusinessGroupMembers) { .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
Integer empNum = crmBusinessGroupManager.getEmpNum(); .eq(YgglMainEmp::getEmpNum, nowEmpNum).select(YgglMainEmp::getIsManager));
String name = getEmpName(getOrgCode(userBean), empNum); if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name); List<CrmBusinessGroup> list = CrmBusinessGroup.builder().build()
map.put("empNum", empNum); .selectList(new QueryWrapper<CrmBusinessGroup>().lambda()
members.add(map); .eq(CrmBusinessGroup::getOrgCode, getOrgCode(userBean)).select(CrmBusinessGroup::getId,
CrmBusinessGroup::getSort, CrmBusinessGroup::getName,
CrmBusinessGroup::getModifyTime));
for (CrmBusinessGroup crmBusinessGroup : list) {
Integer gid = crmBusinessGroup.getId();
List<CrmBusinessGroupMember> crmBusinessGroupManagers = CrmBusinessGroupMember.builder().build()
.selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda()
.eq(CrmBusinessGroupMember::getGid, gid).eq(CrmBusinessGroupMember::getType, 1)
.eq(CrmBusinessGroupMember::getOrgCode, getOrgCode(userBean))
.select(CrmBusinessGroupMember::getEmpNum));
List<CrmBusinessGroupMember> crmBusinessGroupMembers = CrmBusinessGroupMember.builder().build()
.selectList(new QueryWrapper<CrmBusinessGroupMember>().lambda()
.eq(CrmBusinessGroupMember::getGid, gid).eq(CrmBusinessGroupMember::getType, 0)
.eq(CrmBusinessGroupMember::getOrgCode, getOrgCode(userBean))
.select(CrmBusinessGroupMember::getEmpNum));
List<Map<String, Object>> managers = new ArrayList<Map<String, Object>>();
for (CrmBusinessGroupMember crmBusinessGroupManager : crmBusinessGroupManagers) {
Integer empNum = crmBusinessGroupManager.getEmpNum();
String name = getEmpName(orgCode, empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
map.put("empNum", empNum);
managers.add(map);
}
crmBusinessGroup.setManagers(managers);
List<Map<String, Object>> members = new ArrayList<Map<String, Object>>();
for (CrmBusinessGroupMember crmBusinessGroupManager : crmBusinessGroupMembers) {
Integer empNum = crmBusinessGroupManager.getEmpNum();
String name = getEmpName(orgCode, empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
map.put("empNum", empNum);
members.add(map);
}
crmBusinessGroup.setMembers(members);
CrmSeaRule crmSeaRules = CrmSeaRule.builder().build()
.selectOne(new QueryWrapper<CrmSeaRule>().lambda().eq(CrmSeaRule::getGid, gid));
crmBusinessGroup.setCrmSeaRules(crmSeaRules);
} }
crmBusinessGroup.setMembers(members); return ResultUtil.data(list, "获取成功");
} else
return ResultUtil.error("暂无查看权限");
CrmSeaRule crmSeaRules = CrmSeaRule.builder().build()
.selectOne(new QueryWrapper<CrmSeaRule>().lambda().eq(CrmSeaRule::getGid, gid));
crmBusinessGroup.setCrmSeaRules(crmSeaRules);
}
return ResultUtil.data(list, "获取成功");
} }
@GetMapping("getBusinessGroupId") @GetMapping("getBusinessGroupId")
@ApiOperation(value = "获取业务组列表(id,name)", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取业务组列表(id,name)", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getBusinessGroupId(@CurrentUser UserBean userBean) { public Result<Object> getBusinessGroupId(@CurrentUser UserBean userBean) {
Integer empNum = getEmpNum(userBean);
List<CrmBusinessGroupMember> list = CrmBusinessGroupMember.builder().build() Integer nowEmpNum = getEmpNum(userBean);
.selectList(new LambdaQueryWrapper<CrmBusinessGroupMember>() Integer orgCode = getOrgCode(userBean);
.eq(CrmBusinessGroupMember::getEmpNum, empNum).select(CrmBusinessGroupMember::getGid));
List<Integer> gids = list.stream().map(CrmBusinessGroupMember::getGid).collect(Collectors.toList()).stream() YgglMainEmp yg = YgglMainEmp.builder().build()
.distinct().collect(Collectors.toList()); .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>(); .eq(YgglMainEmp::getEmpNum, nowEmpNum).select(YgglMainEmp::getIsManager));
for (Integer gid : gids) { if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
System.err.println(gid); List<CrmBusinessGroup> list = CrmBusinessGroup.builder().build()
String name = CrmBusinessGroup.builder().build().selectOne(new LambdaQueryWrapper<CrmBusinessGroup>() .selectList(new LambdaQueryWrapper<CrmBusinessGroup>().eq(CrmBusinessGroup::getOrgCode, orgCode)
.eq(CrmBusinessGroup::getId, gid).select(CrmBusinessGroup::getName)).getName(); .select(CrmBusinessGroup::getName, CrmBusinessGroup::getId));
Map<String, Object> map = new HashMap<String, Object>(); return ResultUtil.data(list, "获取成功");
map.put("id", gid); } else {
map.put("name", name); List<CrmBusinessGroupMember> list = CrmBusinessGroupMember.builder().build()
result.add(map); .selectList(new LambdaQueryWrapper<CrmBusinessGroupMember>()
.eq(CrmBusinessGroupMember::getEmpNum, getEmpNum(userBean))
.eq(CrmBusinessGroupMember::getOrgCode, getOrgCode(userBean))
.select(CrmBusinessGroupMember::getGid));
List<Integer> gids = list.stream().map(CrmBusinessGroupMember::getGid).collect(Collectors.toList()).stream()
.distinct().collect(Collectors.toList());
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
for (Integer gid : gids) {
String name = CrmBusinessGroup.builder().build().selectOne(new LambdaQueryWrapper<CrmBusinessGroup>()
.eq(CrmBusinessGroup::getId, gid).select(CrmBusinessGroup::getName)).getName();
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", gid);
map.put("name", name);
result.add(map);
}
return ResultUtil.data(result, "获取成功");
} }
return ResultUtil.data(result, "获取成功");
} }
// @GetMapping("getBusinessGroupMembers") // @GetMapping("getBusinessGroupMembers")
...@@ -535,25 +573,45 @@ public class CrmController { ...@@ -535,25 +573,45 @@ public class CrmController {
@RequestParam(required = false) Integer status, @RequestParam(required = false) String like) { @RequestParam(required = false) Integer status, @RequestParam(required = false) String like) {
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
// 当前用户加入的组
List<Integer> gids1 = MyJoinGroup(empNum, orgCode); YgglMainEmp yg = YgglMainEmp.builder().build()
// 当前用户管理的组 .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
List<Integer> gids2 = MyManageGroup(empNum, orgCode); .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
List<Integer> myGids = CheckUtil.distinct(gids1, gids2, true); // 当前用户所有业务组id if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
List<CrmClientData> crmClientDatas = new ArrayList<CrmClientData>();
for (Integer gid : myGids) { List<CrmClientData> list = CrmClientData.builder().build()
List<CrmClientData> datas = CrmClientData.builder().build() .selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getBelongGroup, gid)
.eq(CrmClientData::getBelongUser, 0) .eq(CrmClientData::getBelongUser, 0)
.eq(type != null && type >= 0, CrmClientData::getClientType, type) .eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId) .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status) .eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or() .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)); .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
for (CrmClientData data : datas)
crmClientDatas.add(data); return ResultUtil.data(list, "查询成功");
} else {
// 当前用户加入的组
List<Integer> gids1 = MyJoinGroup(empNum, orgCode);
// 当前用户管理的组
List<Integer> gids2 = MyManageGroup(empNum, orgCode);
List<Integer> myGids = CheckUtil.distinct(gids1, gids2, true); // 当前用户所有业务组id
List<CrmClientData> crmClientDatas = new ArrayList<CrmClientData>();
for (Integer gid : myGids) {
List<CrmClientData> datas = CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getBelongGroup, gid)
.eq(CrmClientData::getBelongUser, 0)
.eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
for (CrmClientData data : datas)
crmClientDatas.add(data);
}
return ResultUtil.data(crmClientDatas, "查询成功");
} }
return ResultUtil.data(crmClientDatas, "查询成功");
} }
@GetMapping("getAllCilentTotal") @GetMapping("getAllCilentTotal")
...@@ -565,14 +623,16 @@ public class CrmController { ...@@ -565,14 +623,16 @@ public class CrmController {
@RequestParam(required = false) String endCreateTime, @RequestParam(required = false) String endCreateTime,
@RequestParam(required = false) String startFollowTime, @RequestParam(required = false) String startFollowTime,
@RequestParam(required = false) String endFollowTime) { @RequestParam(required = false) String endFollowTime) {
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
// 当前用户管理的组
List<Integer> gids = MyManageGroup(empNum, orgCode); YgglMainEmp yg = YgglMainEmp.builder().build()
List<Object> crmClientDatas = new ArrayList<Object>(); .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
for (Integer gid : gids) { .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
List<CrmClientData> datas = CrmClientData.builder().build() List<CrmClientData> datas = CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getBelongGroup, gid) .selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId) .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type) .eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status) .eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
...@@ -582,10 +642,29 @@ public class CrmController { ...@@ -582,10 +642,29 @@ public class CrmController {
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime) .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or() .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)); .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
for (CrmClientData data : datas) return ResultUtil.data(datas, "查询成功");
crmClientDatas.add(data); } else {
// 当前用户管理的组
List<Integer> gids = MyManageGroup(empNum, orgCode);
List<Object> crmClientDatas = new ArrayList<Object>();
for (Integer gid : gids) {
List<CrmClientData> datas = CrmClientData.builder().build().selectList(new QueryWrapper<CrmClientData>()
.lambda().eq(CrmClientData::getBelongGroup, gid)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
for (CrmClientData data : datas)
crmClientDatas.add(data);
}
return ResultUtil.data(crmClientDatas, "查询成功");
} }
return ResultUtil.data(crmClientDatas, "查询成功");
} }
@PostMapping("addCilentLinkMan") @PostMapping("addCilentLinkMan")
...@@ -715,7 +794,7 @@ public class CrmController { ...@@ -715,7 +794,7 @@ public class CrmController {
crmClientData.updateById(); crmClientData.updateById();
return ResultUtil.success("封档成功"); return ResultUtil.success("封档成功");
} else if (status == 5) { } else if (status == 5) {
// crmClientData.setClientStatus(0); // 解封后默认无状态 crmClientData.setClientStatus(1); // 解封后默认潜在状态
crmClientData.updateById(); crmClientData.updateById();
return ResultUtil.success("解封成功"); return ResultUtil.success("解封成功");
} else } else
...@@ -944,9 +1023,6 @@ public class CrmController { ...@@ -944,9 +1023,6 @@ public class CrmController {
List<Integer> members = getAllBusinessGroupMember(orgCode, groupId); List<Integer> members = getAllBusinessGroupMember(orgCode, groupId);
for (Integer memberId : members) { for (Integer memberId : members) {
Map<String, Object> map = selectMap(orgCode, memberId, status, startCreateTime, endCreateTime); Map<String, Object> map = selectMap(orgCode, memberId, status, startCreateTime, endCreateTime);
if (memberId.equals(12414)) {
System.err.println("map++" + map);
}
if ((Integer) map.get("num") > 0) { if ((Integer) map.get("num") > 0) {
list.add(map); list.add(map);
} }
...@@ -1063,19 +1139,20 @@ public class CrmController { ...@@ -1063,19 +1139,20 @@ public class CrmController {
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
String filePath = null; // String filePath = null;
String time = null; // String time = null;
try { // try {
time = DateUtil.format(new Date(), "yyyyMMddHHmmssSSS"); // time = DateUtil.format(new Date(), "yyyyMMddHHmmssSSS");
filePath = FileHelper.downLoadFromUrl(url, time + ".xls", realPath); // filePath = FileHelper.downLoadFromUrl(url, time + ".xls", realPath);
System.err.println(filePath); // } catch (IOException e) {
} catch (IOException e) { // e.printStackTrace();
e.printStackTrace(); // }
}
// 从文件中读取Excel为ExcelReader // 从文件中读取Excel为ExcelReader
ExcelReader reader; ExcelReader reader;
// 从流中读取Excel为ExcelReader(比如从ClassPath中读取Excel文件) // 从流中读取Excel为ExcelReader(比如从ClassPath中读取Excel文件)
reader = ExcelUtil.getReader(ResourceUtil.getStream(filePath)); // reader = ExcelUtil.getReader(ResourceUtil.getStream(filePath));
// 从网络流OSS中读取excel资源
reader = getReaderByUrl(url);
reader.addHeaderAlias("*客户名称(必填)", "clientName"); reader.addHeaderAlias("*客户名称(必填)", "clientName");
reader.addHeaderAlias("*所属分组(必填)", "belongGroupName"); reader.addHeaderAlias("*所属分组(必填)", "belongGroupName");
reader.addHeaderAlias("行业", "industryName"); reader.addHeaderAlias("行业", "industryName");
...@@ -1095,7 +1172,6 @@ public class CrmController { ...@@ -1095,7 +1172,6 @@ public class CrmController {
reader.addHeaderAlias("个人地址", "linkAddress"); reader.addHeaderAlias("个人地址", "linkAddress");
List<CrmClientDataImportVo> list = reader.read(0, 1, CrmClientDataImportVo.class); List<CrmClientDataImportVo> list = reader.read(0, 1, CrmClientDataImportVo.class);
for (CrmClientDataImportVo crmClientDataImportVo : list) { for (CrmClientDataImportVo crmClientDataImportVo : list) {
System.err.println(crmClientDataImportVo);
String clientName = crmClientDataImportVo.getClientName(); // 客户名称(必填) String clientName = crmClientDataImportVo.getClientName(); // 客户名称(必填)
String belongGroupName = crmClientDataImportVo.getBelongGroupName(); // 分组名(必填) String belongGroupName = crmClientDataImportVo.getBelongGroupName(); // 分组名(必填)
...@@ -1120,8 +1196,7 @@ public class CrmController { ...@@ -1120,8 +1196,7 @@ public class CrmController {
// 业务组 // 业务组
CrmBusinessGroup crmBusinessGroup = CrmBusinessGroup.builder().build() CrmBusinessGroup crmBusinessGroup = CrmBusinessGroup.builder().build()
.selectOne(new LambdaQueryWrapper<CrmBusinessGroup>() .selectOne(new LambdaQueryWrapper<CrmBusinessGroup>().eq(CrmBusinessGroup::getOrgCode, orgCode)
.eq(CrmBusinessGroup::getOrgCode, userBean.getOrgCode())
.eq(CrmBusinessGroup::getName, belongGroupName).select(CrmBusinessGroup::getId)); .eq(CrmBusinessGroup::getName, belongGroupName).select(CrmBusinessGroup::getId));
if (crmBusinessGroup == null) if (crmBusinessGroup == null)
return ResultUtil.error("没有匹配的业务组名称"); return ResultUtil.error("没有匹配的业务组名称");
...@@ -1188,4 +1263,14 @@ public class CrmController { ...@@ -1188,4 +1263,14 @@ public class CrmController {
} }
return ResultUtil.success("导入成功"); return ResultUtil.success("导入成功");
} }
private ExcelReader getReaderByUrl(String url) {
InputStream is = null;
try {
is = new URL(url).openConnection().getInputStream();
} catch (IOException e) {
e.printStackTrace();
}
return ExcelUtil.getReader(is);
}
} }
...@@ -65,22 +65,24 @@ public class CrmRuleController { ...@@ -65,22 +65,24 @@ public class CrmRuleController {
Date now = new Date(); Date now = new Date();
// 客户创建时间+ x天 = 过期释放时间 // 客户创建时间+ x天 = 过期释放时间
DateTime overDate1 = DateUtil.offsetDay(createTime, one); DateTime overDate1 = DateUtil.offsetDay(createTime, one);
Long compare2 = null; long compare2 = 0;
if (lastFollowTime != null) { if (lastFollowTime != null) {
DateTime overDate2 = DateUtil.offsetDay(lastFollowTime, two); DateTime overDate2 = DateUtil.offsetDay(lastFollowTime, two);
compare2 = DateUtil.between(overDate2, now, DateUnit.DAY, false); compare2 = DateUtil.between(overDate2, now, DateUnit.DAY, false);
if (compare2 == -four)
remind(belongUserName, clientName, four);
} }
DateTime overDate3 = DateUtil.offsetDay(createTime, three); DateTime overDate3 = DateUtil.offsetDay(createTime, three);
// 时间比较 // 时间比较
long compare1 = DateUtil.between(overDate1, now, DateUnit.DAY, false); long compare1 = DateUtil.between(overDate1, now, DateUnit.DAY, false);
long compare3 = DateUtil.between(overDate3, now, DateUnit.DAY, false); long compare3 = DateUtil.between(overDate3, now, DateUnit.DAY, false);
// 判断1和2和3 // 判断1和2和3
if ((lastFollowTime == null && compare1 >= 0) || (lastFollowTime != null && compare2 >= 0) if ((lastFollowTime == null && compare1 >= 0) || (lastFollowTime != null && compare2 >= 0)
|| (compare3 >= 0 && status != 3 && status != 4)) || (compare3 >= 0 && status != 3 && status != 4))
release(crmClientData); release(crmClientData);
// 判断4 // 判断4
if (compare1 == -four || compare2 == -four || compare3 == -four) // TODO if (compare1 == -four || compare3 == -four)
remind(belongUserName, clientName, four); remind(belongUserName, clientName, four);
} }
} }
......
...@@ -201,9 +201,14 @@ public class DzhtController2 { ...@@ -201,9 +201,14 @@ public class DzhtController2 {
@PostMapping("/orgTemplate") @PostMapping("/orgTemplate")
@ApiOperation(value = "创建机构模板印章", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "创建机构模板印章", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> orgTemplate(@CurrentUser UserBean userBean, @RequestBody DzhtAssoQyyz qyyz) { public Result<Object> orgTemplate(@CurrentUser UserBean userBean, @RequestBody DzhtAssoQyyz qyyz) {
String orgId = DzhtAssoQyzc.builder().build().selectOne(
// new QueryWrapper<DzhtAssoQyzc>().eq("third_party_user_id", qyyz.getThirdPartyUserId()).select("org_id")) DzhtAssoQyzc yz = DzhtAssoQyzc.builder().build()
new QueryWrapper<DzhtAssoQyzc>().eq("org_code", userBean.getOrgCode()).select("org_id")).getOrgId();// 查询orgId .selectOne(new QueryWrapper<DzhtAssoQyzc>().eq("org_code", userBean.getOrgCode()).select("org_id"));
if (yz == null) {
return ResultUtil.error("请先在签约主体中进行企业认证");
}
String orgId = yz.getOrgId();// 查询orgId
// String orgId = "dfd84b9a58d345ea90f6711bad853435";// 测试公司账户 // String orgId = "dfd84b9a58d345ea90f6711bad853435";// 测试公司账户
// 印章参数 // 印章参数
String alias = qyyz.getAlias(); String alias = qyyz.getAlias();
......
...@@ -358,7 +358,7 @@ public class CmsController { ...@@ -358,7 +358,7 @@ public class CmsController {
// 查询条件 // 查询条件
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>(); QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("organization_id", userBean.getOrgCode()) queryWrapper.eq("organization_id", userBean.getOrgCode())
.select("id", "auditopinion", "modularid", "status", "title", "releasetime", "addeddate", "author", .select("id","publisher_name", "auditopinion", "modularid", "status", "title", "releasetime", "addeddate", "author",
"summary", "releasetype", "fmtpath") "summary", "releasetype", "fmtpath")
.ne("status", 1).eq(t != null && t > -1, "modularid", t) .ne("status", 1).eq(t != null && t > -1, "modularid", t)
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime", .between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime",
......
...@@ -9,6 +9,7 @@ package cn.timer.api.controller.qyzx; ...@@ -9,6 +9,7 @@ package cn.timer.api.controller.qyzx;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.timer.api.bean.qyzx.auth.QyzxAuthAccount; import cn.timer.api.bean.qyzx.auth.QyzxAuthAccount;
...@@ -170,4 +172,20 @@ public class QyzxAuthController { ...@@ -170,4 +172,20 @@ public class QyzxAuthController {
} }
@GetMapping(value = "/getYgAuth")
@ApiOperation(value = "获取全部权限信息", httpMethod = "GET", notes = "接口发布说明")
public Result<List<YgglMainEmp>> getYgAuth(@CurrentUser UserBean userBean) {
YgglMainEmp main = YgglMainEmp.builder().build()
.selectOne(new LambdaQueryWrapper<YgglMainEmp>().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getIsManager, 1).select(YgglMainEmp::getName, YgglMainEmp::getPhone,
YgglMainEmp::getEmpNum, YgglMainEmp::getIsManager));
List<YgglMainEmp> child = YgglMainEmp.builder().build()
.selectList(new LambdaQueryWrapper<YgglMainEmp>().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getIsManager, 2).select(YgglMainEmp::getName, YgglMainEmp::getPhone,
YgglMainEmp::getEmpNum, YgglMainEmp::getIsManager));
child.add(main);
return ResultUtil.data(child, "查询成功");
}
} }
...@@ -305,7 +305,7 @@ public class YgglController { ...@@ -305,7 +305,7 @@ public class YgglController {
if (ObjectUtil.isAllNotEmpty(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime()) if (ObjectUtil.isAllNotEmpty(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())
&& !DateFormatUtils.getCompareDate(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())) { && !DateFormatUtils.getCompareDate(ygglMainEmp.getRzTime(), ygglMainEmp.getZzTime())) {
ResultUtil.error("入职日期 不可以大于 转正日期"); return ResultUtil.error("入职日期 不可以大于 转正日期");
} }
if (ygglMainEmp.getEmpNum() != null) { if (ygglMainEmp.getEmpNum() != null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment