Commit faf5f60a by Administrator

Merge branch 'develop' into 'master'

Develop

See merge request 8timerv2/8timerapiv200!563
parents feff472f 51768684
...@@ -161,6 +161,9 @@ public class CrmClientData extends Model<CrmClientData> { ...@@ -161,6 +161,9 @@ public class CrmClientData extends Model<CrmClientData> {
@ApiModelProperty(value = "产品") @ApiModelProperty(value = "产品")
private String product; private String product;
@ApiModelProperty(value = "跟进记录")
private String followuprecord;
@Transient @Transient
@TableField(exist = false) @TableField(exist = false)
......
...@@ -27,6 +27,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -27,6 +27,8 @@ 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.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
...@@ -57,6 +59,7 @@ import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper; ...@@ -57,6 +59,7 @@ import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dto.crm.CrmCartogramDto; 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.dto.kqmk.DailyDetailsDto; import cn.timer.api.dto.kqmk.DailyDetailsDto;
import cn.timer.api.dto.xcgl.ImportDescriptionDto;
import cn.timer.api.utils.CheckUtil; import cn.timer.api.utils.CheckUtil;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
...@@ -1423,6 +1426,13 @@ public class CrmController { ...@@ -1423,6 +1426,13 @@ public class CrmController {
@Transactional @Transactional
@ApiOperation(value = "导入客户", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "导入客户", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> importClient(@CurrentUser UserBean userBean, @RequestParam String url) { public Result<Object> importClient(@CurrentUser UserBean userBean, @RequestParam String url) {
int toinsert = 0;//新增
int toupdate = 0;//更新
int failure = 0;//失败
List<Map<String, String>> reasons = Lists.newArrayList();
Integer empNum = getEmpNum(userBean); Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean); Integer orgCode = getOrgCode(userBean);
...@@ -1459,110 +1469,142 @@ public class CrmController { ...@@ -1459,110 +1469,142 @@ public class CrmController {
reader.addHeaderAlias("办公电话", "telephone"); reader.addHeaderAlias("办公电话", "telephone");
reader.addHeaderAlias("个人邮箱", "email"); reader.addHeaderAlias("个人邮箱", "email");
reader.addHeaderAlias("个人地址", "linkAddress"); reader.addHeaderAlias("个人地址", "linkAddress");
reader.addHeaderAlias("跟进记录", "followuprecord");
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) {
String name = crmClientDataImportVo.getClientName();
Map<String, String> map = Maps.newHashMap();
try {
CrmClientData crmd = CrmClientData.builder().build().selectOne(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getBelongUser, empNum).eq(CrmClientData::getClientName, crmClientDataImportVo.getClientName())
.eq(CrmClientData::getClientCellphone, crmClientDataImportVo.getClientCellphone()));
if(crmd == null) {
String clientName = crmClientDataImportVo.getClientName(); // 客户名称(必填)
String belongGroupName = crmClientDataImportVo.getBelongGroupName(); // 分组名(必填)
String industryName = crmClientDataImportVo.getIndustryName(); // 行业名
String clientTypeName = crmClientDataImportVo.getClientTypeName(); // 客户类型名
String clientCellphone = crmClientDataImportVo.getClientCellphone(); // 客户手机号
String clientTelephone = crmClientDataImportVo.getClientTelephone(); // 客户座机号
String clientUrl = crmClientDataImportVo.getClientUrl(); // 官网
String clientEmail = crmClientDataImportVo.getClientEmail(); // 邮箱
String clientAddress = crmClientDataImportVo.getAddress(); // 地址
String wechat = crmClientDataImportVo.getWechat(); // 微信
String product = crmClientDataImportVo.getProduct(); // 产品
String linkname = crmClientDataImportVo.getLinkName(); // 联系人姓名
String linkcellphone = crmClientDataImportVo.getCellphone(); // 手机号码
String linkcompany = crmClientDataImportVo.getCompany(); // 所属公司
String linkgender = crmClientDataImportVo.getGender(); // 性别
String linkposition = crmClientDataImportVo.getPosition(); // 职位
String linktelephone = crmClientDataImportVo.getTelephone(); // 办公电话
String linkemail = crmClientDataImportVo.getEmail(); // 个人邮箱
String linkaddress = crmClientDataImportVo.getLinkAddress(); // 个人地址
String followuprecord = crmClientDataImportVo.getFollowuprecord(); // 跟进记录
CrmClientData crmClientData = new CrmClientData();
// 业务组
CrmBusinessGroup crmBusinessGroup = CrmBusinessGroup.builder().build()
.selectOne(new LambdaQueryWrapper<CrmBusinessGroup>().eq(CrmBusinessGroup::getOrgCode, orgCode)
.eq(CrmBusinessGroup::getName, belongGroupName).select(CrmBusinessGroup::getId));
if (crmBusinessGroup == null)
return ResultUtil.error("没有匹配的业务组名称");
if (StrUtil.isNotBlank(industryName)) {
// 行业字典
IndustryClass industryClass = IndustryClass.builder().build()
.selectOne(new LambdaQueryWrapper<IndustryClass>().eq(IndustryClass::getName, industryName)
.select(IndustryClass::getId));
if (industryClass == null)
return ResultUtil.error("没有匹配的行业名称");
crmClientData.setIndustry(industryClass.getId());
}
String clientName = crmClientDataImportVo.getClientName(); // 客户名称(必填) if (StrUtil.isNotBlank(clientTypeName)) {
String belongGroupName = crmClientDataImportVo.getBelongGroupName(); // 分组名(必填) // 客户类型
String industryName = crmClientDataImportVo.getIndustryName(); // 行业名 ClientTypeClass clientTypeClass = ClientTypeClass.builder().build()
String clientTypeName = crmClientDataImportVo.getClientTypeName(); // 客户类型名 .selectOne(new LambdaQueryWrapper<ClientTypeClass>()
String clientCellphone = crmClientDataImportVo.getClientCellphone(); // 客户手机号 .eq(ClientTypeClass::getName, clientTypeName).select(ClientTypeClass::getId));
String clientTelephone = crmClientDataImportVo.getClientTelephone(); // 客户座机号 if (clientTypeClass == null)
String clientUrl = crmClientDataImportVo.getClientUrl(); // 官网 return ResultUtil.error("没有匹配的客户类型名称");
String clientEmail = crmClientDataImportVo.getClientEmail(); // 邮箱 crmClientData.setClientType(clientTypeClass.getId());
String clientAddress = crmClientDataImportVo.getAddress(); // 地址 }
String wechat = crmClientDataImportVo.getWechat(); // 微信
String product = crmClientDataImportVo.getProduct(); // 产品
String linkname = crmClientDataImportVo.getLinkName(); // 联系人姓名
String linkcellphone = crmClientDataImportVo.getCellphone(); // 手机号码
String linkcompany = crmClientDataImportVo.getCompany(); // 所属公司
String linkgender = crmClientDataImportVo.getGender(); // 性别
String linkposition = crmClientDataImportVo.getPosition(); // 职位
String linktelephone = crmClientDataImportVo.getTelephone(); // 办公电话
String linkemail = crmClientDataImportVo.getEmail(); // 个人邮箱
String linkaddress = crmClientDataImportVo.getLinkAddress(); // 个人地址
CrmClientData crmClientData = new CrmClientData();
// 业务组
CrmBusinessGroup crmBusinessGroup = CrmBusinessGroup.builder().build()
.selectOne(new LambdaQueryWrapper<CrmBusinessGroup>().eq(CrmBusinessGroup::getOrgCode, orgCode)
.eq(CrmBusinessGroup::getName, belongGroupName).select(CrmBusinessGroup::getId));
if (crmBusinessGroup == null)
return ResultUtil.error("没有匹配的业务组名称");
if (StrUtil.isNotBlank(industryName)) {
// 行业字典
IndustryClass industryClass = IndustryClass.builder().build()
.selectOne(new LambdaQueryWrapper<IndustryClass>().eq(IndustryClass::getName, industryName)
.select(IndustryClass::getId));
if (industryClass == null)
return ResultUtil.error("没有匹配的行业名称");
crmClientData.setIndustry(industryClass.getId());
}
if (StrUtil.isNotBlank(clientTypeName)) {
// 客户类型
ClientTypeClass clientTypeClass = ClientTypeClass.builder().build()
.selectOne(new LambdaQueryWrapper<ClientTypeClass>()
.eq(ClientTypeClass::getName, clientTypeName).select(ClientTypeClass::getId));
if (clientTypeClass == null)
return ResultUtil.error("没有匹配的客户类型名称");
crmClientData.setClientType(clientTypeClass.getId());
}
crmClientData.setClientStatus(1); 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.setContactsNum(1);
} }
crmClientData.setBelongUser(empNum); crmClientData.setBelongUser(empNum);
crmClientData.setBelongUserName(getEmpName(orgCode, empNum)); crmClientData.setBelongUserName(getEmpName(orgCode, empNum));
crmClientData.setClientName(clientName); crmClientData.setClientName(clientName);
crmClientData.setBelongGroupName(belongGroupName); crmClientData.setBelongGroupName(belongGroupName);
crmClientData.setBelongGroup(crmBusinessGroup.getId()); crmClientData.setBelongGroup(crmBusinessGroup.getId());
crmClientData.setIndustryName(industryName); crmClientData.setIndustryName(industryName);
crmClientData.setWechat(wechat); crmClientData.setWechat(wechat);
crmClientData.setProduct(product); crmClientData.setProduct(product);
crmClientData.setClientTypeName(clientTypeName); crmClientData.setClientTypeName(clientTypeName);
crmClientData.setClientCellphone(clientCellphone); crmClientData.setClientCellphone(clientCellphone);
crmClientData.setClientTelephone(clientTelephone); crmClientData.setClientTelephone(clientTelephone);
crmClientData.setClientUrl(clientUrl); crmClientData.setClientUrl(clientUrl);
crmClientData.setClientEmail(clientEmail); crmClientData.setClientEmail(clientEmail);
crmClientData.setAddress(clientAddress); crmClientData.setAddress(clientAddress);
crmClientData.setOrgCode(orgCode); crmClientData.setOrgCode(orgCode);
crmClientData.insert(); crmClientData.setFollowuprecord(followuprecord);//跟进记录
crmClientData.insert();
Integer cid = crmClientData.getId(); 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(); CrmClientContacts contacts = new CrmClientContacts();
contacts.setName(linkname); contacts.setName(linkname);
contacts.setCellphone(linkcellphone); contacts.setCellphone(linkcellphone);
contacts.setCompany(linkcompany); contacts.setCompany(linkcompany);
if (("女").equals(linkgender)) if (("女").equals(linkgender))
contacts.setGender(0); contacts.setGender(0);
else if (("男").equals(linkgender)) else if (("男").equals(linkgender))
contacts.setGender(1); contacts.setGender(1);
else else
contacts.setGender(null); contacts.setGender(null);
contacts.setPosition(linkposition); contacts.setPosition(linkposition);
contacts.setTelephone(linktelephone); contacts.setTelephone(linktelephone);
contacts.setEmail(linkemail); contacts.setEmail(linkemail);
contacts.setAddress(linkaddress); contacts.setAddress(linkaddress);
if (!(linkname == null && linkcellphone == null && linkcompany == null && linkgender == null if (!(linkname == null && linkcellphone == null && linkcompany == null && linkgender == null
&& linkposition == null && linktelephone == null && linkemail == null && linkaddress == null)) { && linkposition == null && linktelephone == null && linkemail == null && linkaddress == null)) {
contacts.setCid(cid); contacts.setCid(cid);
contacts.insert(); contacts.insert();
}
}
toinsert++;
}else {
failure++;
map.put("name", name);
map.put("msg", "该客户已存在");
reasons.add(map);
} }
} catch (Exception e) {
failure++;
map.put("name", name);
map.put("msg", StringUtils.isBlank(e.getMessage()) ? "必填数据出现空值" : e.getMessage());
reasons.add(map);
} }
} }
return ResultUtil.success("导入成功");
ImportDescriptionDto imds = new ImportDescriptionDto();
imds.setSuccess(toinsert + toupdate);//成功
imds.setToinsert(toinsert);
imds.setToupdate(toupdate);//更新
imds.setFailure(failure);//失败
imds.setReasons(reasons);
return ResultUtil.data(imds,"成功");
// return ResultUtil.success("导入成功");
} }
private ExcelReader getReaderByUrl(String url) { private ExcelReader getReaderByUrl(String url) {
......
...@@ -123,6 +123,7 @@ import cn.timer.api.dto.yggl.LoginerChargeDto; ...@@ -123,6 +123,7 @@ import cn.timer.api.dto.yggl.LoginerChargeDto;
import cn.timer.api.dto.yggl.LzbQueryDto; import cn.timer.api.dto.yggl.LzbQueryDto;
import cn.timer.api.dto.yggl.LzygQueryDto; import cn.timer.api.dto.yggl.LzygQueryDto;
import cn.timer.api.dto.yggl.ModifyAvatarDto; import cn.timer.api.dto.yggl.ModifyAvatarDto;
import cn.timer.api.dto.yggl.UserInfo;
import cn.timer.api.dto.yggl.YgCartogramDto; import cn.timer.api.dto.yggl.YgCartogramDto;
import cn.timer.api.dto.yggl.YgKVDto; import cn.timer.api.dto.yggl.YgKVDto;
import cn.timer.api.dto.yggl.YgQueryDto; import cn.timer.api.dto.yggl.YgQueryDto;
...@@ -1997,7 +1998,23 @@ public class YgglController { ...@@ -1997,7 +1998,23 @@ public class YgglController {
return ResultUtil.success("上传成功"); return ResultUtil.success("上传成功");
} }
@PostMapping(value = "/new_account")
@ApiOperation(value = "修改账号", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> New_account(@CurrentUser UserBean userBean, @RequestBody UserInfo userinfo) {
YgglMainEmp sjhpd = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getPhone, userinfo.getPhone())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(sjhpd == null) {
YgglMainEmp.builder().phone(userinfo.getPhone()).build().update(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, userinfo.getName()).eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
QyzxEmpLogin.builder().phone(userinfo.getPhone()).build().update(new QueryWrapper<QyzxEmpLogin>().lambda().eq(QyzxEmpLogin::getId,userinfo.getName()).eq(QyzxEmpLogin::getOrgId, userBean.getOrgCode()));
return ResultUtil.success("修改成功");
}else {
return ResultUtil.error("该号码已存在");
}
}
} }
...@@ -64,5 +64,7 @@ public class CrmClientDataImportVo implements Serializable { ...@@ -64,5 +64,7 @@ public class CrmClientDataImportVo implements Serializable {
private String telephone; private String telephone;
private String email; private String email;
private String linkAddress; private String linkAddress;
private String followuprecord;
} }
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