|
|
@@ -1,5 +1,6 @@
|
|
|
package com.mokamrp.privates.service.pangu.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
@@ -8,11 +9,13 @@ import com.mokamrp.privates.entity.VoltaHandle;
|
|
|
import com.mokamrp.privates.entity.pangu.GetForsterwxMobileHandle;
|
|
|
import com.mokamrp.privates.mapper.pangu.FosterwxMobileMapper;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobilePool;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
import com.mokamrp.privates.mapper.pojo.Corp;
|
|
|
import com.mokamrp.privates.mapper.pojo.User;
|
|
|
import com.mokamrp.privates.service.CorpService;
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobileService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
@@ -53,6 +56,9 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
@Autowired
|
|
|
public CorpService corpService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ public FosterwxMobilePoolService fosterwxMobilePoolService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取数据列表 支持分页
|
|
|
* @param handle
|
|
|
@@ -97,7 +103,7 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public VoltaHandle<Boolean> importData(List<Map<String, String>> row, User authUser) throws Exception{
|
|
|
+ public VoltaHandle<Boolean> importData(List<Map<String, String>> row, User authUser) throws Exception {
|
|
|
VoltaHandle<Boolean> res = new VoltaHandle<>();
|
|
|
if (row.size() <= 0) {
|
|
|
throw new Exception("表格读取完成后,没有获取到任何数据");
|
|
|
@@ -109,38 +115,45 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
FosterwxMobile fosterwxMobile = new FosterwxMobile();
|
|
|
FosterwxStation stationInfo = fosterwxStationService.getOne(new QueryWrapper<FosterwxStation>()
|
|
|
.eq("station_name", row.get(i).get("stationName")));
|
|
|
- if (stationInfo == null){
|
|
|
+ if (stationInfo == null) {
|
|
|
throw new Exception("站点编号不存在");
|
|
|
}
|
|
|
String mobileCode = String.format("%03d", Integer.parseInt(row.get(i).get("mobileCode")));
|
|
|
FosterwxMobile mobileInfo = fosterwxMobileService.getOne(new QueryWrapper<FosterwxMobile>()
|
|
|
- .eq("station_id",stationInfo.getId())
|
|
|
- .eq("mobile_code",mobileCode)
|
|
|
+ .eq("station_id", stationInfo.getId())
|
|
|
+ .eq("mobile_code", mobileCode)
|
|
|
);
|
|
|
- if (mobileInfo != null){
|
|
|
- throw new Exception("第"+(i+1)+"行,手机编号:"+mobileCode+",已存在相同记录");
|
|
|
+ if (mobileInfo != null) {
|
|
|
+ throw new Exception("第" + (i + 1) + "行,手机编号:" + mobileCode + ",已存在相同记录");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取企微主题相关信息
|
|
|
+ Corp corp = corpService.getOne(new LambdaQueryWrapper<Corp>().eq(Corp::getName, cell.get("workWxCorp")).last("limit 1"));
|
|
|
+ if (null == corp) {
|
|
|
+ throw new Exception("第" + (i + 1) + "行," + "无法根据企业微信主体名称找到相关信息");
|
|
|
}
|
|
|
+
|
|
|
fosterwxMobile.setStationId(stationInfo.getId());
|
|
|
fosterwxMobile.setMobileCode(mobileCode);
|
|
|
fosterwxMobile.setMobileNo(row.get(i).get("mobileNo"));
|
|
|
fosterwxMobile.setMobileOperator(Integer.parseInt(row.get(i).get("mobileOperator")));
|
|
|
- fosterwxMobile.setMobileCreateAt(LocalDateTime.parse(row.get(i).get("mobileCreateAt")+" 08:00:00", df));
|
|
|
+ fosterwxMobile.setMobileCreateAt(LocalDateTime.parse(row.get(i).get("mobileCreateAt") + " 08:00:00", df));
|
|
|
fosterwxMobile.setMobileAdvancePayAmt(Integer.parseInt(row.get(i).get("mobileAdvancePayAmt")));
|
|
|
fosterwxMobile.setMobileCombo(row.get(i).get("mobileCombo"));
|
|
|
fosterwxMobile.setMobileComboFlow(row.get(i).get("mobileComboFlow"));
|
|
|
fosterwxMobile.setMobileRealName(row.get(i).get("mobileRealName"));
|
|
|
fosterwxMobile.setMobileIdentityCardNo(row.get(i).get("mobileIdentityCardNo"));
|
|
|
fosterwxMobile.setWxPassword(row.get(i).get("wxPassword"));
|
|
|
- fosterwxMobile.setWxRegisterAt(LocalDateTime.parse(row.get(i).get("wxRegisterAt")+" 08:00:00", df));
|
|
|
+ fosterwxMobile.setWxRegisterAt(LocalDateTime.parse(row.get(i).get("wxRegisterAt") + " 08:00:00", df));
|
|
|
fosterwxMobile.setWxRealName(row.get(i).get("wxRealName"));
|
|
|
fosterwxMobile.setWxIdentityCardNo(row.get(i).get("wxIdentityCardNo"));
|
|
|
fosterwxMobile.setBankCardNo(row.get(i).get("bankCardNo"));
|
|
|
fosterwxMobile.setBankCardMobileNo(row.get(i).get("bankCardMobileNo"));
|
|
|
if (row.get(i).get("workWxCorp") != null && !row.get(i).get("workWxCorp").isEmpty()) {
|
|
|
- fosterwxMobile.setWorkWxCorp(row.get(i).get("workWxCorp"));
|
|
|
+ fosterwxMobile.setWorkWxCorpId(corp.getId());
|
|
|
}
|
|
|
if (row.get(i).get("workWxRegisterAt") != null && !row.get(i).get("workWxRegisterAt").isEmpty()) {
|
|
|
- fosterwxMobile.setWorkWxRegisterAt(LocalDateTime.parse(row.get(i).get("workWxRegisterAt")+" 08:00:00", df));
|
|
|
+ fosterwxMobile.setWorkWxRegisterAt(LocalDateTime.parse(row.get(i).get("workWxRegisterAt") + " 08:00:00", df));
|
|
|
}
|
|
|
fosterwxMobile.setCreateAt(nowDate);
|
|
|
fosterwxMobile.setUpdateAt(nowDate);
|
|
|
@@ -171,6 +184,13 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
fosterwxMobileWxfriendService.remove(new QueryWrapper<FosterwxMobileWxfriend>().eq("mobile_id", fosterwxMobile.getId()));
|
|
|
fosterwxMobileWxfriendService.saveBatch(addFriend);
|
|
|
}
|
|
|
+
|
|
|
+ // 更新个微池
|
|
|
+ if (row.get(i).get("workWxCorp") != null && !row.get(i).get("workWxCorp").isEmpty()) {
|
|
|
+ fosterwxMobilePoolService.update(new FosterwxMobilePool() {{
|
|
|
+ setWxAppid(corp.getWxCorpid());
|
|
|
+ }}, new LambdaQueryWrapper<FosterwxMobilePool>().eq(FosterwxMobilePool::getPoolIndex, fosterwxMobile.getMobileUnioCode()));
|
|
|
+ }
|
|
|
}
|
|
|
// this.saveBatch(add);
|
|
|
return res;
|