|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.entity.ResHandle;
|
|
import com.mokamrp.privates.entity.ResHandle;
|
|
|
|
|
+import com.mokamrp.privates.entity.VoltaHandle;
|
|
|
import com.mokamrp.privates.entity.pangu.GetForsterwxMobileHandle;
|
|
import com.mokamrp.privates.entity.pangu.GetForsterwxMobileHandle;
|
|
|
import com.mokamrp.privates.mapper.pangu.FosterwxMobileMapper;
|
|
import com.mokamrp.privates.mapper.pangu.FosterwxMobileMapper;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
|
|
@@ -17,6 +18,7 @@ import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -46,6 +48,9 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
public FosterwxStationService fosterwxStationService;
|
|
public FosterwxStationService fosterwxStationService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ public FosterwxMobileService fosterwxMobileService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
public CorpService corpService;
|
|
public CorpService corpService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -91,27 +96,42 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
* @param row
|
|
* @param row
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public Boolean importData(List<Map<String, String>> row, User authUser) {
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public VoltaHandle<Boolean> importData(List<Map<String, String>> row, User authUser) throws Exception{
|
|
|
|
|
+ VoltaHandle<Boolean> res = new VoltaHandle<>();
|
|
|
if (row.size() <= 0) {
|
|
if (row.size() <= 0) {
|
|
|
- return false;
|
|
|
|
|
|
|
+ throw new Exception("表格读取完成后,没有获取到任何数据");
|
|
|
}
|
|
}
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
for (int i = 0; i < row.size(); i++) {
|
|
for (int i = 0; i < row.size(); i++) {
|
|
|
LocalDateTime nowDate = LocalDateTime.now();
|
|
LocalDateTime nowDate = LocalDateTime.now();
|
|
|
Map<String, String> cell = row.get(i);
|
|
Map<String, String> cell = row.get(i);
|
|
|
FosterwxMobile fosterwxMobile = new FosterwxMobile();
|
|
FosterwxMobile fosterwxMobile = new FosterwxMobile();
|
|
|
- fosterwxMobile.setStationId(Integer.parseInt(row.get(i).get("stationId")));
|
|
|
|
|
- fosterwxMobile.setMobileCode(String.format("%03d", Integer.parseInt(row.get(i).get("mobileCode"))));
|
|
|
|
|
|
|
+ FosterwxStation stationInfo = fosterwxStationService.getOne(new QueryWrapper<FosterwxStation>()
|
|
|
|
|
+ .eq("station_name", row.get(i).get("stationName")));
|
|
|
|
|
+ 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)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (mobileInfo != null){
|
|
|
|
|
+ throw new Exception("第"+(i+1)+"行,手机编号:"+mobileCode+",已存在相同记录");
|
|
|
|
|
+ }
|
|
|
|
|
+ fosterwxMobile.setStationId(stationInfo.getId());
|
|
|
|
|
+ fosterwxMobile.setMobileCode(mobileCode);
|
|
|
fosterwxMobile.setMobileNo(row.get(i).get("mobileNo"));
|
|
fosterwxMobile.setMobileNo(row.get(i).get("mobileNo"));
|
|
|
fosterwxMobile.setMobileOperator(Integer.parseInt(row.get(i).get("mobileOperator")));
|
|
fosterwxMobile.setMobileOperator(Integer.parseInt(row.get(i).get("mobileOperator")));
|
|
|
- fosterwxMobile.setMobileCreateAt(LocalDateTime.parse(row.get(i).get("mobileCreateAt"), df));
|
|
|
|
|
|
|
+ fosterwxMobile.setMobileCreateAt(LocalDateTime.parse(row.get(i).get("mobileCreateAt")+" 08:00:00", df));
|
|
|
fosterwxMobile.setMobileAdvancePayAmt(Integer.parseInt(row.get(i).get("mobileAdvancePayAmt")));
|
|
fosterwxMobile.setMobileAdvancePayAmt(Integer.parseInt(row.get(i).get("mobileAdvancePayAmt")));
|
|
|
fosterwxMobile.setMobileCombo(row.get(i).get("mobileCombo"));
|
|
fosterwxMobile.setMobileCombo(row.get(i).get("mobileCombo"));
|
|
|
fosterwxMobile.setMobileComboFlow(row.get(i).get("mobileComboFlow"));
|
|
fosterwxMobile.setMobileComboFlow(row.get(i).get("mobileComboFlow"));
|
|
|
fosterwxMobile.setMobileRealName(row.get(i).get("mobileRealName"));
|
|
fosterwxMobile.setMobileRealName(row.get(i).get("mobileRealName"));
|
|
|
fosterwxMobile.setMobileIdentityCardNo(row.get(i).get("mobileIdentityCardNo"));
|
|
fosterwxMobile.setMobileIdentityCardNo(row.get(i).get("mobileIdentityCardNo"));
|
|
|
fosterwxMobile.setWxPassword(row.get(i).get("wxPassword"));
|
|
fosterwxMobile.setWxPassword(row.get(i).get("wxPassword"));
|
|
|
- fosterwxMobile.setWxRegisterAt(LocalDateTime.parse(row.get(i).get("wxRegisterAt"), df));
|
|
|
|
|
|
|
+ fosterwxMobile.setWxRegisterAt(LocalDateTime.parse(row.get(i).get("wxRegisterAt")+" 08:00:00", df));
|
|
|
fosterwxMobile.setWxRealName(row.get(i).get("wxRealName"));
|
|
fosterwxMobile.setWxRealName(row.get(i).get("wxRealName"));
|
|
|
fosterwxMobile.setWxIdentityCardNo(row.get(i).get("wxIdentityCardNo"));
|
|
fosterwxMobile.setWxIdentityCardNo(row.get(i).get("wxIdentityCardNo"));
|
|
|
fosterwxMobile.setBankCardNo(row.get(i).get("bankCardNo"));
|
|
fosterwxMobile.setBankCardNo(row.get(i).get("bankCardNo"));
|
|
@@ -120,12 +140,11 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
fosterwxMobile.setWorkWxCorp(row.get(i).get("workWxCorp"));
|
|
fosterwxMobile.setWorkWxCorp(row.get(i).get("workWxCorp"));
|
|
|
}
|
|
}
|
|
|
if (row.get(i).get("workWxRegisterAt") != null && !row.get(i).get("workWxRegisterAt").isEmpty()) {
|
|
if (row.get(i).get("workWxRegisterAt") != null && !row.get(i).get("workWxRegisterAt").isEmpty()) {
|
|
|
- fosterwxMobile.setWorkWxRegisterAt(LocalDateTime.parse(row.get(i).get("workWxRegisterAt"), df));
|
|
|
|
|
|
|
+ fosterwxMobile.setWorkWxRegisterAt(LocalDateTime.parse(row.get(i).get("workWxRegisterAt")+" 08:00:00", df));
|
|
|
}
|
|
}
|
|
|
fosterwxMobile.setCreateAt(nowDate);
|
|
fosterwxMobile.setCreateAt(nowDate);
|
|
|
fosterwxMobile.setUpdateAt(nowDate);
|
|
fosterwxMobile.setUpdateAt(nowDate);
|
|
|
- FosterwxStation stationInfo = fosterwxStationService.getOne(new QueryWrapper<FosterwxStation>()
|
|
|
|
|
- .eq("id", fosterwxMobile.getStationId()));
|
|
|
|
|
|
|
+
|
|
|
fosterwxMobile.setMobileUnioCode(stationInfo.getStationName() + fosterwxMobile.getMobileCode());
|
|
fosterwxMobile.setMobileUnioCode(stationInfo.getStationName() + fosterwxMobile.getMobileCode());
|
|
|
this.save(fosterwxMobile);
|
|
this.save(fosterwxMobile);
|
|
|
//.批量录入微信好友
|
|
//.批量录入微信好友
|
|
@@ -154,7 +173,7 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// this.saveBatch(add);
|
|
// this.saveBatch(add);
|
|
|
- return true;
|
|
|
|
|
|
|
+ return res;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|