|
@@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.huyi.service.base.entity.SysCompany;
|
|
|
import com.huyi.service.base.entity.SysCompanyRel;
|
|
|
import com.huyi.service.base.entity.SysCompanySpare;
|
|
|
-import com.huyi.service.base.service.ISysCompanyRelService;
|
|
|
-import com.huyi.service.base.service.ISysCompanyService;
|
|
|
-import com.huyi.service.base.service.ISysCompanySpareService;
|
|
|
-import com.huyi.service.base.service.ISysConfigService;
|
|
|
+import com.huyi.service.base.entity.SysUserCompanyRel;
|
|
|
+import com.huyi.service.base.service.*;
|
|
|
import com.tianhu.common.core.exception.BaseException;
|
|
|
import com.tianhu.common.core.utils.CommonUtil;
|
|
|
import com.tianhu.common.core.utils.DateUtils;
|
|
@@ -19,6 +17,7 @@ import com.tianhu.common.log.annotation.Log;
|
|
|
import com.tianhu.common.log.enums.BusinessType;
|
|
|
import com.tianhu.common.security.annotation.PreAuthorize;
|
|
|
import com.tianhu.common.security.service.TokenService;
|
|
|
+import com.tianhu.system.api.RemoteSystemService;
|
|
|
import com.tianhu.system.api.domain.SysUser;
|
|
|
import com.tianhu.system.api.model.LoginUser;
|
|
|
import org.apache.poi.hssf.usermodel.*;
|
|
@@ -62,7 +61,7 @@ public class CompanyRelImportController extends BaseController
|
|
|
private ISysCompanyRelService iSysCompanyRelService;
|
|
|
|
|
|
@Autowired
|
|
|
- private ISysConfigService configService;
|
|
|
+ private RemoteSystemService remoteSystemService;
|
|
|
|
|
|
@Autowired
|
|
|
private ISysCompanyService iSysCompanyService;
|
|
@@ -71,6 +70,9 @@ public class CompanyRelImportController extends BaseController
|
|
|
private ISysCompanySpareService iSysCompanySpareService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private ISysUserCompanyRelService iSysUserCompanyRelService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private TokenService tokenService;
|
|
|
|
|
|
/**
|
|
@@ -192,13 +194,13 @@ public class CompanyRelImportController extends BaseController
|
|
|
//获取当前操作人员
|
|
|
LoginUser userInfo = tokenService.getLoginUser();
|
|
|
SysUser use = userInfo.getSysUser();
|
|
|
- String companyId = use.getCompanyId();
|
|
|
String userId = String.valueOf(use.getUserId());
|
|
|
|
|
|
//MultipartFile转File
|
|
|
File files = multipartFileToFile(file);
|
|
|
//获取第一行数据
|
|
|
String hId = "";
|
|
|
+ String name = "";
|
|
|
try {
|
|
|
FileInputStream fis = new FileInputStream(files);
|
|
|
HSSFWorkbook wb = new HSSFWorkbook(fis);
|
|
@@ -206,7 +208,7 @@ public class CompanyRelImportController extends BaseController
|
|
|
HSSFRow row = s.getRow(0);
|
|
|
HSSFCell cell = row.getCell((short) 0);
|
|
|
HSSFCell hssfCell = row.getCell((short) 1);
|
|
|
- String name = cell.getStringCellValue();
|
|
|
+ name = cell.getStringCellValue();
|
|
|
String code = hssfCell.getStringCellValue();
|
|
|
LambdaQueryWrapper<SysCompany> com = new LambdaQueryWrapper<>();
|
|
|
com.eq(SysCompany::getScyName,name);
|
|
@@ -221,6 +223,8 @@ public class CompanyRelImportController extends BaseController
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
+ SysCompany launchCompany = iSysCompanyService.getById(hId);
|
|
|
+
|
|
|
//列表对应字段
|
|
|
List<String> columnName = new ArrayList<>();
|
|
|
columnName.add("scyName");
|
|
@@ -234,14 +238,6 @@ public class CompanyRelImportController extends BaseController
|
|
|
}
|
|
|
//未添加成功的list
|
|
|
String userNameList = "";
|
|
|
- //链属集合
|
|
|
- List<SysCompanyRel> relList = new ArrayList<>();
|
|
|
- //链属企业信息
|
|
|
- List<SysCompanySpare> spareList = new ArrayList<>();
|
|
|
- List<SysCompanySpare> spareRelList = new ArrayList<>();
|
|
|
- //校验集合
|
|
|
- List<String> relSpareList = new ArrayList<>();
|
|
|
- //个税详情表集合
|
|
|
//返回结果信息
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
int failureNum = 0;
|
|
@@ -420,7 +416,6 @@ public class CompanyRelImportController extends BaseController
|
|
|
sysCompanyRel.setCreateBy(userId);
|
|
|
//创建时间
|
|
|
sysCompanyRel.setCreateTime(DateUtils.getNowDate());
|
|
|
-// relList.add(sysCompanyRel);
|
|
|
iSysCompanyRelService.createSysCompanyRel(sysCompanyRel);
|
|
|
//新增链属信息表
|
|
|
SysCompanySpare sysCompanySpare = new SysCompanySpare();
|
|
@@ -446,8 +441,26 @@ public class CompanyRelImportController extends BaseController
|
|
|
sysCompanySpare.setCreateBy(userId);
|
|
|
//创建时间
|
|
|
sysCompanySpare.setCreateTime(DateUtils.getNowDate());
|
|
|
-// spareList.add(sysCompanySpare);
|
|
|
iSysCompanySpareService.createSysCompanySpare(sysCompanySpare);
|
|
|
+ //查询接收方企业类型
|
|
|
+ SysCompany sysCompany = iSysCompanyService.getById(scyId);
|
|
|
+ String scyType = sysCompany.getScyType();
|
|
|
+ //获取企业经办人Id:(longs)
|
|
|
+ LambdaQueryWrapper<SysUserCompanyRel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(SysUserCompanyRel::getSucrCompanyId,scyId);
|
|
|
+ lambdaQueryWrapper.eq(SysUserCompanyRel::getSucrHandler,"1");
|
|
|
+ List<SysUserCompanyRel> userCompanyRelList = iSysUserCompanyRelService.findSysUserCompanyRels(lambdaQueryWrapper);
|
|
|
+ Long longs = userCompanyRelList.get(0).getSucrUserId();
|
|
|
+ //接收方为核心企业时,发送待办
|
|
|
+ if(CONFIRM_STATE.equals(scyType)){
|
|
|
+ String title = launchCompany.getScyName() +"邀请您成为链属企业,请及时处理";
|
|
|
+ remoteSystemService.sendNotice(scyId, id,title,"00",null,"09","0",longs.toString(),null,"00",null);
|
|
|
+ }
|
|
|
+ //接收方为供应商时,发送消息
|
|
|
+ if(REFUSE_STATE.equals(scyType)){
|
|
|
+ String title = launchCompany.getScyName() + "与您成为了链属企业";
|
|
|
+ remoteSystemService.sendNotice(scyId, id,title,"01","03",null,"0",longs.toString(),null,null,null);
|
|
|
+ }
|
|
|
}else {
|
|
|
//查询企业名称是否已经存在
|
|
|
LambdaQueryWrapper<SysCompany> companyLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -517,8 +530,12 @@ public class CompanyRelImportController extends BaseController
|
|
|
//联系人手机号
|
|
|
String scpContarctPhone = sysCompanySpare.getScpContarctPhone();
|
|
|
if(CommonUtil.isNotEmpty(scpContarct) && CommonUtil.isNotEmpty(scpContarctPhone)) {
|
|
|
+ String title = "【企业邀请】"+ name +"邀请"+ scyName +"非平台用户,请联系"+ scpContarct + scpContarctPhone +"跟进";
|
|
|
+ remoteSystemService.sendNotice(/*企业id*/"000000", /*表主键*/id, /*标题*/title,/*待办*/"00",
|
|
|
+ /*消息类型*/null,/*待办类型*/"03",/*是否发送短信*/"0", /*收到信息用户id*/"1",
|
|
|
+ null, null, null);
|
|
|
//获取字典的阿里短信模板
|
|
|
- String templateCode = "SMS_222871823";
|
|
|
+// String templateCode = "SMS_222871823";
|
|
|
// List<SysDictData> state = RedisUtils.getDictCache("aliyun_message_code");
|
|
|
// for (SysDictData sysDictData :state){
|
|
|
// if("yaoqing".equals(sysDictData.getDictLabel())) {
|
|
@@ -526,10 +543,10 @@ public class CompanyRelImportController extends BaseController
|
|
|
// }
|
|
|
// }
|
|
|
//获取url
|
|
|
- String url = configService.selectConfigByKey("zc_spare");
|
|
|
- Map msgMap = new HashMap();
|
|
|
- msgMap.put("companyName", scpContarct);
|
|
|
- msgMap.put("url", url);
|
|
|
+// String url = configService.selectConfigByKey("zc_spare");
|
|
|
+// Map msgMap = new HashMap();
|
|
|
+// msgMap.put("companyName", scpContarct);
|
|
|
+// msgMap.put("url", url);
|
|
|
//发送短信
|
|
|
// iMessageUtilsService.sendMessageCode(scpContarctPhone, templateCode, msgMap,null);
|
|
|
//邀请次数赋值
|