Commit eda54634 by lal

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

parents 7dd32824 a56c60a9
...@@ -4,7 +4,6 @@ import java.io.IOException; ...@@ -4,7 +4,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -24,7 +23,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -24,7 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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 com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
...@@ -49,6 +50,7 @@ import cn.timer.api.config.annotation.UserBean; ...@@ -49,6 +50,7 @@ import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.SysRoleType; import cn.timer.api.config.enums.SysRoleType;
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.CrmCartogramDto;
import cn.timer.api.dto.crm.CrmClientDataImportVo; import cn.timer.api.dto.crm.CrmClientDataImportVo;
import cn.timer.api.utils.CheckUtil; import cn.timer.api.utils.CheckUtil;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
...@@ -445,7 +447,7 @@ public class CrmController { ...@@ -445,7 +447,7 @@ public class CrmController {
} }
List<Integer> addList = CheckUtil.reduce(newIdsList, oldIdsList); // 要加的协助人 List<Integer> addList = CheckUtil.reduce(newIdsList, oldIdsList); // 要加的协助人
for (Integer id : addList) { for (Integer id : addList) {
CrmClientAssociate.builder().cid(cid).associateId(id).build().insert(); CrmClientAssociate.builder().cid(cid).associateId(id).orgCode(getOrgCode(userBean)).build().insert();
} }
crmClientData.setModifyUser(getEmpNum(userBean)); crmClientData.setModifyUser(getEmpNum(userBean));
if (crmClientData.updateById()) if (crmClientData.updateById())
...@@ -531,12 +533,20 @@ public class CrmController { ...@@ -531,12 +533,20 @@ public class CrmController {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private <T> List<T> getPageList(List<T> list, int pageNumber, int pageSize, Comparator<T> comparator) {
return list.stream().sorted(comparator).skip((pageNumber - 1) * pageSize).limit(pageSize)
.collect(Collectors.toList());
}
@GetMapping("getMyCilentTotal") @GetMapping("getMyCilentTotal")
@ApiOperation(value = "获取我的客户列表(全)", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取我的客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getMyCilentTotal(@CurrentUser UserBean userBean, public Result<List<CrmClientData>> getMyCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false, defaultValue = "0") Integer type, @RequestParam(required = false, defaultValue = "0") Integer type,
@RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer status, @RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer status,
@RequestParam(required = false) String like) { @RequestParam(required = false) String like,
@RequestParam(required = false, defaultValue = "1") int pageNumber,
@RequestParam(required = false, defaultValue = "10") int pageSize) {
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
List<CrmClientData> crmClientDatas = null; List<CrmClientData> crmClientDatas = null;
...@@ -555,8 +565,16 @@ public class CrmController { ...@@ -555,8 +565,16 @@ public class CrmController {
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status); crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status);
else else
return ResultUtil.error("查询失败"); return ResultUtil.error("查询失败");
Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序 // Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
return ResultUtil.data(crmClientDatas, "查询成功");
// int pageNumber = 1;
// int pageSize = 10;
List<CrmClientData> result = getPageList(crmClientDatas, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) result.size(), "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
} }
private List<Integer> MyJoinGroup(Integer empNum, Integer orgCode) { private List<Integer> MyJoinGroup(Integer empNum, Integer orgCode) {
...@@ -578,7 +596,9 @@ public class CrmController { ...@@ -578,7 +596,9 @@ public class CrmController {
@ApiOperation(value = "获取公海客户列表(全)", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取公海客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getSeaCilentTotal(@CurrentUser UserBean userBean, public Result<List<CrmClientData>> getSeaCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false) Integer type, @RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer groupId,
@RequestParam(required = false) Integer status, @RequestParam(required = false) String like) { @RequestParam(required = false) Integer status, @RequestParam(required = false) String like,
@RequestParam(required = false, defaultValue = "1") int pageNumber,
@RequestParam(required = false, defaultValue = "10") int pageSize) {
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
...@@ -602,7 +622,14 @@ public class CrmController { ...@@ -602,7 +622,14 @@ public class CrmController {
.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));
return ResultUtil.data(list, "查询成功"); // int pageNumber = 1;
// int pageSize = 5;
List<CrmClientData> result = getPageList(list, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) list.size(), "查询成功");
// return ResultUtil.data(list, "查询成功");
} else { } else {
...@@ -624,7 +651,11 @@ public class CrmController { ...@@ -624,7 +651,11 @@ public class CrmController {
for (CrmClientData data : datas) for (CrmClientData data : datas)
crmClientDatas.add(data); crmClientDatas.add(data);
} }
return ResultUtil.data(crmClientDatas, "查询成功"); List<CrmClientData> result = getPageList(crmClientDatas, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) crmClientDatas.size(), "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
} }
} }
...@@ -636,7 +667,9 @@ public class CrmController { ...@@ -636,7 +667,9 @@ public class CrmController {
@RequestParam(required = false) String startCreateTime, @RequestParam(required = false) String startCreateTime,
@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,
@RequestParam(required = false, defaultValue = "1") int pageNumber,
@RequestParam(required = false, defaultValue = "10") int pageSize) {
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
...@@ -652,8 +685,10 @@ public class CrmController { ...@@ -652,8 +685,10 @@ public class CrmController {
&& (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType() && (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()
|| qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) { || qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) {
List<CrmClientData> datas = CrmClientData.builder().build() IPage<CrmClientData> page = new Page<CrmClientData>(pageNumber, pageSize);
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
IPage<CrmClientData> datas = CrmClientData.builder().build().selectPage(page,
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)
...@@ -662,13 +697,15 @@ public class CrmController { ...@@ -662,13 +697,15 @@ public class CrmController {
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime) .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime)
.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)
return ResultUtil.data(datas, "查询成功"); .orderByDesc(CrmClientData::getCreateTime));
return ResultUtil.pageData(datas.getRecords(), datas.getTotal(), "查询成功");
} else { } else {
// 当前用户管理的组 // 当前用户管理的组
List<Integer> gids = MyManageGroup(empNum, orgCode); List<Integer> gids = MyManageGroup(empNum, orgCode);
List<Object> crmClientDatas = new ArrayList<Object>(); List<CrmClientData> crmClientDatas = new ArrayList<CrmClientData>();
for (Integer gid : gids) { for (Integer gid : gids) {
List<CrmClientData> datas = CrmClientData.builder().build().selectList(new QueryWrapper<CrmClientData>() List<CrmClientData> datas = CrmClientData.builder().build().selectList(new QueryWrapper<CrmClientData>()
.lambda().eq(CrmClientData::getBelongGroup, gid) .lambda().eq(CrmClientData::getBelongGroup, gid)
...@@ -684,7 +721,12 @@ public class CrmController { ...@@ -684,7 +721,12 @@ public class CrmController {
for (CrmClientData data : datas) for (CrmClientData data : datas)
crmClientDatas.add(data); crmClientDatas.add(data);
} }
return ResultUtil.data(crmClientDatas, "查询成功");
List<CrmClientData> result = getPageList(crmClientDatas, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) crmClientDatas.size(), "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
} }
} }
...@@ -969,23 +1011,25 @@ public class CrmController { ...@@ -969,23 +1011,25 @@ public class CrmController {
} }
listAll.add(cartogram5); listAll.add(cartogram5);
List<Map<String, Object>> cartogram6 = new ArrayList<Map<String, Object>>(); // 图6 // List<Map<String, Object>> cartogram6 = new ArrayList<Map<String, Object>>(); // 图6
for (Integer keyId : getKeyIdList()) { // for (Integer keyId : getKeyIdList()) {
Map<String, Object> map = cartogram3(orgCode, groupId, keyId, belonger, startCreateTime, endCreateTime); // Map<String, Object> map = cartogram3(orgCode, groupId, keyId, belonger, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0) { // if ((Integer) map.get("num") > 0) {
cartogram6.add(map); // cartogram6.add(map);
} // }
} // }
List<CrmCartogramDto> cartogram6 = getCartogram6(orgCode, belonger, groupId, startCreateTime, endCreateTime);
listAll.add(cartogram6); listAll.add(cartogram6);
return ResultUtil.data(listAll, "获取成功"); return ResultUtil.data(listAll, "获取成功");
} }
// 获取省份id // 获取省份id
private List<Integer> getKeyIdList() { // private List<Integer> getKeyIdList() {
List<SysRegion> list = SysRegion.builder().build() // List<SysRegion> list = SysRegion.builder().build()
.selectList(new LambdaQueryWrapper<SysRegion>().eq(SysRegion::getLevel, 1).select(SysRegion::getKeyId)); // .selectList(new LambdaQueryWrapper<SysRegion>().eq(SysRegion::getLevel, 1).select(SysRegion::getKeyId));
return list.stream().map(SysRegion::getKeyId).collect(Collectors.toList()); // return list.stream().map(SysRegion::getKeyId).collect(Collectors.toList());
} // }
@GetMapping("getAllBusinessMan") @GetMapping("getAllBusinessMan")
@ApiOperation(value = "获取全部业务员", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "获取全部业务员", httpMethod = "GET", notes = "接口发布说明")
...@@ -1001,6 +1045,24 @@ public class CrmController { ...@@ -1001,6 +1045,24 @@ public class CrmController {
return ResultUtil.data(list, "获取成功"); return ResultUtil.data(list, "获取成功");
} }
@GetMapping("getBusinessManByGroupId")
@ApiOperation(value = "获取业务员ByGroupId", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getBusinessManByGroupId(@CurrentUser UserBean userBean, Integer gid) {
List<CrmBusinessGroupMember> list = CrmBusinessGroupMember.builder().build()
.selectList(new LambdaQueryWrapper<CrmBusinessGroupMember>().eq(CrmBusinessGroupMember::getGid, gid)
.select(CrmBusinessGroupMember::getEmpNum));
List<Integer> empNums = list.stream().map(CrmBusinessGroupMember::getEmpNum).collect(Collectors.toList());
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
for (Integer empNum : empNums) {
String name = getEmpName(getOrgCode(userBean), empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
map.put("empNum", empNum);
result.add(map);
}
return ResultUtil.data(result, "获取成功");
}
// 获取公司全部业务员 // 获取公司全部业务员
private List<Integer> getAllBusinessGroupMember(Integer orgCode, Integer groupId) { private List<Integer> getAllBusinessGroupMember(Integer orgCode, Integer groupId) {
List<CrmBusinessGroupMember> list = CrmBusinessGroupMember.builder().build() List<CrmBusinessGroupMember> list = CrmBusinessGroupMember.builder().build()
...@@ -1013,16 +1075,22 @@ public class CrmController { ...@@ -1013,16 +1075,22 @@ public class CrmController {
} }
// 封装条形图数据Map // 封装条形图数据Map
private Map<String, Object> selectMap(Integer orgCode, Integer belonger, Integer status, String startCreateTime, private Map<String, Object> selectMap(Integer orgCode, Integer groupId, Integer belonger, Integer status,
String endCreateTime) { String startCreateTime, String endCreateTime) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Integer num = CrmClientData.builder().build() Integer num = CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode) .selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getClientStatus, status) .eq(CrmClientData::getClientStatus, status)
.eq(belonger != null, CrmClientData::getBelongUser, belonger) .eq(belonger != null, CrmClientData::getBelongUser, belonger)
.eq(groupId != null, CrmClientData::getBelongGroup, groupId)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime) .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)); .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime));
String name = getEmpName(orgCode, belonger); String name = "未知";
if (belonger == 0)
name = "公海客户";
else if (belonger > 0)
name = getEmpName(orgCode, belonger);
map.put("name", name); map.put("name", name);
map.put("num", num); map.put("num", num);
return map; return map;
...@@ -1043,13 +1111,17 @@ public class CrmController { ...@@ -1043,13 +1111,17 @@ public class CrmController {
if (belonger == null) { if (belonger == null) {
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, groupId, memberId, status, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0) { if ((Integer) map.get("num") > 0) {
list.add(map); list.add(map);
} }
} }
Map<String, Object> map = selectMap(orgCode, groupId, 0, status, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0)
list.add(map);
} else { } else {
Map<String, Object> map = selectMap(orgCode, belonger, status, startCreateTime, endCreateTime); Map<String, Object> map = selectMap(orgCode, groupId, belonger, status, startCreateTime, endCreateTime);
if ((Integer) map.get("num") > 0) { if ((Integer) map.get("num") > 0) {
list.add(map); list.add(map);
} }
...@@ -1076,11 +1148,21 @@ public class CrmController { ...@@ -1076,11 +1148,21 @@ public class CrmController {
num += CrmClientData.builder().build() num += CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode) .selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getClientType, level).eq(CrmClientData::getBelongUser, memberId) .eq(CrmClientData::getClientType, level).eq(CrmClientData::getBelongUser, memberId)
.eq(groupId != null, CrmClientData::getBelongGroup, groupId)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime,
startCreateTime) startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime,
endCreateTime)); endCreateTime));
} }
num += CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getClientType, level).eq(CrmClientData::getBelongUser, 0)
.eq(groupId != null, CrmClientData::getBelongGroup, groupId)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime));
map.put("level", level); map.put("level", level);
String name = ClientTypeClass.builder().id(level).build().selectById().getName(); String name = ClientTypeClass.builder().id(level).build().selectById().getName();
map.put("name", name); map.put("name", name);
...@@ -1109,42 +1191,56 @@ public class CrmController { ...@@ -1109,42 +1191,56 @@ public class CrmController {
* @param belonger 业务员id (可不填) * @param belonger 业务员id (可不填)
* @return * @return
*/ */
private Map<String, Object> cartogram3(Integer orgCode, Integer groupId, Integer provinceId, Integer belonger, // private Map<String, Object> cartogram3(Integer orgCode, Integer groupId, Integer provinceId, Integer belonger,
String startCreateTime, String endCreateTime) { // String startCreateTime, String endCreateTime) {
Map<String, Object> map = new HashMap<String, Object>(); // Map<String, Object> map = new HashMap<String, Object>();
Integer num = 0; // Integer num = 0;
if (belonger == null) { // if (belonger == null) {
List<Integer> members = getAllBusinessGroupMember(orgCode, groupId); //
for (Integer memberId : members) { // List<Integer> members = getAllBusinessGroupMember(orgCode, groupId);
num += CrmClientData.builder().build() // for (Integer memberId : members) {
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode) // num += CrmClientData.builder().build()
.eq(CrmClientData::getProvinceId, provinceId).eq(CrmClientData::getBelongUser, memberId) // .selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, // .eq(CrmClientData::getProvinceId, provinceId).eq(CrmClientData::getBelongUser, memberId)
startCreateTime) // .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime,
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, // startCreateTime)
endCreateTime)); // .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime,
} // endCreateTime));
map.put("provinceId", provinceId); // }
String name = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda() // map.put("provinceId", provinceId);
.eq(SysRegion::getLevel, 1).eq(SysRegion::getKeyId, provinceId).select(SysRegion::getRegionName)) // String name = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda()
.getRegionName(); // .eq(SysRegion::getLevel, 1).eq(SysRegion::getKeyId, provinceId).select(SysRegion::getRegionName))
map.put("provinceName", name); // .getRegionName();
map.put("num", num); // map.put("provinceName", name);
// map.put("num", num);
//
// } else {
// num = CrmClientData.builder().build()
// .selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
// .eq(CrmClientData::getProvinceId, provinceId).eq(CrmClientData::getBelongUser, belonger)
// .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
// .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime));
// map.put("provinceId", provinceId);
// String name = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda()
// .eq(SysRegion::getLevel, 1).eq(SysRegion::getKeyId, provinceId).select(SysRegion::getRegionName))
// .getRegionName();
// map.put("provinceName", name);
// map.put("num", num);
// }
// return map;
// }
} else { /**
num = CrmClientData.builder().build() * 统计图6-籍贯
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode) *
.eq(CrmClientData::getProvinceId, provinceId).eq(CrmClientData::getBelongUser, belonger) * @param orgCode
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime) * @param belongGroup
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)); * @param createTime
map.put("provinceId", provinceId); * @return
String name = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda() */
.eq(SysRegion::getLevel, 1).eq(SysRegion::getKeyId, provinceId).select(SysRegion::getRegionName)) private List<CrmCartogramDto> getCartogram6(Integer orgCode, Integer belongUser, Integer belongGroup,
.getRegionName(); String startCreateTime, String endCreateTime) {
map.put("provinceName", name); return crmClientDataMapper.crmCartogram(orgCode, belongUser, belongGroup, startCreateTime, endCreateTime);
map.put("num", num);
}
return map;
} }
/** /**
......
...@@ -36,7 +36,7 @@ import cn.timer.api.bean.crm.CrmSeaRule; ...@@ -36,7 +36,7 @@ import cn.timer.api.bean.crm.CrmSeaRule;
@Component @Component
public class CrmRuleController { public class CrmRuleController {
@Scheduled(cron = "0 0 0/1 * * ? ") // 每小时扫描 @Scheduled(cron = "0 0 10 * * ? ") // 每小时扫描
@Transactional @Transactional
public void getRules() { public void getRules() {
// 全部业务组规则 // 全部业务组规则
......
...@@ -7,13 +7,17 @@ ...@@ -7,13 +7,17 @@
*/ */
package cn.timer.api.dao.crm; package cn.timer.api.dao.crm;
import java.util.List;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.crm.CrmClientData; import cn.timer.api.bean.crm.CrmClientData;
import cn.timer.api.dto.crm.CrmCartogramDto;
/** /**
* Title: CrmClientDataMapper.java * Title: CrmClientDataMapper.java Description:
* Description:
* *
* @author dsc * @author dsc
* @date 2020年6月5日 * @date 2020年6月5日
...@@ -21,4 +25,9 @@ import cn.timer.api.bean.crm.CrmClientData; ...@@ -21,4 +25,9 @@ import cn.timer.api.bean.crm.CrmClientData;
*/ */
public interface CrmClientDataMapper extends BaseMapper<CrmClientData> { public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
List<CrmCartogramDto> crmCartogram(@RequestParam("orgCode") Integer orgCode,
@RequestParam(name = "belongUser", required = false) Integer belongUser,
@RequestParam(name = "belongGroup", required = false) Integer belongGroup,
@RequestParam(name = "startCreateTime", required = false) String startCreateTime,
@RequestParam(name = "endCreateTime", required = false) String endCreateTime);
} }
/**
* Title: CrmCartogramDto.java
* Description:
* @author dsc
* @date 2020年6月22日
* @version 1.0
*/
package cn.timer.api.dto.crm;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Title: CrmCartogramDto.java
*
* @Description:
* @author dsc
* @date 2020年6月22日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CrmCartogramDto implements Serializable {
private static final long serialVersionUID = -4445892627839823485L;
private Integer provinceId;
private String provinceName;
private Integer num;
}
...@@ -17,7 +17,7 @@ import lombok.NoArgsConstructor; ...@@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
/** /**
* Title: CrmClientDataImportVo.java * Title: CrmClientDataImportVo.java
* *
* @Description: * @Description: 客户导入
* @author dsc * @author dsc
* @date 2020年6月12日 * @date 2020年6月12日
* @version 1.0 * @version 1.0
......
...@@ -550,10 +550,14 @@ public class RouterUtils { ...@@ -550,10 +550,14 @@ public class RouterUtils {
//在 原审批人 列表中 插入 一个被转派人(审批人) //在 原审批人 列表中 插入 一个被转派人(审批人)
}else if (sts == ExecutorSts.REDEPLOY.ordinal()) { }else if (sts == ExecutorSts.REDEPLOY.ordinal()) {
List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1); List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1);
redeployUser.setExecute(UNEXECUTED);
users1.add(redeployUser); users1.add(redeployUser);
List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size()); List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size());
System.out.println(users1);
System.out.println(users2);
listUser = ListUtils.union(users1, users2); listUser = ListUtils.union(users1, users2);
n_user = listUser.size(); n_user = listUser.size();
System.out.println(listUser);
} }
}else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) { }else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) {
SpmkExecutor.builder() SpmkExecutor.builder()
......
...@@ -39,7 +39,7 @@ public class ReissueACardBusiness extends SpmkAssoBusiness { ...@@ -39,7 +39,7 @@ public class ReissueACardBusiness extends SpmkAssoBusiness {
String PatchCardTime = ObjectUtil.isNull(jsonObj.get("__PatchCardTime",FromData.class)) ? null : jsonObj.get("__PatchCardTime",FromData.class).getValue(); String PatchCardTime = ObjectUtil.isNull(jsonObj.get("__PatchCardTime",FromData.class)) ? null : jsonObj.get("__PatchCardTime",FromData.class).getValue();
// 缺卡原因 // 缺卡原因
String cardShortage = ObjectUtil.isNull(jsonObj.get("cardShortage",FromData.class)) ? null : jsonObj.get("cardShortage",FromData.class).getValue(); String cardShortage = ObjectUtil.isNull(jsonObj.get("cardShortage",FromData.class)) ? null : jsonObj.get("cardShortage",FromData.class).getValue();
// 缺卡时段-上班、下班-前端未改 // 缺卡时段-上班、下班-前端未改
String cardSupplementType = ObjectUtil.isNull(jsonObj.get("__CardSupplementType",FromData.class)) ? null : jsonObj.get("__CardSupplementType",FromData.class).getValue(); String cardSupplementType = ObjectUtil.isNull(jsonObj.get("__CardSupplementType",FromData.class)) ? null : jsonObj.get("__CardSupplementType",FromData.class).getValue();
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.crm.CrmClientDataMapper">
<select id="crmCartogram"
resultType="cn.timer.api.dto.crm.CrmCartogramDto">
SELECT
province_id,province as provinceName,count(province_id) num
FROM
crm_client_data
WHERE
org_code = #{orgCode}
<if test='null != belongUser and belongUser !=""'>AND
belong_user = #{belongUser}
</if>
<if test='null != belongGroup and belongGroup !=""'>AND
belong_group = #{belongGroup}
</if>
<if test='null != startCreateTime and startCreateTime !=""'>AND
create_time <![CDATA[>=]]> #{startCreateTime}
</if>
<if test='null != endCreateTime and endCreateTime !=""'>AND
create_time <![CDATA[<=]]> #{endCreateTime}
</if>
GROUP BY
province_id
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment