|
@@ -39,6 +39,7 @@ import java.lang.reflect.Method;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -61,6 +62,8 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
@Resource
|
|
@Resource
|
|
private TaskMapper taskMapper;
|
|
private TaskMapper taskMapper;
|
|
@Resource
|
|
@Resource
|
|
|
|
+ private ProductMapper productMapper;
|
|
|
|
+ @Resource
|
|
private ActionLogMapper actionLogMapper;
|
|
private ActionLogMapper actionLogMapper;
|
|
@Resource
|
|
@Resource
|
|
private BusinessItemProductMapper bipMapper;
|
|
private BusinessItemProductMapper bipMapper;
|
|
@@ -78,6 +81,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private SysDictMapper sysDictMapper;
|
|
private SysDictMapper sysDictMapper;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<BusinessOpportunity> getAll(BusinessOpportunity bo) {
|
|
public List<BusinessOpportunity> getAll(BusinessOpportunity bo) {
|
|
return bOMapper.selectAllList(bo);
|
|
return bOMapper.selectAllList(bo);
|
|
@@ -91,11 +95,46 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
@Override
|
|
@Override
|
|
public BusinessOpportunity getInfo(BusinessOpportunity bo, User user) {
|
|
public BusinessOpportunity getInfo(BusinessOpportunity bo, User user) {
|
|
BusinessOpportunity businessOpportunity = bOMapper.selectByIdToInfo(bo.getId());
|
|
BusinessOpportunity businessOpportunity = bOMapper.selectByIdToInfo(bo.getId());
|
|
- businessOpportunity.setActionLogList(actionLogMapper.selectList(new QueryWrapper<ActionLog>().eq("item_id", bo.getId()).eq("code", "business")));
|
|
|
|
- businessOpportunity.setUploadFilePList(uploadFileMapper.selectByInfoList("business",bo.getId()));
|
|
|
|
- businessOpportunity.setTaskList(taskMapper.selectList(new QueryWrapper<Task>().eq("business_opportunity_id",bo.getId())));
|
|
|
|
|
|
+ businessOpportunity.setActionLogList(actionLogMapper.selectByInfoListBusiness(bo.getId()));
|
|
|
|
+ businessOpportunity.setUploadFilePList(uploadFileMapper.selectByInfoList("business", bo.getId()));
|
|
|
|
+ List<Task> tasks = taskMapper.selectList(new QueryWrapper<Task>().eq("business_opportunity_id", bo.getId()));
|
|
|
|
+ for (Task task : tasks) {
|
|
|
|
+ String executorId = task.getExecutorId();
|
|
|
|
+ if (executorId != null && executorId != ""){
|
|
|
|
+ List<String> list = Arrays.asList(executorId.split(","));
|
|
|
|
+ List<User> users = userMapper.selectList(new QueryWrapper<User>().in("id", list));
|
|
|
|
+ List<String> executorNamesList = users.stream()
|
|
|
|
+ .map(User::getName)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ task.setExecutorNames(executorNamesList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ businessOpportunity.setTaskList(tasks);
|
|
List<BusinessItemProduct> businessItemProducts = bipMapper.selectList(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
|
|
List<BusinessItemProduct> businessItemProducts = bipMapper.selectList(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
|
|
- if (businessItemProducts.size() > 0){
|
|
|
|
|
|
+ if (businessItemProducts.size() > 0) {
|
|
|
|
+
|
|
|
|
+ List<Integer> productIds = businessItemProducts.stream()
|
|
|
|
+ .map(BusinessItemProduct::getProductId)
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ List<Product> products = productMapper.selectList(new QueryWrapper<Product>().in("id", productIds));
|
|
|
|
+ List<SysDict> sysDicts = sysDictMapper.selectList(new QueryWrapper<SysDict>().eq("code", "ProductType").or().eq("code", "ProductUnit"));
|
|
|
|
+ for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
|
|
+ for (Product product : products) {
|
|
|
|
+ if(businessItemProduct.getProductId().equals(product.getId())){
|
|
|
|
+ businessItemProduct.setProductName(product.getProductName());
|
|
|
|
+ for (SysDict sysDict : sysDicts) {
|
|
|
|
+ if (product.getType().equals(sysDict.getId())){
|
|
|
|
+ businessItemProduct.setProductType(sysDict.getName());
|
|
|
|
+ }
|
|
|
|
+ if (product.getUnit().equals(sysDict.getId())){
|
|
|
|
+ businessItemProduct.setUnit(sysDict.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
BigDecimal finalPrice = new BigDecimal(0);
|
|
BigDecimal finalPrice = new BigDecimal(0);
|
|
BigDecimal discountedPrice = new BigDecimal(0);
|
|
BigDecimal discountedPrice = new BigDecimal(0);
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
@@ -107,7 +146,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
// 折后价格
|
|
// 折后价格
|
|
discountedPrice = discountedPrice.add(price.multiply(divide));
|
|
discountedPrice = discountedPrice.add(price.multiply(divide));
|
|
}
|
|
}
|
|
- BigDecimal divide = discountedPrice.divide(finalPrice,2,BigDecimal.ROUND_UP);
|
|
|
|
|
|
+ BigDecimal divide = discountedPrice.divide(finalPrice, 2, BigDecimal.ROUND_UP);
|
|
// 整单折扣率
|
|
// 整单折扣率
|
|
businessOpportunity.setFinalPrice(divide.multiply(new BigDecimal(100)));
|
|
businessOpportunity.setFinalPrice(divide.multiply(new BigDecimal(100)));
|
|
}
|
|
}
|
|
@@ -140,18 +179,17 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void insert(BusinessOpportunity bo) {
|
|
public void insert(BusinessOpportunity bo) {
|
|
setNull(bo);
|
|
setNull(bo);
|
|
- bo.setCreateTime(new Date());
|
|
|
|
bOMapper.insert(bo);
|
|
bOMapper.insert(bo);
|
|
List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
businessItemProduct.setBusinessId(bo.getId());
|
|
businessItemProduct.setBusinessId(bo.getId());
|
|
-// businessItemProduct.setId(null);
|
|
|
|
bipMapper.insert(businessItemProduct);
|
|
bipMapper.insert(businessItemProduct);
|
|
}
|
|
}
|
|
ActionLog actionLog = new ActionLog();
|
|
ActionLog actionLog = new ActionLog();
|
|
actionLog.setUserId(bo.getUserId());
|
|
actionLog.setUserId(bo.getUserId());
|
|
actionLog.setItemId(bo.getId());
|
|
actionLog.setItemId(bo.getId());
|
|
actionLog.setCode("business");
|
|
actionLog.setCode("business");
|
|
|
|
+ actionLog.setCreatTime(new Date());
|
|
actionLog.setName("创建了商机");
|
|
actionLog.setName("创建了商机");
|
|
actionLogMapper.insert(actionLog);
|
|
actionLogMapper.insert(actionLog);
|
|
}
|
|
}
|
|
@@ -161,7 +199,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
public void update(BusinessOpportunity bo, String userId) {
|
|
public void update(BusinessOpportunity bo, String userId) {
|
|
setNull(bo);
|
|
setNull(bo);
|
|
bOMapper.updateById(bo);
|
|
bOMapper.updateById(bo);
|
|
- bipMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id",bo.getId()));
|
|
|
|
|
|
+ bipMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
|
|
List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
businessItemProduct.setBusinessId(bo.getId());
|
|
businessItemProduct.setBusinessId(bo.getId());
|
|
@@ -219,13 +257,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
private String path;
|
|
private String path;
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public HttpRespMsg saveProduct(BusinessOpportunity bo, User user) {
|
|
public HttpRespMsg saveProduct(BusinessOpportunity bo, User user) {
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
msg.setMsg("操作成功");
|
|
msg.setMsg("操作成功");
|
|
- biMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id",bo.getId()));
|
|
|
|
|
|
+ biMapper.delete(new QueryWrapper<BusinessItemProduct>().eq("business_id", bo.getId()));
|
|
List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
List<BusinessItemProduct> businessItemProducts = JSONArray.parseArray(bo.getBusinessItemProductList(), BusinessItemProduct.class);
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
for (BusinessItemProduct businessItemProduct : businessItemProducts) {
|
|
biMapper.insert(businessItemProduct);
|
|
biMapper.insert(businessItemProduct);
|
|
@@ -241,6 +278,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
|
|
|
@Value(value = "${upload.file}")
|
|
@Value(value = "${upload.file}")
|
|
private String filePath;
|
|
private String filePath;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Object uploadFile(BusinessOpportunity bo, HttpServletRequest request, MultipartFile file) {
|
|
public Object uploadFile(BusinessOpportunity bo, HttpServletRequest request, MultipartFile file) {
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
@@ -316,7 +354,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
try {
|
|
try {
|
|
ServletOutputStream os = response.getOutputStream();
|
|
ServletOutputStream os = response.getOutputStream();
|
|
UploadFile uploadFile = uploadFileMapper.selectById(file.getId());
|
|
UploadFile uploadFile = uploadFileMapper.selectById(file.getId());
|
|
- if (uploadFile == null ){
|
|
|
|
|
|
+ if (uploadFile == null) {
|
|
msg.setError("文件未找到");
|
|
msg.setError("文件未找到");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -354,7 +392,10 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Object reFileName(UploadFile uploadFile, HttpServletRequest request) {
|
|
public Object reFileName(UploadFile uploadFile, HttpServletRequest request) {
|
|
- return uploadFileMapper.update(null, new UpdateWrapper<UploadFile>().eq("id", uploadFile.getId()).set("name", uploadFile.getName()));
|
|
|
|
|
|
+ uploadFileMapper.update(null, new UpdateWrapper<UploadFile>().eq("item_id", uploadFile.getId()).eq("code", "business").set("name", uploadFile.getName()));
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ httpRespMsg.setMsg("操作成功");
|
|
|
|
+ return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -378,12 +419,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> getDataSummary(Integer companyId, String startDate, String endDate, String userId, List<String> targetUserIds) {
|
|
public Map<String, Object> getDataSummary(Integer companyId, String startDate, String endDate, String userId, List<String> targetUserIds) {
|
|
- return bOMapper.getDataSummary(companyId,startDate,endDate,userId,targetUserIds);
|
|
|
|
|
|
+ return bOMapper.getDataSummary(companyId, startDate, endDate, userId, targetUserIds);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<Map<String, Object>> getDataStage(Integer companyId, String startDate, String endDate, String userId, List<String> targetUserIds) {
|
|
public List<Map<String, Object>> getDataStage(Integer companyId, String startDate, String endDate, String userId, List<String> targetUserIds) {
|
|
- return bOMapper.getDataStage(companyId,startDate,endDate,userId,targetUserIds);
|
|
|
|
|
|
+ return bOMapper.getDataStage(companyId, startDate, endDate, userId, targetUserIds);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -393,7 +434,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg importData(MultipartFile multipartFile) {
|
|
public HttpRespMsg importData(MultipartFile multipartFile) {
|
|
- HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
String fileName = multipartFile.getOriginalFilename();
|
|
String fileName = multipartFile.getOriginalFilename();
|
|
File file = new File(fileName == null ? "file" : fileName);
|
|
File file = new File(fileName == null ? "file" : fileName);
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
@@ -421,15 +462,15 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
int rowNum = sheet.getLastRowNum();
|
|
int rowNum = sheet.getLastRowNum();
|
|
//获取当前表单模板 校验规则
|
|
//获取当前表单模板 校验规则
|
|
SysForm sysForm = sysFormMapper.selectOne(new LambdaQueryWrapper<SysForm>().eq(SysForm::getCode, "Thread").eq(SysForm::getCompanyId, companyId).eq(SysForm::getIsCurrent, 1));
|
|
SysForm sysForm = sysFormMapper.selectOne(new LambdaQueryWrapper<SysForm>().eq(SysForm::getCode, "Thread").eq(SysForm::getCompanyId, companyId).eq(SysForm::getIsCurrent, 1));
|
|
- if(sysForm==null){
|
|
|
|
|
|
+ if (sysForm == null) {
|
|
msg.setError("当前模块未配置自定义模板,需先完成配置");
|
|
msg.setError("当前模块未配置自定义模板,需先完成配置");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
String config = sysForm.getConfig();
|
|
String config = sysForm.getConfig();
|
|
JSONObject configOb = JSON.parseObject(config);
|
|
JSONObject configOb = JSON.parseObject(config);
|
|
JSONArray configObJSONArray = configOb.getJSONArray("list");
|
|
JSONArray configObJSONArray = configOb.getJSONArray("list");
|
|
- List<String> userNameList=new ArrayList<>();
|
|
|
|
- HttpRespMsg respMsg=new HttpRespMsg();
|
|
|
|
|
|
+ List<String> userNameList = new ArrayList<>();
|
|
|
|
+ HttpRespMsg respMsg = new HttpRespMsg();
|
|
for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
|
|
for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
if (row == null) {
|
|
if (row == null) {
|
|
@@ -445,33 +486,34 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
String modelName = item.getString("model");
|
|
String modelName = item.getString("model");
|
|
XSSFCell cell = row.getCell(i);
|
|
XSSFCell cell = row.getCell(i);
|
|
- if(cell!=null){
|
|
|
|
- switch (item.getString("type")){
|
|
|
|
|
|
+ if (cell != null) {
|
|
|
|
+ switch (item.getString("type")) {
|
|
// case "time":cell.setCellType(CellType.NUMERIC);
|
|
// case "time":cell.setCellType(CellType.NUMERIC);
|
|
// break;
|
|
// break;
|
|
- default:cell.setCellType(CellType.STRING);
|
|
|
|
|
|
+ default:
|
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(modelName.equals("inchargerId")){
|
|
|
|
|
|
+ if (modelName.equals("inchargerId")) {
|
|
System.out.println("=====");
|
|
System.out.println("=====");
|
|
System.out.println(modelName);
|
|
System.out.println(modelName);
|
|
System.out.println(cell.toString());
|
|
System.out.println(cell.toString());
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ if (!StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
userNameList.add(cell.getStringCellValue());
|
|
userNameList.add(cell.getStringCellValue());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- System.out.println("参与搜索的人员列表"+userNameList + userNameList.size());
|
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
|
|
- respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
|
|
- if(respMsg.code.equals("0")){
|
|
|
|
- msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
|
|
|
|
|
|
+ System.out.println("参与搜索的人员列表" + userNameList + userNameList.size());
|
|
|
|
+ if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1 && userNameList.size() > 0) {
|
|
|
|
+ respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList, null);
|
|
|
|
+ if (respMsg.code.equals("0")) {
|
|
|
|
+ msg.setError("姓名为[" + String.valueOf(respMsg.data) + "]的人员存在重复,请使用工号!");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- List<User> targetUserList= (List<User>) respMsg.data;
|
|
|
|
|
|
+ List<User> targetUserList = (List<User>) respMsg.data;
|
|
//直接忽略空行 从row1开始
|
|
//直接忽略空行 从row1开始
|
|
for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
for (int rowIndex = 1; rowIndex <= rowNum; rowIndex++) {
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
@@ -484,7 +526,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
}
|
|
}
|
|
//获取到当前行的列数据
|
|
//获取到当前行的列数据
|
|
int cellNum = row.getLastCellNum();
|
|
int cellNum = row.getLastCellNum();
|
|
- BusinessOpportunity bo =new BusinessOpportunity();
|
|
|
|
|
|
+ BusinessOpportunity bo = new BusinessOpportunity();
|
|
bo.setCompanyId(companyId);
|
|
bo.setCompanyId(companyId);
|
|
bo.setCreateTime(new Date());
|
|
bo.setCreateTime(new Date());
|
|
bo.setCreatorId(user.getId());
|
|
bo.setCreatorId(user.getId());
|
|
@@ -492,65 +534,66 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
String modelName = item.getString("model");
|
|
String modelName = item.getString("model");
|
|
String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
|
|
String className = modelName.substring(0, 1).toUpperCase() + modelName.substring(1);
|
|
- String getter="get"+className;
|
|
|
|
- String setter="set"+className;
|
|
|
|
|
|
+ String getter = "get" + className;
|
|
|
|
+ String setter = "set" + className;
|
|
XSSFCell cell = row.getCell(i);
|
|
XSSFCell cell = row.getCell(i);
|
|
- if(cell!=null){
|
|
|
|
- switch (item.getString("type")){
|
|
|
|
|
|
+ if (cell != null) {
|
|
|
|
+ switch (item.getString("type")) {
|
|
// case "time":cell.setCellType(CellType.NUMERIC);
|
|
// case "time":cell.setCellType(CellType.NUMERIC);
|
|
// break;
|
|
// break;
|
|
- default:cell.setCellType(CellType.STRING);
|
|
|
|
|
|
+ default:
|
|
|
|
+ cell.setCellType(CellType.STRING);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//校验当前列是否为必填
|
|
//校验当前列是否为必填
|
|
JSONObject options = item.getJSONObject("options");
|
|
JSONObject options = item.getJSONObject("options");
|
|
JSONObject rules = options.getJSONObject("rules");
|
|
JSONObject rules = options.getJSONObject("rules");
|
|
Boolean required = rules.getBoolean("required");
|
|
Boolean required = rules.getBoolean("required");
|
|
- if(required){
|
|
|
|
- if(StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
- msg.setError(item.getString("label")+"值不能为空值");
|
|
|
|
|
|
+ if (required) {
|
|
|
|
+ if (StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
|
|
+ msg.setError(item.getString("label") + "值不能为空值");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(modelName.equals("inchargerId")){
|
|
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ if (modelName.equals("inchargerId")) {
|
|
|
|
+ if (!StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
String userName = cell.getStringCellValue();
|
|
String userName = cell.getStringCellValue();
|
|
Optional<User> first;
|
|
Optional<User> first;
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
|
|
+ if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
|
|
- first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
|
|
|
|
- }else {
|
|
|
|
- first= userList.stream().filter(u -> u.getName().equals(userName)||(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))).findFirst();
|
|
|
|
|
|
+ first = userList.stream().filter(u -> (u.getJobNumber() != null && u.getJobNumber().equals(userName)) || (optional.isPresent() && u.getCorpwxUserid() != null && u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
|
|
|
|
+ } else {
|
|
|
|
+ first = userList.stream().filter(u -> u.getName().equals(userName) || (u.getJobNumber() != null && u.getJobNumber().equals(userName))).findFirst();
|
|
}
|
|
}
|
|
if (first.isPresent()) {
|
|
if (first.isPresent()) {
|
|
bo.setInchargerId(first.get().getId());
|
|
bo.setInchargerId(first.get().getId());
|
|
} else {
|
|
} else {
|
|
- msg.setError("负责人["+userName+"]在系统中不存在");
|
|
|
|
|
|
+ msg.setError("负责人[" + userName + "]在系统中不存在");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else if(modelName.equals("contactsId")){
|
|
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ } else if (modelName.equals("contactsId")) {
|
|
|
|
+ if (!StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
String userName = cell.getStringCellValue();
|
|
String userName = cell.getStringCellValue();
|
|
Optional<User> first;
|
|
Optional<User> first;
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
|
|
+ if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
|
|
Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
|
|
- first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
|
|
|
|
- }else {
|
|
|
|
- first= userList.stream().filter(u -> u.getName().equals(userName)||(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))).findFirst();
|
|
|
|
|
|
+ first = userList.stream().filter(u -> (u.getJobNumber() != null && u.getJobNumber().equals(userName)) || (optional.isPresent() && u.getCorpwxUserid() != null && u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
|
|
|
|
+ } else {
|
|
|
|
+ first = userList.stream().filter(u -> u.getName().equals(userName) || (u.getJobNumber() != null && u.getJobNumber().equals(userName))).findFirst();
|
|
}
|
|
}
|
|
if (first.isPresent()) {
|
|
if (first.isPresent()) {
|
|
bo.setContactsId(Integer.parseInt(first.get().getId()));
|
|
bo.setContactsId(Integer.parseInt(first.get().getId()));
|
|
} else {
|
|
} else {
|
|
- msg.setError("负责人["+userName+"]在系统中不存在");
|
|
|
|
|
|
+ msg.setError("负责人[" + userName + "]在系统中不存在");
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if (!StringUtils.isEmpty(cell.getStringCellValue())) {
|
|
Class<Clue> clueClass = Clue.class;
|
|
Class<Clue> clueClass = Clue.class;
|
|
- Method method = clueClass.getMethod(setter,String.class);
|
|
|
|
- method.invoke(bo,cell.getStringCellValue());
|
|
|
|
|
|
+ Method method = clueClass.getMethod(setter, String.class);
|
|
|
|
+ method.invoke(bo, cell.getStringCellValue());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -577,6 +620,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
bOMapper.update(bo, new UpdateWrapper<BusinessOpportunity>().eq("id", bo.getId()).set("contacts_id", bo.getContactsId()));
|
|
bOMapper.update(bo, new UpdateWrapper<BusinessOpportunity>().eq("id", bo.getId()).set("contacts_id", bo.getContactsId()));
|
|
ActionLog al = new ActionLog();
|
|
ActionLog al = new ActionLog();
|
|
al.setCode("business");
|
|
al.setCode("business");
|
|
|
|
+ al.setCreatTime(new Date());
|
|
al.setName("关联了联系人");
|
|
al.setName("关联了联系人");
|
|
al.setUserId(user.getId());
|
|
al.setUserId(user.getId());
|
|
al.setItemId(bo.getId());
|
|
al.setItemId(bo.getId());
|
|
@@ -596,10 +640,11 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void saveStage(BusinessOpportunity bo, User user) {
|
|
public void saveStage(BusinessOpportunity bo, User user) {
|
|
- bOMapper.update(bo, new UpdateWrapper<BusinessOpportunity>().eq("id", bo.getId()).set("Stage_Id", bo.getStageId()));
|
|
|
|
|
|
+ bOMapper.update(bo, new UpdateWrapper<BusinessOpportunity>().eq("id", bo.getId()).set("Stage_Id", bo.getStageId()).set("edit_time",new Date()));
|
|
ActionLog al = new ActionLog();
|
|
ActionLog al = new ActionLog();
|
|
al.setCode("business");
|
|
al.setCode("business");
|
|
- al.setName("推进了阶段至"+bo.getStageValue());
|
|
|
|
|
|
+ al.setName("推进了阶段至" + bo.getStageValue());
|
|
|
|
+ al.setCreatTime(new Date());
|
|
al.setUserId(user.getId());
|
|
al.setUserId(user.getId());
|
|
al.setItemId(bo.getId());
|
|
al.setItemId(bo.getId());
|
|
actionLogMapper.insert(al);
|
|
actionLogMapper.insert(al);
|