|
@@ -5,16 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
-
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
-
|
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
-
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
@@ -29,19 +25,23 @@ import org.jeecg.modules.adweb.common.constant.AdwebConstant;
|
|
import org.jeecg.modules.adweb.common.util.AwsTranslateUtils;
|
|
import org.jeecg.modules.adweb.common.util.AwsTranslateUtils;
|
|
import org.jeecg.modules.adweb.common.util.DateUtil;
|
|
import org.jeecg.modules.adweb.common.util.DateUtil;
|
|
import org.jeecg.modules.adweb.common.util.ListUtil;
|
|
import org.jeecg.modules.adweb.common.util.ListUtil;
|
|
-import org.jeecg.modules.adweb.enquiry.dto.param.AdmpEnquirySearchDto;
|
|
|
|
|
|
+import org.jeecg.modules.adweb.enquiry.constant.EnquirySendStatus;
|
|
|
|
+import org.jeecg.modules.adweb.enquiry.dto.param.EnquirySearchDto;
|
|
|
|
+import org.jeecg.modules.adweb.enquiry.dto.param.EffectiveEnquiryParamDto;
|
|
import org.jeecg.modules.adweb.enquiry.dto.param.EnquiryListSearchDto;
|
|
import org.jeecg.modules.adweb.enquiry.dto.param.EnquiryListSearchDto;
|
|
-import org.jeecg.modules.adweb.enquiry.dto.result.AdmpEnquiryListDto;
|
|
|
|
|
|
+import org.jeecg.modules.adweb.enquiry.dto.result.EnquiryListDto;
|
|
import org.jeecg.modules.adweb.enquiry.dto.result.EnquirySpecialFields;
|
|
import org.jeecg.modules.adweb.enquiry.dto.result.EnquirySpecialFields;
|
|
import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
|
|
import org.jeecg.modules.adweb.enquiry.entity.AdwebEnquiry;
|
|
|
|
+import org.jeecg.modules.adweb.enquiry.entity.EnquiryEmailMessage;
|
|
import org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryMapper;
|
|
import org.jeecg.modules.adweb.enquiry.mapper.AdwebEnquiryMapper;
|
|
import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryService;
|
|
import org.jeecg.modules.adweb.enquiry.service.IAdwebEnquiryService;
|
|
import org.jeecg.modules.adweb.site.entity.AdwebSite;
|
|
import org.jeecg.modules.adweb.site.entity.AdwebSite;
|
|
import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
|
|
import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
|
|
import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
|
|
import org.jeecg.modules.adweb.site.service.ISiteUserPermissionService;
|
|
import org.jeecg.modules.adweb.system.service.SysAdwebApi;
|
|
import org.jeecg.modules.adweb.system.service.SysAdwebApi;
|
|
|
|
+import org.jeecg.modules.system.entity.SysUser;
|
|
import org.jeecg.modules.system.service.ISysDictService;
|
|
import org.jeecg.modules.system.service.ISysDictService;
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
+import org.jeecg.modules.system.service.ISysUserService;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -96,6 +96,9 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
|
|
@Resource
|
|
@Resource
|
|
private AwsTranslateUtils awsTranslateUtils;
|
|
private AwsTranslateUtils awsTranslateUtils;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private ISysUserService sysUserService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
*
|
|
*
|
|
@@ -117,7 +120,7 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
|
|
return Result.OK(new Page<>());
|
|
return Result.OK(new Page<>());
|
|
}
|
|
}
|
|
|
|
|
|
- Page<AdmpEnquirySearchDto> page = new Page<> (pageNo, pageSize);
|
|
|
|
|
|
+ Page<EnquirySearchDto> page = new Page<> (pageNo, pageSize);
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
|
List<String> codeList = null;
|
|
List<String> codeList = null;
|
|
@@ -174,7 +177,7 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
|
|
String userEfftecive = "(" + searchDto.getUserEffective() + ")";
|
|
String userEfftecive = "(" + searchDto.getUserEffective() + ")";
|
|
|
|
|
|
|
|
|
|
- IPage<AdmpEnquiryListDto> pageList = adwebEnquiryMapper.selectAdmpEnquiryList(page, codeList, userEfftecive, searchDto.getWasteEnquiryType(),
|
|
|
|
|
|
+ IPage<EnquiryListDto> pageList = adwebEnquiryMapper.selectAdmpEnquiryList(page, codeList, userEfftecive, searchDto.getWasteEnquiryType(),
|
|
searchDto.getSearchText(), searchDto.getSearchContent(), start, end, searchDto.getWhatsApp(), searchDto.getReadStatus(), principalUid, selfPrincipalUid);
|
|
searchDto.getSearchText(), searchDto.getSearchContent(), start, end, searchDto.getWhatsApp(), searchDto.getReadStatus(), principalUid, selfPrincipalUid);
|
|
|
|
|
|
if (ListUtil.notEmpty(pageList.getRecords())) {
|
|
if (ListUtil.notEmpty(pageList.getRecords())) {
|
|
@@ -187,7 +190,7 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
|
|
* 处理询盘列表结果集
|
|
* 处理询盘列表结果集
|
|
* @param enquiryList
|
|
* @param enquiryList
|
|
*/
|
|
*/
|
|
- private void dealInfo(List<AdmpEnquiryListDto> enquiryList) {
|
|
|
|
|
|
+ private void dealInfo(List<EnquiryListDto> enquiryList) {
|
|
if (ListUtil.isEmpty(enquiryList)) {
|
|
if (ListUtil.isEmpty(enquiryList)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -545,6 +548,130 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 更改询盘用户有效性
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/update/user/effective")
|
|
|
|
+ public Result<?> updateUserEffective(EffectiveEnquiryParamDto effectiveEnquiryParamDto) {
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+
|
|
|
|
+ boolean res = adwebEnquiryService.updateUserEffective(effectiveEnquiryParamDto);
|
|
|
|
+ if (res) {
|
|
|
|
+ return Result.OK("ok");
|
|
|
|
+ }
|
|
|
|
+ return Result.error("fail");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 转发询盘
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "转发询盘")
|
|
|
|
+ @GetMapping(value = "/setForward")
|
|
|
|
+ public Result<?> setForward(@RequestParam String ids, @RequestParam String uid, @RequestParam String code) {
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+
|
|
|
|
+ SysUser user = sysUserService.getById(uid);
|
|
|
|
+ if (StringUtils.isEmpty(user.getEmail())){
|
|
|
|
+ return Result.error("该账户未设置邮箱!");
|
|
|
|
+ }
|
|
|
|
+ List<String> idList = Arrays.asList(ids.split(","));
|
|
|
|
+ UpdateWrapper<AdwebEnquiry> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.in("id", idList);
|
|
|
|
+ updateWrapper.set("principal_uid", uid);
|
|
|
|
+ updateWrapper.set("principal_type", 1);
|
|
|
|
+ adwebEnquiryService.update(updateWrapper);
|
|
|
|
+
|
|
|
|
+ QueryWrapper<AdwebEnquiry> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.in("id", idList);
|
|
|
|
+ List<AdwebEnquiry> list = adwebEnquiryService.list(queryWrapper);
|
|
|
|
+ //获取站点
|
|
|
|
+ QueryWrapper<AdwebSite> adwebSiteQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.eq("code",code);
|
|
|
|
+ AdwebSite adwebSite = adwebSiteService.getOne(adwebSiteQueryWrapper);
|
|
|
|
+ adwebEnquiryService.specialSendEmail(list, adwebSite);
|
|
|
|
+ //返回跟进人名称
|
|
|
|
+ for (String id: idList) {
|
|
|
|
+ AdwebEnquiry adwebEnquiry = adwebEnquiryService.getById(id);
|
|
|
|
+ if (adwebEnquiry != null && StringUtils.isNotBlank(adwebEnquiry.getRecordId())) {
|
|
|
|
+ adwebEnquiryService.returnSalesperson(code, adwebEnquiry.getRecordId(), user.getUsername());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return Result.OK();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 回收站列表接口
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "adweb_enquiry-分页列表查询")
|
|
|
|
+ @GetMapping(value = "/queryWasteEnquiryList")
|
|
|
|
+ public Result<?> queryWasteEnquiryList(Integer siteId,
|
|
|
|
+ String searchText,
|
|
|
|
+ String enquiryType,
|
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize) {
|
|
|
|
+ if (sysAdwebApi.isNotOwnSite(siteId)) {
|
|
|
|
+ return Result.OK(new Page<>());
|
|
|
|
+ }
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
+ Page<EnquirySearchDto> page = new Page<>(pageNo, pageSize);
|
|
|
|
+ List<String> codeList = null;
|
|
|
|
+ List<String> uidList = null;
|
|
|
|
+
|
|
|
|
+ if (sysAdwebApi.isAdmin()) {
|
|
|
|
+ } else if (sysAdwebApi.isOem()) {
|
|
|
|
+ uidList = sysAdwebApi.getOemGroupUids();
|
|
|
|
+ } else {
|
|
|
|
+ uidList = new ArrayList<>();
|
|
|
|
+ uidList.add(sysUser.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> siteCodeList = null;
|
|
|
|
+ if(ListUtil.notEmpty(uidList)){
|
|
|
|
+ siteCodeList = siteUserPermissionService.getSiteCodeListByUids(uidList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ codeList = adwebSiteService.list(new LambdaQueryWrapper<AdwebSite>()
|
|
|
|
+ .eq(siteId != null, AdwebSite::getId, siteId)
|
|
|
|
+ .in(!sysAdwebApi.isAdmin(), AdwebSite::getCode, siteCodeList)
|
|
|
|
+ .ne(AdwebSite::getStatus, 0)).stream().map(AdwebSite::getCode).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ String principalUid = null;
|
|
|
|
+ if (sysAdwebApi.isAdwebSubVip()) {
|
|
|
|
+ principalUid = sysUser.getId();
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotBlank(searchText)) {
|
|
|
|
+ searchText = searchText.trim();
|
|
|
|
+ }
|
|
|
|
+ enquiryType = "(" + enquiryType + ")";
|
|
|
|
+ IPage<EnquiryListDto> pageList = adwebEnquiryMapper.queryWasteEnquiryList(page, codeList, "", enquiryType, searchText, null, null, null, principalUid);
|
|
|
|
+ if (ListUtil.isEmpty(pageList.getRecords())) {
|
|
|
|
+ dealInfo(pageList.getRecords());
|
|
|
|
+ return Result.OK(pageList);
|
|
|
|
+ }
|
|
|
|
+ dealInfo(pageList.getRecords());
|
|
|
|
+ return Result.OK(pageList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据询盘信息创建邮件发送记录
|
|
|
|
+ * @param adwebEnquiry 询盘信息
|
|
|
|
+ * @param email 接收邮箱
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private static EnquiryEmailMessage newEmail(AdwebEnquiry adwebEnquiry, String email) {
|
|
|
|
+ EnquiryEmailMessage enquiryEmailMessage = new EnquiryEmailMessage();
|
|
|
|
+ enquiryEmailMessage.setEnquiryId(adwebEnquiry.getId());
|
|
|
|
+ enquiryEmailMessage.setEmail(email);
|
|
|
|
+ enquiryEmailMessage.setFromEmail(adwebEnquiry.getFromEmail());
|
|
|
|
+ enquiryEmailMessage.setCreateTime(new Date());
|
|
|
|
+ enquiryEmailMessage.setSiteCode(adwebEnquiry.getSiteCode());
|
|
|
|
+ enquiryEmailMessage.setSendStatus(EnquirySendStatus.WAIT_SEND);
|
|
|
|
+ enquiryEmailMessage.setSendErrorNum(0);
|
|
|
|
+
|
|
|
|
+ return enquiryEmailMessage;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 特殊时间数据处理
|
|
* 特殊时间数据处理
|
|
*
|
|
*
|
|
* @param dateType 时间
|
|
* @param dateType 时间
|
|
@@ -575,4 +702,5 @@ public class AdwebEnquiryController extends JeecgController<AdwebEnquiry, IAdweb
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|