|
@@ -12,6 +12,7 @@ import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.CustomService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.management.platform.service.SysFunctionService;
|
|
|
+import com.management.platform.service.WxCorpInfoService;
|
|
|
import com.management.platform.util.ExcelUtil;
|
|
|
import com.management.platform.util.FileUtil;
|
|
|
import com.management.platform.util.HttpRespMsg;
|
|
@@ -56,13 +57,18 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
private BusinessItemCustomMapper businessItemCustomMapper;
|
|
|
@Autowired
|
|
|
private CustomItemContactsMapper customItemContactsMapper;
|
|
|
+ @Resource
|
|
|
+ private ExcelExportServiceImpl excelExportService;
|
|
|
+ @Resource
|
|
|
+ private SysFormMapper sysFormMapper;
|
|
|
+ @Autowired
|
|
|
+ private WxCorpInfoService wxCorpInfoService;
|
|
|
@Autowired
|
|
|
private ActionLogMapper actionLogMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private UploadFileMapper uploadFileMapper;
|
|
|
- @Autowired
|
|
|
- private SysFormMapper sysFormMapper;
|
|
|
+
|
|
|
|
|
|
@Resource
|
|
|
private HttpServletRequest request;
|
|
@@ -482,7 +488,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
//由于第一行需要指明列对应的标题
|
|
|
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, "Customer").eq(SysForm::getCompanyId, companyId).eq(SysForm::getIsCurrent, 1));
|
|
|
if(sysForm==null){
|
|
|
msg.setError("当前模块未配置自定义模板,需先完成配置");
|
|
|
return msg;
|
|
@@ -546,10 +552,10 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
}
|
|
|
//获取到当前行的列数据
|
|
|
int cellNum = row.getLastCellNum();
|
|
|
- BusinessOpportunity bo =new BusinessOpportunity();
|
|
|
- bo.setCompanyId(companyId);
|
|
|
- bo.setCreateTime(new Date());
|
|
|
- bo.setCreatorId(user.getId());
|
|
|
+ Custom custom =new Custom();
|
|
|
+ custom.setCompanyId(companyId);
|
|
|
+ custom.setCreateTime(new Date());
|
|
|
+ custom.setCreatorId(user.getId());
|
|
|
for (int i = 0; i < cellNum; i++) {
|
|
|
JSONObject item = configObJSONArray.getJSONObject(i);
|
|
|
String modelName = item.getString("model");
|
|
@@ -559,8 +565,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
XSSFCell cell = row.getCell(i);
|
|
|
if(cell!=null){
|
|
|
switch (item.getString("type")){
|
|
|
-// case "time":cell.setCellType(CellType.NUMERIC);
|
|
|
-// break;
|
|
|
+
|
|
|
default:cell.setCellType(CellType.STRING);
|
|
|
}
|
|
|
}
|
|
@@ -585,24 +590,7 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
first= userList.stream().filter(u -> u.getName().equals(userName)||(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))).findFirst();
|
|
|
}
|
|
|
if (first.isPresent()) {
|
|
|
- bo.setInchargerId(first.get().getId());
|
|
|
- } else {
|
|
|
- msg.setError("负责人["+userName+"]在系统中不存在");
|
|
|
- return msg;
|
|
|
- }
|
|
|
- }
|
|
|
- }else if(modelName.equals("contactsId")){
|
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
- String userName = cell.getStringCellValue();
|
|
|
- Optional<User> first;
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
- 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();
|
|
|
- }
|
|
|
- if (first.isPresent()) {
|
|
|
- bo.setContactsId(Integer.parseInt(first.get().getId()));
|
|
|
+ custom.setInchargerId(first.get().getId());
|
|
|
} else {
|
|
|
msg.setError("负责人["+userName+"]在系统中不存在");
|
|
|
return msg;
|
|
@@ -612,12 +600,12 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
|
|
|
if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
Class<Clue> clueClass = Clue.class;
|
|
|
Method method = clueClass.getMethod(setter,String.class);
|
|
|
- method.invoke(bo,cell.getStringCellValue());
|
|
|
+ method.invoke(custom,cell.getStringCellValue());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- bOMapper.insert(bo);
|
|
|
+ customMapper.insert(custom);
|
|
|
}
|
|
|
} catch (IOException | NoSuchMethodException e) {
|
|
|
e.printStackTrace();
|