Browse Source

客户列表查询 客户列表新增 客户跟进记录列表查询 修改

master
hp 3 years ago
parent
commit
80c805709e
  1. 10
      anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java
  2. 5
      anrui-crm/anrui-crm-api/src/main/java/com/yxt/anrui/crm/api/crmcustomertemp/AppCrmCustomerTempDto.java
  3. 8
      anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmcustomertemp/CrmCustomerTempMapper.xml
  4. 23
      anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmcustomertemp/CrmCustomerTempService.java
  5. 2
      anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmvehicledemand/CrmVehicledemandMapper.xml
  6. 79
      anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmvisit/CrmVisitService.java

10
anrui-base/anrui-base-biz/src/main/java/com/yxt/anrui/base/biz/commoncontract/CommonContractService.java

@ -1508,6 +1508,12 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp
messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批");
messageFlowableQuery.setMsgTitle("合同审核"); messageFlowableQuery.setMsgTitle("合同审核");
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery);
} else {
//更新销售订单合同编号字段
AppOrderContractNoDto appOrderContractNoDto = new AppOrderContractNoDto();
appOrderContractNoDto.setContractNo(commonContract.getContractNo());
appOrderContractNoDto.setSaleOrderSid(commonContract.getBusSid());
busSalesOrderFeign.updateContractNoBySid(appOrderContractNoDto);
} }
return rb.success().setData(resultBean.getData()); return rb.success().setData(resultBean.getData());
} else { } else {
@ -1666,8 +1672,8 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp
return rb.success().setData(commonContract); return rb.success().setData(commonContract);
} }
public ResultBean<CommonContractVo> getContractBySalesOrderSid(String busSid) { public ResultBean<CommonContractVo> getContractBySalesOrderSid(String busSid) {
ResultBean<CommonContractVo> rb = ResultBean.fireFail(); ResultBean<CommonContractVo> rb = ResultBean.fireFail();
CommonContractVo commonContractVo = baseMapper.getContractBySalesOrderSid(busSid); CommonContractVo commonContractVo = baseMapper.getContractBySalesOrderSid(busSid);
return rb.success().setData(commonContractVo); return rb.success().setData(commonContractVo);
} }

5
anrui-crm/anrui-crm-api/src/main/java/com/yxt/anrui/crm/api/crmcustomertemp/AppCrmCustomerTempDto.java

@ -33,7 +33,10 @@ public class AppCrmCustomerTempDto implements Dto {
@ApiModelProperty("登录用户sid") @ApiModelProperty("登录用户sid")
private String userSid; private String userSid;
@ApiModelProperty("机构sid")
private String orgPath;
@ApiModelProperty("客户类型(自然人/法人)") @ApiModelProperty("客户类型(自然人/法人)")
@NotBlank(message = "客户类型不能为空") @NotBlank(message = "客户类型不能为空")
private String customerType; private String customerType;

8
anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmcustomertemp/CrmCustomerTempMapper.xml

@ -38,13 +38,9 @@
cct.remind_day, cct.remind_day,
cct.isOnRemindkey, cct.isOnRemindkey,
cct.companyName, cct.companyName,
(select Max(DATE_FORMAT(cv.createTime, '%Y-%m-%d')) cct.follow_state,
from crm_visit cv (select Max(DATE_FORMAT(cv.createTime, '%Y-%m-%d')) from crm_visit cv where cv.customerSid = cct.sid order by cv.id DESC) as visitTime
where cv.customerSid = cct.sid
order by cv.id DESC) as visitTime,
cct.follow_state
FROM crm_customer_temp cct FROM crm_customer_temp cct
LEFT JOIN crm_visit cv ON cct.sid = cv.customerSid
<where> <where>
${ew.sqlSegment} ${ew.sqlSegment}
</where> </where>

23
anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmcustomertemp/CrmCustomerTempService.java

@ -296,8 +296,8 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa
if (StringUtils.isNotBlank(dto.getMobile())) { if (StringUtils.isNotBlank(dto.getMobile())) {
//查询业务员的分公司简称和部门简称 //查询业务员的分公司简称和部门简称
String customerNo = getPrefix(userOrgInfoVo.getStaffSid(), dto.getName(), dto.getMobile()); String customerNo = getPrefix(userOrgInfoVo.getStaffSid(), dto.getName(), dto.getMobile());
CrmCustomerTempVo customerTempVo = baseMapper.selectNo1(customerNo,dto.getSid()); CrmCustomerTempVo customerTempVo = baseMapper.selectNo1(customerNo, dto.getSid());
if(customerTempVo != null){ if (customerTempVo != null) {
return new ResultBean().fail().setMsg("该手机号已绑定其它客户,请重新添加"); return new ResultBean().fail().setMsg("该手机号已绑定其它客户,请重新添加");
} }
/* AppCrmCustomerTempInfoVo appCrmCustomerTempInfoVo = baseMapper.selectBySid(dto.getSid()); /* AppCrmCustomerTempInfoVo appCrmCustomerTempInfoVo = baseMapper.selectBySid(dto.getSid());
@ -688,8 +688,15 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
protected CrmCustomerTemp insertCrmCustomerTemp(AppCrmCustomerTempDto dto, AppUserOrgInfoVo userOrgInfoVo) { protected CrmCustomerTemp insertCrmCustomerTemp(AppCrmCustomerTempDto dto, AppUserOrgInfoVo userOrgInfoVo) {
CrmCustomerTemp customerTemp = new CrmCustomerTemp(); CrmCustomerTemp customerTemp = new CrmCustomerTemp();
String orgPath = dto.getOrgPath();
String useOrgSid = "";
if (StringUtils.isBlank(orgPath)) {
useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData();
} else {
useOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData();
}
dto.fillEntity(customerTemp); dto.fillEntity(customerTemp);
customerTemp.setCreateOrgSid(useOrgSid);
customerTemp.setSid(UUID.randomUUID().toString()); customerTemp.setSid(UUID.randomUUID().toString());
if (StringUtils.isNotBlank(customerTemp.getCustomerPhoto())) { if (StringUtils.isNotBlank(customerTemp.getCustomerPhoto())) {
customerTemp.setCustomerPhoto(customerTemp.getCustomerPhoto().replace(fileUploadComponent.getUrlPrefix(), "")); customerTemp.setCustomerPhoto(customerTemp.getCustomerPhoto().replace(fileUploadComponent.getUrlPrefix(), ""));
@ -697,8 +704,8 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa
// Map<String, String> map = genetrateCustomerNum(dto.getCustomerTypeKey(), userOrgInfoVo); // Map<String, String> map = genetrateCustomerNum(dto.getCustomerTypeKey(), userOrgInfoVo);
customerTemp.setCreateBySid(dto.getUserSid()); customerTemp.setCreateBySid(dto.getUserSid());
customerTemp.setStaffSid(userOrgInfoVo.getStaffSid()); customerTemp.setStaffSid(userOrgInfoVo.getStaffSid());
String orgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData(); // String orgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData();
customerTemp.setCreateOrgSid(orgSid); // customerTemp.setCreateOrgSid(orgSid);
// customerTemp.setCreateOrgSid(userOrgInfoVo.getOrgSid()); // customerTemp.setCreateOrgSid(userOrgInfoVo.getOrgSid());
// customerTemp.setCustomerNo(map.get("code")); // customerTemp.setCustomerNo(map.get("code"));
customerTemp.setCertificateTypeKey(customerTemp.getCustomerTypeKey().equals("1") ? "01" : "02"); customerTemp.setCertificateTypeKey(customerTemp.getCustomerTypeKey().equals("1") ? "01" : "02");
@ -1001,8 +1008,8 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa
} }
} }
} }
customerNoPrefix = customerNoPrefix+ mobile + HanZiConverterPinYin.getPinYinFirst(name) ; customerNoPrefix = customerNoPrefix + mobile + HanZiConverterPinYin.getPinYinFirst(name);
return customerNoPrefix.length()>30?customerNoPrefix.substring(0,29):customerNoPrefix; return customerNoPrefix.length() > 30 ? customerNoPrefix.substring(0, 29) : customerNoPrefix;
} }
private Map<String, String> genetrateCustomerNumO(String customerTypeKey, SysUserInfoVo sysUserInfoVo) { private Map<String, String> genetrateCustomerNumO(String customerTypeKey, SysUserInfoVo sysUserInfoVo) {
@ -1044,7 +1051,7 @@ public class CrmCustomerTempService extends MybatisBaseService<CrmCustomerTempMa
} }
if (StringUtils.isNotBlank(mobile)) { if (StringUtils.isNotBlank(mobile)) {
String customerNo = getPrefix(staffSid, dto.getName(), dto.getMobile()); String customerNo = getPrefix(staffSid, dto.getName(), dto.getMobile());
CrmCustomerTempVo crmCustomerTempVo = baseMapper.selectNo1(customerNo,sid); CrmCustomerTempVo crmCustomerTempVo = baseMapper.selectNo1(customerNo, sid);
// CrmCustomerTempVo crmCustomerTempVo = baseMapper.selectByMobile(staffSid, mobile); // CrmCustomerTempVo crmCustomerTempVo = baseMapper.selectByMobile(staffSid, mobile);
if (crmCustomerTempVo != null && !crmCustomerTempVo.getStaffSid().equals(sysUserInfoVo.getStaffSid())) { if (crmCustomerTempVo != null && !crmCustomerTempVo.getStaffSid().equals(sysUserInfoVo.getStaffSid())) {
return rb.setMsg("该手机号已绑定其他客户,请重新添加"); return rb.setMsg("该手机号已绑定其他客户,请重新添加");

2
anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmvehicledemand/CrmVehicledemandMapper.xml

@ -20,7 +20,7 @@
</select> </select>
<select id="fetchByCustomerSid" resultType="com.yxt.anrui.crm.api.crmvehicledemand.CrmVehicledemandVo"> <select id="fetchByCustomerSid" resultType="com.yxt.anrui.crm.api.crmvehicledemand.CrmVehicledemandVo">
SELECT sid SELECT *
FROM crm_vehicledemand FROM crm_vehicledemand
WHERE customerSid = #{customerSid} WHERE customerSid = #{customerSid}
AND states = 1 AND states = 1

79
anrui-crm/anrui-crm-biz/src/main/java/com/yxt/anrui/crm/biz/crmvisit/CrmVisitService.java

@ -375,7 +375,18 @@ public class CrmVisitService extends MybatisBaseService<CrmVisitMapper, CrmVisit
public ResultBean saveCrmVisit(AppCrmVisitDto appCrmVisitDto) { public ResultBean saveCrmVisit(AppCrmVisitDto appCrmVisitDto) {
ResultBean rb = ResultBean.fireFail(); ResultBean rb = ResultBean.fireFail();
String userSid = appCrmVisitDto.getUserSid();
String staffSid = sysUserFeign.fetchBySid(userSid).getData().getStaffSid();
String orgSid = sysUserFeign.getSysUserByMobile(staffSid).getData().getOrgSid();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String customerSid = appCrmVisitDto.getCustomerSid();
String remind_day = appCrmVisitDto.getRemind_day();
String remind_remark = appCrmVisitDto.getRemind_remark();
String isOnRemind = appCrmVisitDto.getIsOnRemind();
String follow_state = appCrmVisitDto.getFollow_state();
String isOnRemindkey = appCrmVisitDto.getIsOnRemindkey(); String isOnRemindkey = appCrmVisitDto.getIsOnRemindkey();
if (StringUtils.isNotBlank(isOnRemindkey)) { // 0 未开启 1 开启 if (StringUtils.isNotBlank(isOnRemindkey)) { // 0 未开启 1 开启
String remindDay = "未设置提醒"; String remindDay = "未设置提醒";
if (isOnRemindkey.equals("0")) { if (isOnRemindkey.equals("0")) {
@ -394,65 +405,49 @@ public class CrmVisitService extends MybatisBaseService<CrmVisitMapper, CrmVisit
} }
} }
} }
String customerSid = appCrmVisitDto.getCustomerSid(); List<String> materialsList = appCrmVisitDto.getMaterialsList();
String remind_day = appCrmVisitDto.getRemind_day(); String visit_witness_materials = "";
String remind_remark = appCrmVisitDto.getRemind_remark(); int i = crmCustomerService.updateRemindAndByCustomerSid(customerSid, remind_day, remind_remark, isOnRemind, isOnRemindkey, follow_state);
String isOnRemind = appCrmVisitDto.getIsOnRemind();
String follow_state = appCrmVisitDto.getFollow_state();
int i = crmCustomerService.updateRemindAndByCustomerSid(customerSid, remind_day, remind_remark, isOnRemind, isOnRemindkey,follow_state);
if (i > 0) { if (i > 0) {
CrmVisit entity = new CrmVisit(); CrmVisit entity = new CrmVisit();
List<String> materialsList = appCrmVisitDto.getMaterialsList(); appCrmVisitDto.fillEntity(entity);
entity.setCustomerSid(appCrmVisitDto.getCustomerSid());
entity.setStaffSid(staffSid);
entity.setOrgSid(orgSid);
entity.setPositionInformation(appCrmVisitDto.getLocationStr());
entity.setFollow_time(format.format(new Date()));
if (materialsList.size() > 0) { if (materialsList.size() > 0) {
String visit_witness_materials = "";
for (int j = 0; j < materialsList.size(); j++) { for (int j = 0; j < materialsList.size(); j++) {
String url = materialsList.get(j); String url = materialsList.get(j);
visit_witness_materials += url.replace(fileUploadComponent.getUrlPrefix(), "") + ","; visit_witness_materials += url.replace(fileUploadComponent.getUrlPrefix(), "") + ",";
} }
appCrmVisitDto.setVisit_witness_materials(visit_witness_materials.substring(0, visit_witness_materials.length() - 1)); appCrmVisitDto.setVisit_witness_materials(visit_witness_materials.substring(0, visit_witness_materials.length() - 1));
} else {
appCrmVisitDto.setVisit_witness_materials("");
}
appCrmVisitDto.fillEntity(entity);
String userSid = appCrmVisitDto.getUserSid();
String staffSid = sysUserFeign.fetchBySid(userSid).getData().getStaffSid();
String orgSid = sysUserFeign.getSysUserByMobile(staffSid).getData().getOrgSid();
entity.setSid(UUID.randomUUID().toString());
entity.setCustomerSid(appCrmVisitDto.getCustomerSid());
entity.setStaffSid(staffSid);
entity.setOrgSid(orgSid);
String location = appCrmVisitDto.getLocation();
if (location == null) {
entity.setLongitude("");
entity.setLatitude("");
} }
String[] split = location.split(","); // 取出详细地址经纬度
for (int i1 = 0; i1 < split.length; i1++) { if (StringUtils.isNotBlank(appCrmVisitDto.getLocation())) {
entity.setLongitude(split[0]); String[] split = appCrmVisitDto.getLocation().split(",");
entity.setLatitude(split[1]); for (int i1 = 0; i1 < split.length; i1++) {
} entity.setLongitude(split[0]);
entity.setPositionInformation(appCrmVisitDto.getLocationStr()); entity.setLatitude(split[1]);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String follow_time = formatter.format(new Date());
entity.setFollow_time(follow_time);
List<String> list = appCrmVisitDto.getMaterialsList();
if (list.size() > 0) {
for (String s : list) {
AppCommonAppendixDto appCommonAppendixDto = new AppCommonAppendixDto();
appCommonAppendixDto.setFilePath(appCrmVisitDto.getMaterialsList());
appCommonAppendixDto.setAttachType(CommonAttachTypeEnum.WITNESS.getAttachType());
appCommonAppendixDto.setLinkSid(entity.getSid());
commonAppendixFeign.saveOrUpdateAppAppendix(appCommonAppendixDto);
} }
} }
String visitSid = entity.getSid(); //保存跟进材料附件
if (materialsList.size() > 0) {
AppCommonAppendixDto appCommonAppendixDto = new AppCommonAppendixDto();
appCommonAppendixDto.setFilePath(materialsList);
appCommonAppendixDto.setAttachType(CommonAttachTypeEnum.WITNESS.getAttachType());
appCommonAppendixDto.setLinkSid(entity.getSid());
commonAppendixFeign.saveOrUpdateAppAppendix(appCommonAppendixDto);
}
//客户需求车辆和跟进记录关联
List<CrmVehicledemandVo> crmVehicledemandVos = crmVehicledemandService.fetchByCustomerSid(customerSid); List<CrmVehicledemandVo> crmVehicledemandVos = crmVehicledemandService.fetchByCustomerSid(customerSid);
if (crmVehicledemandVos.size() > 0) { if (crmVehicledemandVos.size() > 0) {
for (CrmVehicledemandVo crmVehicledemandVo : crmVehicledemandVos) { for (CrmVehicledemandVo crmVehicledemandVo : crmVehicledemandVos) {
String demandSid = crmVehicledemandVo.getSid(); String demandSid = crmVehicledemandVo.getSid();
crmVisitDemandService.saveByVisit(visitSid, demandSid); crmVisitDemandService.saveByVisit(entity.getSid(), demandSid);
} }
} }
int insert = baseMapper.insert(entity); int insert = baseMapper.insert(entity);
if (insert > 0) { if (insert > 0) {
return rb.success().setMsg("添加成功"); return rb.success().setMsg("添加成功");

Loading…
Cancel
Save