Commit 80554387 by 翁国栋

crm需求

1.业务员可自行登记客户跟进提醒:精确到年、月、天
2.颜色列表
3客户导入增加字段
parent cff62489
......@@ -44,3 +44,18 @@ ADD COLUMN `secret` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL
ADD COLUMN `appidq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `secret`,
ADD COLUMN `secretq` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL AFTER `appidq`;
ALTER TABLE `admin_asso_txjlb`
MODIFY COLUMN `user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '提醒用户姓名' AFTER `content`;
CREATE TABLE ` crm_remind_rule ` (
` id ` int(11) NOT NULL AUTO_INCREMENT,
` crm_group_member ` int(11) DEFAULT NULL COMMENT ''crm_business_group_member'',
` crm_client_id ` int(11) DEFAULT NULL COMMENT ''客户id'',
` remind_day ` varchar(10) DEFAULT NULL COMMENT ''提醒天数:YYYY-MM-DD'',
` create_time ` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT ''创建时间'',
` remind_num ` int(11) DEFAULT ''1'' COMMENT ''提醒次数'',
` delete_flag ` tinyint(1) DEFAULT ''0'' COMMENT ''逻辑删除标记0.未删除 1.删除'',
` org_code ` int(11) DEFAULT NULL,
` user_name ` varchar(50) DEFAULT NULL,
PRIMARY KEY (` id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=''提醒规则'';
......@@ -9,10 +9,7 @@ package cn.timer.api.bean.crm;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
......@@ -87,4 +84,9 @@ public class CrmClientFollow extends Model<CrmClientFollow> {
@ApiModelProperty(value = "创建时间")
private Date createTime;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "下次提醒时间")
private String remindTime;
}
package cn.timer.api.bean.crm;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 跟进记录的颜色标识配置
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-27 17:33:50
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_list_color")
@ApiModel("crm客戶列表颜色列表")
public class CrmListColor extends Model<CrmListColor> {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
/**
*
*/
private Integer crmBusinessGroup;
/**
* 0-无 1-潜在 2-意向 3-签约 4-合作中 5-已封档
*/
private Integer clientStatus;
/**
* 逻辑删除标记0.未删除 1.删除'
*/
private Integer deleteFlag;
/**
* 天数
*/
private Integer day1;
/**
* 颜色
*/
private String color1;
/**
* 天数
*/
private Integer day2;
/**
* 颜色
*/
private String color2;
/**
* 天数
*/
private Integer day3;
/**
* 颜色
*/
private String color3;
}
package cn.timer.api.bean.crm;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 提醒规则
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-26 19:32:41
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "crm_remind_rule")
@ApiModel("客户提醒规则")
public class CrmRemindRule extends Model<CrmRemindRule> {
private static final long serialVersionUID = 1L;
/**
*
*/
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号")
private Integer id;
/**
* crm_business_group_member
*/
private Integer crmGroupMember;
/**
* 客户id
*/
private Integer crmClientId;
/**
* 提醒天数:YYYY-MM-DD
*/
private String remindDay;
/**
* 创建时间
*/
private Date createTime;
private Integer remindNum;
@ApiModelProperty(value="逻辑删除标记0.未删除 1.删除",example="0")
private Integer deleteFlag;
private Integer orgCode;
private String userName;
}
......@@ -10,11 +10,18 @@ import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import cn.timer.api.bean.crm.*;
import cn.timer.api.bean.insure.InsurePolicy;
import cn.timer.api.bean.insure.InsureProductPlan;
import cn.timer.api.controller.zpgl.sevice.ZpglService;
import cn.timer.api.dao.crm.CrmRemindRuleMapper;
import cn.timer.api.dto.clazz.CityClazzDto;
import cn.timer.api.dto.crm.CrmCartogramCountExportDto;
import cn.timer.api.dto.insure.PolicyDto;
import cn.timer.api.dto.yggl.YgCityDto;
import cn.timer.api.utils.ExcelUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -44,13 +51,6 @@ import cn.timer.api.bean.clazz.ClientSourceClass;
import cn.timer.api.bean.clazz.ClientTypeClass;
import cn.timer.api.bean.clazz.IndustryClass;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.crm.CrmBusinessGroup;
import cn.timer.api.bean.crm.CrmBusinessGroupMember;
import cn.timer.api.bean.crm.CrmClientAssociate;
import cn.timer.api.bean.crm.CrmClientContacts;
import cn.timer.api.bean.crm.CrmClientData;
import cn.timer.api.bean.crm.CrmClientFollow;
import cn.timer.api.bean.crm.CrmSeaRule;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
......@@ -76,16 +76,16 @@ import javax.servlet.http.HttpServletResponse;
/**
* Title: CrmController.java
*
* @Description:
* @author dsc
* @date 2020年6月5日
* @version 1.0
* @Description:
* @date 2020年6月5日
*/
@RestController
@Api(tags = "6.1客户管理")
@Transactional
@RequestMapping(value = "/crm", produces = { "application/json" })
@RequestMapping(value = "/crm", produces = {"application/json"})
public class CrmController {
// @Value(value = "${config-8timer.crm-excel.realPath}")
......@@ -99,6 +99,9 @@ public class CrmController {
@Autowired
private ZpglService zpglService;
@Autowired
private CrmRemindRuleMapper crmRemindRuleMapper;
private Integer getEmpNum(UserBean userBean) {
return userBean.getEmpNum();
}
......@@ -127,7 +130,7 @@ public class CrmController {
@GetMapping("getIndustry")
@ApiOperation(value = "获取行业列表", httpMethod = "GET", notes = "接口发布说明")
public Result<List<IndustryClass>> getIndustry(@CurrentUser UserBean userBean) {
return ResultUtil.data(IndustryClass.builder().build().selectList(new QueryWrapper<IndustryClass>().lambda().eq(IndustryClass::getOrgCode,userBean.getOrgCode())));
return ResultUtil.data(IndustryClass.builder().build().selectList(new QueryWrapper<IndustryClass>().lambda().eq(IndustryClass::getOrgCode, userBean.getOrgCode())));
}
......@@ -270,7 +273,7 @@ public class CrmController {
YgglMainEmp emps = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum)
.eq(YgglMainEmp::getOrgCode, orgCode).select(YgglMainEmp::getName, YgglMainEmp::getHeadUrl));
if(emps != null) {
if (emps != null) {
String name = getEmpName(orgCode, empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
......@@ -287,7 +290,7 @@ public class CrmController {
YgglMainEmp emps = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, empNum)
.eq(YgglMainEmp::getOrgCode, orgCode).select(YgglMainEmp::getName, YgglMainEmp::getHeadUrl));
if(emps != null) {
if (emps != null) {
String name = getEmpName(orgCode, empNum);
Map<String, Object> map = new HashMap<String, Object>();
map.put("name", name);
......@@ -426,16 +429,16 @@ public class CrmController {
return ResultUtil.error("新增失败");
Integer crmDataId = crmClientData.getId();
Integer[] ids = crmClientData.getIds();
if(ids != null) {
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) {
if (crmClientContacts != null) {
for (CrmClientContacts crmClientContact : crmClientContacts) {
if(crmClientContact.getName() != null) {
if (crmClientContact.getName() != null) {
crmClientContact.setCid(crmDataId);
crmClientContact.insert();
contactsnum++;
......@@ -467,7 +470,7 @@ public class CrmController {
crmClientContact.insertOrUpdate();
}
}
if(crmClientContacts != null) {
if (crmClientContacts != null) {
crmClientData.setContactsNum(crmClientContacts.size());//客户联系人数量
}
......@@ -517,7 +520,7 @@ 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,Integer typei) {
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)
......@@ -535,7 +538,7 @@ public class CrmController {
// 我协作的客户
private List<CrmClientData> getMyAssociateCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like,Integer typei,String startFollowTime, String endFollowTime,String startCreateTime, String endCreateTime) {
String like, Integer typei, String startFollowTime, String endFollowTime, String startCreateTime, String endCreateTime) {
List<CrmClientAssociate> crmClientAssociates = CrmClientAssociate.builder().build().selectList(
new QueryWrapper<CrmClientAssociate>().lambda().eq(CrmClientAssociate::getAssociateId, empNum)
.eq(CrmClientAssociate::getOrgCode, orgCode).select(CrmClientAssociate::getCid));
......@@ -544,8 +547,8 @@ public class CrmController {
Integer cid = crmClientAssociate.getCid();
CrmClientData crmClientData = CrmClientData.builder().build()
.selectOne(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getId, cid)
.eq(groupId != null && groupId >0, CrmClientData::getBelongGroup, groupId)
.eq(status != null && status >0, CrmClientData::getClientStatus, status).eq(typei != null && typei > 0, CrmClientData::getClientType, typei)
.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)
......@@ -561,21 +564,21 @@ public class CrmController {
// 我的全部客户
private List<CrmClientData> getMyTotalCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,
String like,Integer typei) {
return CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like,null,null,null,null,null),
getMyAssociateCilent(empNum, orgCode, groupId, status, like,typei,null,null,null,null), true);
String like, Integer typei) {
return CheckUtil.distinct(getMyCilent(empNum, orgCode, groupId, status, like, null, null, null, null, null),
getMyAssociateCilent(empNum, orgCode, groupId, status, like, typei, null, null, null, null), true);
}
// 我关注的客户
private List<CrmClientData> getMyStarCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status,Integer typei) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null,null).stream()
private List<CrmClientData> getMyStarCilent(Integer empNum, Integer orgCode, Integer groupId, Integer status, Integer typei) {
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,Integer typei) {
return getMyTotalCilent(empNum, orgCode, groupId, status, null,null).stream()
Integer status, Integer typei) {
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());
......@@ -601,29 +604,29 @@ public class CrmController {
@RequestParam(required = false) String endFollowTime,
@RequestParam(required = false) Integer typei) {
if(endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59";
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";
if (endFollowTime != null && !("").equals(endFollowTime)) {
endFollowTime = endFollowTime.substring(0, 10) + " 23:59:59";
}
Integer empNum = getEmpNum(userBean);
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,typei);
List<CrmClientData> myAsso = getMyAssociateCilent(empNum, orgCode, groupId, status, like,typei,startFollowTime,endFollowTime,startCreateTime,endCreateTime);
List<CrmClientData> myClient = getMyCilent(empNum, orgCode, groupId, status, like, startCreateTime, endCreateTime, startFollowTime, endFollowTime, typei);
List<CrmClientData> myAsso = getMyAssociateCilent(empNum, orgCode, groupId, status, like, typei, startFollowTime, endFollowTime, startCreateTime, endCreateTime);
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,typei);
crmClientDatas = getMyCilent(empNum, orgCode, groupId, status, like, startCreateTime, endCreateTime, startFollowTime, endFollowTime, typei);
else if (type == 2) // 我协作的客户
crmClientDatas = getMyAssociateCilent(empNum, orgCode, groupId, status, like,typei,startFollowTime,endFollowTime,startCreateTime,endCreateTime);
crmClientDatas = getMyAssociateCilent(empNum, orgCode, groupId, status, like, typei, startFollowTime, endFollowTime, startCreateTime, endCreateTime);
else if (type == 3) // 我关注的客户
crmClientDatas = getMyStarCilent(empNum, orgCode, groupId, status,typei);
crmClientDatas = getMyStarCilent(empNum, orgCode, groupId, status, typei);
else if (type == 4) // 七天未跟进的客户
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status,typei);
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status, typei);
else
return ResultUtil.error("查询失败");
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
......@@ -636,13 +639,13 @@ public class CrmController {
List<CrmClientData> resultlist = new ArrayList<CrmClientData>();
for(CrmClientData crmd : result) {
for (CrmClientData crmd : result) {
CrmClientData crmdts = CrmClientData.builder().build();
BeanUtil.copyProperties(crmd, crmdts , "iscooperation");
BeanUtil.copyProperties(crmd, crmdts, "iscooperation");
List<CrmClientAssociate> crmClientAssociates = CrmClientAssociate.builder().build()
.selectList(new QueryWrapper<CrmClientAssociate>().lambda().eq(CrmClientAssociate::getCid, crmd.getId()));
int u = 0;
if(crmClientAssociates.size() > 0) {
if (crmClientAssociates.size() > 0) {
String[] collaborator = new String[crmClientAssociates.size()];
for (CrmClientAssociate crmClientAssociate : crmClientAssociates) {
......@@ -651,13 +654,13 @@ public class CrmController {
u++;
}
if(ClockInTool.contains(ClockInTool.deleteArrayNull(collaborator),String.valueOf(userBean.getEmpNum()))) {
if (ClockInTool.contains(ClockInTool.deleteArrayNull(collaborator), String.valueOf(userBean.getEmpNum()))) {
crmdts.setIscooperation(1);
}else {
} else {
crmdts.setIscooperation(0);
}
}else {
} else {
crmdts.setIscooperation(0);
}
......@@ -756,7 +759,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) String customerowner,
@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,
......@@ -768,11 +771,11 @@ 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 (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";
if (endFollowTime != null && !("").equals(endFollowTime)) {
endFollowTime = endFollowTime.substring(0, 10) + " 23:59:59";
}
// YgglMainEmp yg = YgglMainEmp.builder().build()
......@@ -801,26 +804,26 @@ public class CrmController {
.eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
.in(QyzxEmpEntAsso::getUserType, "0,1")
.count();
if(count > 0) {
if (count > 0) {
//qw -> qw.like(ZpglRcxx::getName, query).or().eq(ZpglRcxx::getMobile, query).or().eq(ZpglRcxx::getMail, query)
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)
.likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
.and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
.likeRight(!StringUtils.isBlank(ifPhone) && "1".equals(ifPhone), CrmClientData::getClientCellphone, "1")
.and(!StringUtils.isBlank(ifPhone) && "2".equals(ifPhone), qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone, ""))
.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)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
.orderByDesc(CrmClientData::getCreateTime));
}else {
if(grouplis.size()>0 && grouplis != null) {
} else {
if (grouplis.size() > 0 && grouplis != null) {
StringBuffer sb = new StringBuffer();
for(CrmBusinessGroupMember grp : grouplis) {
for (CrmBusinessGroupMember grp : grouplis) {
sb.append(grp.getGid()).append(",");
}
keywordStr = sb.deleteCharAt(sb.length() - 1).toString();
......@@ -831,12 +834,12 @@ public class CrmController {
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.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)
.likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
.and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
.likeRight(!StringUtils.isBlank(ifPhone) && "1".equals(ifPhone), CrmClientData::getClientCellphone, "1")
.and(!StringUtils.isBlank(ifPhone) && "2".equals(ifPhone), qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone, ""))
.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)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
.orderByDesc(CrmClientData::getCreateTime));
......@@ -855,12 +858,12 @@ public class CrmController {
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
.and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
.likeRight(!StringUtils.isBlank(ifPhone) && "1".equals(ifPhone), CrmClientData::getClientCellphone, "1")
.and(!StringUtils.isBlank(ifPhone) && "2".equals(ifPhone), qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone, ""))
.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)
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
for (CrmClientData data : datas)
......@@ -967,8 +970,21 @@ public class CrmController {
crmClientFollow.setCreateUser(empNum);
crmClientFollow.setCreateUserName(getEmpName(orgCode, empNum));
if (crmClientFollow.insert())
if (crmClientFollow.insert()) {
if (!StringUtils.isBlank(crmClientFollow.getRemindTime())) {
//进入下次提醒任务时间
CrmRemindRule crmRemindRule = CrmRemindRule.builder().build();
crmRemindRule.setCrmClientId(cid);
crmRemindRule.setRemindDay(crmClientFollow.getRemindTime());
//不一定是属于这个组的才可以跟进所以这里先使用user_id
crmRemindRule.setCrmGroupMember(empNum);
crmRemindRule.setOrgCode(userBean.getOrgCode());
crmRemindRule.setUserName(oldData.getClientName());
crmRemindRule.setCreateTime(new Date());
crmRemindRule.insert();
}
return ResultUtil.success("新增成功");
}
return ResultUtil.error("新增失败");
}
......@@ -997,8 +1013,8 @@ public class CrmController {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
if(ent.getUserType() == 2) {
if (ent != null) {
if (ent.getUserType() == 2) {
if (!crmClientData.getBelongUser().equals(empNum)
&& getGroupManager(crmClientData.getBelongGroup(), empNum) == null)
return ResultUtil.error("不是当前客户归属人或组管理员");
......@@ -1103,6 +1119,7 @@ public class CrmController {
@Autowired
private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;
@Transactional
@PostMapping("designateClientBelongers")
@ApiOperation(value = "转移客户归属人(批量客户)", httpMethod = "POST", notes = "接口发布说明")
......@@ -1127,7 +1144,7 @@ public class CrmController {
.eq(CrmBusinessGroupMember::getEmpNum, getEmpNum(userBean))
.eq(CrmBusinessGroupMember::getType, 1));
//系统主管理员 或者 组管理员
if(count > 0 || nowManager != null) {
if (count > 0 || nowManager != null) {
// 是否有不同组的客户
if (gids.stream().distinct().count() > 1)
......@@ -1162,11 +1179,11 @@ public class CrmController {
@GetMapping("hidingcustomers")
@ApiOperation(value = "隐藏客户", httpMethod = "GET", notes = "接口发布说明")
public Result<Void> HidingCustomers(@CurrentUser UserBean userBean,@RequestParam Integer yid) {
public Result<Void> HidingCustomers(@CurrentUser UserBean userBean, @RequestParam Integer yid) {
CrmClientData crda = CrmClientData.builder().id(yid).build().selectById();
if(crda != null) {
if (crda != null) {
// 当前操作人是否管理员
CrmBusinessGroupMember nowManager = CrmBusinessGroupMember.builder().build()
.selectOne(new QueryWrapper<CrmBusinessGroupMember>().lambda().eq(CrmBusinessGroupMember::getGid, crda.getBelongGroup())
......@@ -1185,7 +1202,6 @@ public class CrmController {
}
/**
*
* @param userBean
* @param type 统计图类型(暂时不要)
* @param groupId 业务组id
......@@ -1201,8 +1217,8 @@ public class CrmController {
@RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime) {
if(endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59";
if (endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10) + " 23:59:59";
}
Integer orgCode = getOrgCode(userBean);
......@@ -1293,14 +1309,14 @@ public class CrmController {
String startCreateTime, String endCreateTime) {
Map<String, Object> map = new HashMap<String, Object>();
Integer num = 0;
if(status.intValue() == 7){
if (status.intValue() == 7) {
/*** 跟进统计 ***/
num = CrmClientFollow.builder().build()
.selectCount(new QueryWrapper<CrmClientFollow>().lambda().eq(CrmClientFollow::getOrgCode, orgCode)
.eq(belonger != null, CrmClientFollow::getCreateUser, belonger)
.ge(StringUtils.isNotBlank(startCreateTime), CrmClientFollow::getCreateTime, startCreateTime)
.le(StringUtils.isNotBlank(endCreateTime), CrmClientFollow::getCreateTime, endCreateTime));
}else {
} else {
num = CrmClientData.builder().build()
.selectCount(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(CrmClientData::getClientStatus, status)
......@@ -1317,7 +1333,7 @@ public class CrmController {
YgglMainEmp emps = YgglMainEmp.builder().build()
.selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, belonger)
.eq(YgglMainEmp::getOrgCode, orgCode).select(YgglMainEmp::getName, YgglMainEmp::getHeadUrl));
if(emps != null) {
if (emps != null) {
name = getEmpName(orgCode, belonger);
}
......@@ -1515,11 +1531,14 @@ public class CrmController {
reader.addHeaderAlias("微信", "wechat");
reader.addHeaderAlias("产品", "product");
reader.addHeaderAlias("客户类型", "clientTypeName");
reader.addHeaderAlias("手机号码(客户)", "clientCellphone");
reader.addHeaderAlias("*手机号码(客户)", "clientCellphone");
reader.addHeaderAlias("座机号码", "clientTelephone");
reader.addHeaderAlias("官网", "clientUrl");
reader.addHeaderAlias("邮箱", "clientEmail");
reader.addHeaderAlias("地址", "address");
reader.addHeaderAlias("省", "province");
reader.addHeaderAlias("市", "city");
reader.addHeaderAlias("区", "district");
reader.addHeaderAlias("联系人姓名", "linkName");
reader.addHeaderAlias("*手机号码(必填)", "cellphone");
reader.addHeaderAlias("所属公司", "company");
......@@ -1535,9 +1554,9 @@ public class CrmController {
String name = crmClientDataImportVo.getClientName();
try {
CrmClientData crmd = CrmClientData.builder().build().selectOne(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode,orgCode).eq(CrmClientData::getBelongUser, empNum).eq(CrmClientData::getClientName, crmClientDataImportVo.getClientName())
CrmClientData crmd = CrmClientData.builder().build().selectOne(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode).eq(CrmClientData::getBelongUser, empNum).eq(CrmClientData::getClientName, crmClientDataImportVo.getClientName())
);
if(crmd == null) {
if (crmd == null) {
String clientName = crmClientDataImportVo.getClientName(); // 客户名称(必填)
String belongGroupName = crmClientDataImportVo.getBelongGroupName(); // 分组名(必填)
String industryName = crmClientDataImportVo.getIndustryName(); // 行业名
......@@ -1548,6 +1567,9 @@ public class CrmController {
String clientUrl = crmClientDataImportVo.getClientUrl(); // 官网
String clientEmail = crmClientDataImportVo.getClientEmail(); // 邮箱
String clientAddress = crmClientDataImportVo.getAddress(); // 地址
String province = crmClientDataImportVo.getProvince();
String city = crmClientDataImportVo.getCity();
String district = crmClientDataImportVo.getDistrict();
String wechat = crmClientDataImportVo.getWechat(); // 微信
String product = crmClientDataImportVo.getProduct(); // 产品
String linkname = crmClientDataImportVo.getLinkName(); // 联系人姓名
......@@ -1562,6 +1584,41 @@ public class CrmController {
String followuprecord = crmClientDataImportVo.getFollowuprecord(); // 跟进记录
CrmClientData crmClientData = new CrmClientData();
if (province != null) {
SysRegion provinceSysRegion = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda()
.eq(SysRegion::getLevel, 1).eq(SysRegion::getRegionName, province));
if(provinceSysRegion==null){
return ResultUtil.error("省名错误");
}else{
crmClientData.setProvinceId(provinceSysRegion.getKeyId());
crmClientData.setProvince(provinceSysRegion.getRegionName());
}
}
if (city != null) {
if (city != null) {
SysRegion citySysRegion = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda()
.eq(SysRegion::getLevel, 2).eq(SysRegion::getRegionName, city));
if(citySysRegion==null){
return ResultUtil.error("市名错误");
}else{
crmClientData.setCityId(citySysRegion.getKeyId());
crmClientData.setCity(citySysRegion.getRegionName());
}
}
}
if (district != null) {
if (district != null) {
SysRegion districtSysRegion = SysRegion.builder().build().selectOne(new QueryWrapper<SysRegion>().lambda()
.eq(SysRegion::getLevel, 3).eq(SysRegion::getRegionName, district));
if(districtSysRegion==null){
return ResultUtil.error("区名错误");
}else{
crmClientData.setDistrictId(districtSysRegion.getKeyId());
crmClientData.setDistrict(districtSysRegion.getRegionName());
}
}
}
// 业务组
CrmBusinessGroup crmBusinessGroup = CrmBusinessGroup.builder().build()
......@@ -1584,7 +1641,7 @@ public class CrmController {
incls.insert();
industryid = incls.getId();
// return ResultUtil.error("没有匹配的行业名称");
}else {
} else {
industryid = industryClass.getId();
}
crmClientData.setIndustry(industryid);
......@@ -1601,7 +1658,7 @@ public class CrmController {
}
crmClientData.setClientStatus(1);
if(!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
if (!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
crmClientData.setContactsNum(1);
}
crmClientData.setBelongUser(empNum);
......@@ -1610,16 +1667,16 @@ public class CrmController {
crmClientData.setBelongGroupName(belongGroupName);
crmClientData.setBelongGroup(crmBusinessGroup.getId());
crmClientData.setIndustryName(industryName);
if(StringUtils.isNotBlank(clientStatus)){
if("潜在".equals(clientStatus)){
if (StringUtils.isNotBlank(clientStatus)) {
if ("潜在".equals(clientStatus)) {
crmClientData.setClientStatus(1);
}else if("意向".equals(clientStatus)){
} else if ("意向".equals(clientStatus)) {
crmClientData.setClientStatus(2);
}else if("签约".equals(clientStatus)){
} else if ("签约".equals(clientStatus)) {
crmClientData.setClientStatus(3);
}else if("合作中".equals(clientStatus)){
} else if ("合作中".equals(clientStatus)) {
crmClientData.setClientStatus(4);
}else if("已封档".equals(clientStatus)){
} else if ("已封档".equals(clientStatus)) {
crmClientData.setClientStatus(5);
}
}
......@@ -1639,7 +1696,7 @@ public class CrmController {
Integer cid = crmClientData.getId();
if(!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
if (!("").equals(linkname) && linkname != null || !("").equals(linkcellphone) && linkcellphone != null) {
CrmClientContacts contacts = new CrmClientContacts();
contacts.setName(linkname);
contacts.setCellphone(linkcellphone);
......@@ -1661,7 +1718,7 @@ public class CrmController {
}
}
toinsert++;
}else {
} else {
failure++;
map.put("name", name);
map.put("msg", "该客户已存在");
......@@ -1683,7 +1740,7 @@ public class CrmController {
imds.setFailure(failure);//失败
imds.setReasons(reasons);
return ResultUtil.data(imds,"成功");
return ResultUtil.data(imds, "成功");
// return ResultUtil.success("导入成功");
}
......@@ -1694,11 +1751,11 @@ public class CrmController {
@RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime, HttpServletRequest request, HttpServletResponse resp) {
if(endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10)+" 23:59:59";
if (endCreateTime != null && !("").equals(endCreateTime)) {
endCreateTime = endCreateTime.substring(0, 10) + " 23:59:59";
}
List<CrmCartogramCountExportDto> userList = crmClientDataMapper.selectCrmCartogramCount(userBean.getOrgCode(), belonger, groupId, startCreateTime, endCreateTime);
return ResultUtil.data(userList,"成功");
return ResultUtil.data(userList, "成功");
}
private ExcelReader getReaderByUrl(String url) {
......@@ -1710,4 +1767,36 @@ public class CrmController {
}
return ExcelUtil.getReader(is);
}
@PostMapping(value = "/setColor")
@ApiOperation(value = "设置颜色", httpMethod = "GET", notes = "导出统计")
public Result<Object> exportCartogram(@CurrentUser UserBean userBean,
@RequestBody List<CrmListColor> crmListColorList) {
if (crmListColorList != null && crmListColorList.size() > 0) {
for (CrmListColor v : crmListColorList) {
if (v.getClientStatus() == null) {
return ResultUtil.error("状态不为空");
}
CrmListColor crmListColor;
if (v.getId() != null) {
crmListColor = CrmListColor.builder().id(v.getId()).build().selectById();
v.setId(crmListColor.getId());
BeanUtil.copyProperties(v, crmListColor);
v.updateById();
} else {
crmListColor = new CrmListColor();
BeanUtil.copyProperties(v, crmListColor);
crmListColor.insert();
}
}
}
return ResultUtil.data("成功");
}
@GetMapping(value = "/getColor")
@ApiOperation(value = "获取颜色列表", httpMethod = "GET", notes = "导出统计")
public Result<Object> getColorList(@CurrentUser UserBean userBean) {
List<CrmListColor> crmListColorList = CrmListColor.builder().build().selectList(new QueryWrapper<CrmListColor>().lambda().eq(CrmListColor::getDeleteFlag, 0));
return ResultUtil.data(crmListColorList, "成功");
}
}
/**
* Title: CrmRuleController.java
* Description:
* @author dsc
* @date 2020年6月11日
* @version 1.0
*/
package cn.timer.api.controller.crm.task;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.timer.api.bean.admin.AdminAssoTxjlb;
import cn.timer.api.bean.crm.CrmClientAssociate;
import cn.timer.api.bean.crm.CrmClientData;
import cn.timer.api.bean.crm.CrmRemindRule;
import cn.timer.api.bean.crm.CrmSeaRule;
import cn.timer.api.dao.crm.CrmRemindRuleMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* Title: CrmRuleController.java
*
* @Description: 公海规则
* @author dsc
* @date 2020年6月11日
* @version 1.0
*/
@Configuration //1.主要用于标记配置类,兼备Component的效果。 // 2.开启定时任务
@Slf4j
public class CrmRuleTaskTiming {
@Autowired
private CrmRemindRuleMapper crmRemindRuleMapper;
//提醒时间到了
@Scheduled(cron = "0/1 * * * * ?") // 每小时扫描
@Transactional
public void getTimeRules() {
String today=DateUtil.today();
List<CrmRemindRule> crmRemindRuleList = crmRemindRuleMapper.selectCrmRemindRuleList(today);
if(crmRemindRuleList!=null&&crmRemindRuleList.size()>0){
//发送系统通知
crmRemindRuleList.forEach(v->{
AdminAssoTxjlb adminAssoTxjlb = AdminAssoTxjlb.builder().build();
adminAssoTxjlb.setEmpNum(v.getCrmGroupMember());
adminAssoTxjlb.setOrgCode(v.getOrgCode());
adminAssoTxjlb.setUserName(v.getUserName());
adminAssoTxjlb.setTxType(1);
adminAssoTxjlb.setTxstate(0);
adminAssoTxjlb.setContent("您有一位客户["+v.getUserName()+"]需要跟进");
adminAssoTxjlb.setAddtime(new Date().getTime());
adminAssoTxjlb.insert();
v.setDeleteFlag(1);
v.updateById();
});
}
}
}
......@@ -37,7 +37,7 @@ public class InsureTaskTiming {
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper;
@Scheduled(cron = "0 0 0 1 * ?")//每月第一天
@Scheduled(cron = "0/1 0 0 * * ?")//每月第一天
@Transactional(rollbackFor = Exception.class)
public void updateInsureStatusTask(){
try {
......
package cn.timer.api.dao.crm;
import cn.timer.api.bean.crm.CrmListColor;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* 跟进记录的颜色标识配置
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-27 17:33:50
*/
@Repository
public interface CrmListColorMapper extends BaseMapper<CrmListColor> {
}
package cn.timer.api.dao.crm;
import cn.timer.api.bean.crm.CrmRemindRule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 提醒规则
*
* @author wgd
* @email 862422848@qq.com
* @date 2023-07-26 19:32:41
*/
@Repository
public interface CrmRemindRuleMapper extends BaseMapper<CrmRemindRule> {
List<CrmRemindRule> selectCrmRemindRuleList(@Param("remindDay")String remindTime);
}
......@@ -50,6 +50,9 @@ public class CrmClientDataImportVo implements Serializable {
private String clientEmail;
// 详细地址
private String address;
private String province;
private String city;
private String district;
//微信
private String wechat;
......
<?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.CrmListColorMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.crm.CrmListColor" id="crmListColorMap">
<result property="id" column="id"/>
<result property="crmBusinessGroup" column="crm_business_group"/>
<result property="clientStatus" column="client_status"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="day1" column="day1"/>
<result property="color1" column="color1"/>
<result property="day2" column="day2"/>
<result property="color2" column="color2"/>
<result property="day3" column="day3"/>
<result property="color3" column="color3"/>
</resultMap>
<select id="selectById" resultType="cn.timer.api.bean.crm.CrmListColor">
select *
from crm_list_color
where id = #{id}
</select>
<insert id="insert" parameterType="cn.timer.api.bean.crm.CrmListColor" useGeneratedKeys="true"
keyProperty="id">
insert into crm_list_color
(
<if test="crmBusinessGroup != null">`crm_business_group`</if>
<if test="clientStatus != null">`client_status`</if>
<if test="deleteFlag != null">,`delete_flag`</if>
<if test="day1 != null">,`day1`</if>
<if test="color1 != null">,`color1`</if>
<if test="day2 != null">,`day2`</if>
<if test="color2 != null">,`color2`</if>
<if test="day3 != null">,`day3`</if>
<if test="color3 != null">,`color3`</if>
)
values
(
<if test="crmBusinessGroup != null">#{crmBusinessGroup}</if>
<if test="clientStatus != null">#{clientStatus}</if>
<if test="deleteFlag != null">,#{deleteFlag}</if>
<if test="day1 != null">,#{day1}</if>
<if test="color1 != null">,#{color1}</if>
<if test="day2 != null">,#{day2}</if>
<if test="color2 != null">,#{color2}</if>
<if test="day3 != null">,#{day3}</if>
<if test="color3 != null">,#{color3}</if>
)
</insert>
<update id="update" parameterType="cn.timer.api.bean.crm.CrmListColor">
update crm_list_color
<set>
<if test="crmBusinessGroup != null">`crm_business_group` = #{crmBusinessGroup},</if>
<if test="clientStatus != null">`client_status` = #{clientStatus},</if>
<if test="deleteFlag != null">`delete_flag` = #{deleteFlag},</if>
<if test="day1 != null">`day1` = #{day1},</if>
<if test="color1 != null">`color1` = #{color1},</if>
<if test="day2 != null">`day2` = #{day2},</if>
<if test="color2 != null">`color2` = #{color2},</if>
<if test="day3 != null">`day3` = #{day3},</if>
<if test="color3 != null">`color3` = #{color3}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from crm_list_color
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from crm_list_color where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
<?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.CrmRemindRuleMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.crm.CrmRemindRule" id="crmRemindRuleMap">
<result property="id" column="id"/>
<result property="crmGroupMember" column="crm_group_member"/>
<result property="crmClientId" column="crm_client_id"/>
<result property="remindDay" column="remind_day"/>
<result property="createTime" column="create_time"/>
<result property="remindNum" column="remind_num"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="orgCode" column="org_code"/>
<result property="userName" column="user_name"/>
</resultMap>
<select id="selectById" resultType="cn.timer.api.bean.crm.CrmRemindRule">
select *
from crm_remind_rule
where id = #{id}
</select>
<insert id="insert" parameterType="cn.timer.api.bean.crm.CrmRemindRule" useGeneratedKeys="true"
keyProperty="id">
insert into crm_remind_rule
(
<if test="crmGroupMember != null">`crm_group_member`</if>
<if test="crmClientId != null">,`crm_client_id`</if>
<if test="remindDay != null">,`remind_day`</if>
<if test="createTime != null">,`create_time`</if>
<if test="remindNum != null">,`remind_num`</if>
<if test="deleteFlag != null">,`delete_flag`</if>
<if test="orgCode != null">,`org_code`</if>
<if test="userName != null">,`user_name`</if>
)
values
(
<if test="crmGroupMember != null">#{crmGroupMember}</if>
<if test="crmClientId != null">,#{crmClientId}</if>
<if test="remindDay != null">,#{remindDay}</if>
<if test="createTime != null">,#{createTime}</if>
<if test="remindNum != null">,#{remindNum}</if>
<if test="deleteFlag != null">,#{deleteFlag}</if>
<if test="orgCode != null">,#{orgCode}</if>
<if test="userName != null">,#{userName}</if>
)
</insert>
<update id="update" parameterType="cn.timer.api.bean.crm.CrmRemindRule">
update crm_remind_rule
<set>
<if test="crmGroupMember != null">`crm_group_member` = #{crmGroupMember},</if>
<if test="crmClientId != null">`crm_client_id` = #{crmClientId},</if>
<if test="remindDay != null">`remind_day` = #{remindDay},</if>
<if test="createTime != null">`create_time` = #{createTime}</if>
<if test="remindNum != null">`create_time` = #{remind_num}</if>
<if test="deleteFlag != null">`create_time` = #{delete_flag}</if>
<if test="orgCode != null">`org_code` = #{orgCode}</if>
<if test="userName != null">`user_name` = #{userName}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from crm_remind_rule
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from crm_remind_rule where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCrmRemindRuleList" resultType="cn.timer.api.bean.crm.CrmRemindRule">
select *
from crm_remind_rule
where delete_flag = 0 and remind_day>=#{remindDay}
</select>
</mapper>
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