Commit b1546998 by Administrator

Merge branch 'develop' into 'master'

Develop

See merge request 8timerv2/8timerapiv200!472
parents 479f66b1 6d04d320
......@@ -401,15 +401,15 @@ public class CrmController {
Integer clientSource = crmClientData.getClientSource();
Integer clientType = crmClientData.getClientType();
Integer industry = crmClientData.getIndustry();
if (clientSource != null) {
if (clientSource != null && clientSource > 0) {
String clientSourceName = ClientSourceClass.builder().id(clientSource).build().selectById().getName(); // 客户来源
crmClientData.setClientSourceName(clientSourceName);
}
if (clientType != null) {
if (clientType != null && clientType > 0) {
String clientTypeName = ClientTypeClass.builder().id(clientType).build().selectById().getName(); // 客户类型
crmClientData.setClientTypeName(clientTypeName);
}
if (industry != null) {
if (industry != null && industry > 0) {
String industryName = IndustryClass.builder().id(industry).build().selectById().getName();// 行业名
crmClientData.setIndustryName(industryName);
}
......@@ -417,11 +417,14 @@ public class CrmController {
return ResultUtil.error("新增失败");
Integer crmDataId = crmClientData.getId();
Integer[] ids = crmClientData.getIds();
if(ids != null) {
for (Integer id : ids) {
CrmClientAssociate.builder().cid(crmDataId).associateId(id).orgCode(getOrgCode(userBean)).build().insert();
}
}
List<CrmClientContacts> crmClientContacts = crmClientData.getCrmClientContacts();
int contactsnum = 0;
if(crmClientContacts != null) {
for (CrmClientContacts crmClientContact : crmClientContacts) {
if(crmClientContact.getName() != null) {
crmClientContact.setCid(crmDataId);
......@@ -429,6 +432,7 @@ public class CrmController {
contactsnum++;
}
}
}
crmClientData.setContactsNum(contactsnum);
crmClientData.updateById();
return ResultUtil.success("新增成功");
......@@ -474,6 +478,7 @@ public class CrmController {
CrmClientAssociate.builder().cid(cid).associateId(id).orgCode(getOrgCode(userBean)).build().insert();
}
crmClientData.setModifyUser(getEmpNum(userBean));
crmClientData.setOrgCode(userBean.getOrgCode());
if (crmClientData.updateById())
return ResultUtil.success("编辑成功");
return ResultUtil.error("编辑失败");
......@@ -503,16 +508,16 @@ public class CrmController {
// 归属我的客户
private List<CrmClientData> getMyCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like,String startCreateTime, String endCreateTime, String startFollowTime, String endFollowTime) {
String like,String startCreateTime, String endCreateTime, String startFollowTime, String endFollowTime,Integer typei) {
return CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getBelongUser, empNum)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.eq(groupId != null && groupId > 0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status > 0, CrmClientData::getClientStatus, status).eq(typei != null && typei > 0, CrmClientData::getClientType, typei)
.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)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime).like(!StrUtil.isBlank(like), CrmClientData::getBelongUserName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
.orderByDesc(CrmClientData::getCreateTime));
......@@ -541,21 +546,21 @@ public class CrmController {
// 我的全部客户
private List<CrmClientData> getMyTotalCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like) {
return CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like,null,null,null,null),
String like,Integer type) {
return CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like,null,null,null,null,null),
getMyAssociateCilent(empNum, orgCode, groupId, status, like), true);
}
// 我关注的客户
private List<CrmClientData> getMyStarCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null).stream()
private List<CrmClientData> getMyStarCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,Integer type) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null,null).stream()
.filter(item -> item.getStar().equals(1)).collect(Collectors.toList());
}
// 七天未跟进的客户
private List<CrmClientData> getCilentFollowOvertime(Integer empNum, Integer orgCode, Integer groupId,
Integer status) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null).stream()
Integer status,Integer type) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null,null).stream()
.filter(item -> item.getLastFollowTime() != null
&& item.getLastFollowTime().before(DateUtil.offsetDay(new Date(), -7)))
.collect(Collectors.toList());
......@@ -570,7 +575,7 @@ public class CrmController {
@GetMapping("getMyCilentTotal")
@ApiOperation(value = "获取我的客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getMyCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false, defaultValue = "0") Integer type,
@RequestParam(required = false) Integer type,
@RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer status,
@RequestParam(required = false) String like,
@RequestParam(required = false, defaultValue = "1") int pageNumber,
......@@ -578,12 +583,13 @@ public class CrmController {
@RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime,
@RequestParam(required = false) String startFollowTime,
@RequestParam(required = false) String endFollowTime) {
@RequestParam(required = false) String endFollowTime,
@RequestParam(required = false) Integer typei) {
if(endCreateTime != null) {
if(endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59";
}
if(endFollowTime != null) {
if(endFollowTime != null && !("").equals(endFollowTime)) {
endFollowTime = endFollowTime.substring(0, 10)+" 23:59:59";
}
......@@ -591,18 +597,18 @@ public class CrmController {
Integer orgCode = getOrgCode(userBean);
List<CrmClientData> crmClientDatas = null;
if (type == null || type == 0) { // 全部客户(去重)
List<CrmClientData> myClient = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime);
List<CrmClientData> myClient = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,typei);
List<CrmClientData> myAsso = getMyAssociateCilent(empNum, orgCode, groupId, status, like);
crmClientDatas = CheckUtil.distinct(myClient, myAsso, true).stream()
.filter(CheckUtil.distinctByKey(CrmClientData::getId)).collect(Collectors.toList());
} else if (type == 1) // 我负责的客户
crmClientDatas = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime);
crmClientDatas = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,type);
else if (type == 2) // 我协作的客户
crmClientDatas = getMyAssociateCilent(empNum, orgCode, groupId, status, like);
else if (type == 3) // 我关注的客户
crmClientDatas = getMyStarCilent(empNum, orgCode, groupId, status);
crmClientDatas = getMyStarCilent(empNum, orgCode, groupId, status,type);
else if (type == 4) // 七天未跟进的客户
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status);
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status,type);
else
return ResultUtil.error("查询失败");
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
......@@ -703,7 +709,7 @@ public class CrmController {
@ApiOperation(value = "获取所有客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> getAllCilentTotal(@CurrentUser UserBean userBean,
@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) String customerowner,
@RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime,
@RequestParam(required = false) String startFollowTime,
......@@ -714,6 +720,13 @@ public class CrmController {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
if(endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59";
}
if(endFollowTime != null && !("").equals(endFollowTime)) {
endFollowTime = endFollowTime.substring(0, 10)+" 23:59:59";
}
// YgglMainEmp yg = YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
......@@ -746,7 +759,7 @@ public class CrmController {
new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime)
......@@ -766,7 +779,7 @@ public class CrmController {
datas = CrmClientData.builder().build().selectPage(page,
new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(type != null && type >= 0, CrmClientData::getClientType, type).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status).in(CrmClientData::getBelongGroup, keywordStr)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
......@@ -1455,7 +1468,7 @@ public class CrmController {
}
crmClientData.setClientStatus(1);
if(linkname != null) {
if(!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
crmClientData.setContactsNum(1);
}
crmClientData.setBelongUser(empNum);
......@@ -1480,7 +1493,7 @@ public class CrmController {
Integer cid = crmClientData.getId();
if(linkname != null) {
if(!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
CrmClientContacts contacts = new CrmClientContacts();
contacts.setName(linkname);
contacts.setCellphone(linkcellphone);
......
......@@ -95,9 +95,11 @@ import cn.timer.api.dao.kqgl.ShiftManagementMapper;
import cn.timer.api.dao.kqgl.SpecialDateMapper;
import cn.timer.api.dao.kqgl.UserAttendanceRelMapper;
import cn.timer.api.dao.kqgl.UserEquiRelationMapper;
import cn.timer.api.dao.kqmk.KqglAssoPbmxMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.dto.kqmk.KqglMainKqzDto;
import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.Result;
......@@ -314,6 +316,10 @@ public class AttController {
return ResultUtil.data(shifs);
}
@Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper;
/**
* 修改考勤组排班(修改排班后,需判断是否有打卡记录,有则匹配当天修改后的班次,无则不需要修改)
*/
......@@ -327,12 +333,35 @@ public class AttController {
int qyid = userBean.getOrgCode();//坏小孩【企业id】
int userid = userBean.getEmpNum();//用户id
AttendanceGroup qttgrop = attendancegroupservice.selectByPrimaryKey(Integer.valueOf(attass.getAttgroupid()));
String dastr = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
AttendanceGroup qttgrop = attendancegroupservice.selectByPrimaryKey(Integer.valueOf(attass.getAttgroupid()));
boolean xiugai = true;
//记录排班(排班制)
List<Schedule> schlist=new ArrayList<Schedule>();
Schedule[] schedules = attass.getSchedules();// 排班日期【排班制】--班次id、日期
if(schedules.length>0 && attass.getAtttype() == 2){
String date = String.valueOf(schedules[0].getData());
Date dt=new Date(date);
SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(famt.format(dt));
if(!(famt.format(dt)).equals(dastr)) {
xiugai = false;
for(int p=0;p<schedules.length;p++){
Schedule sch = new Schedule();
sch.setUserid(schedules[p].getUserid());//用户id
sch.setData(schedules[p].getData());//排班日期 格式:yyyy-MM-dd
sch.setBcid(schedules[p].getBcid());//班次id 0为休息
sch.setKqzid(Integer.valueOf(attass.getAttgroupid()));//考勤组id
schlist.add(sch);
}
if(schlist.size()>0){
scheduleservice.insertKqglAssoPbmxList(schlist);
}
}else {
xiugai = true;
for(int p=0;p<schedules.length;p++){
Schedule sch = new Schedule();
sch.setUserid(schedules[p].getUserid());//用户id
......@@ -1102,15 +1131,17 @@ public class AttController {
/***********************/
}
}//判断新增或修改
}
if(schlist.size()>0){
if(schlist.size()>0 && xiugai){
//删除排班明细表(自由排班)
scheduleservice.deleteByPrimaryBykqzid(id);
scheduleservice.insertKqglAssoPbmxList(schlist);
return ResultUtil.data(schlist,"修改考勤组排班成功");
}
return ResultUtil.error("修改考勤组排班失败");
return ResultUtil.data(schlist,"修改考勤组排班成功");
// return ResultUtil.error("修改考勤组排班失败");
}
/**
......
......@@ -3927,7 +3927,7 @@ public class ClockInController {
}
}
if(!(nextrange[0]).equals("")) {
for(String nus : nextrange) {
WorkbenchCalendarDto wocal = WorkbenchCalendarDto.builder().build();
wocal.setDate(nus);
......@@ -3947,6 +3947,8 @@ public class ClockInController {
workcal.add(wocal);
}
}
}
}else {
......
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