|
|
@@ -1,29 +1,29 @@
|
|
|
package com.mokamrp.privates.service.pangu.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.api.R;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.entity.ResHandle;
|
|
|
import com.mokamrp.privates.entity.pangu.GetForsterwxMobileHandle;
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
|
|
|
import com.mokamrp.privates.mapper.pangu.FosterwxMobileMapper;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStationBindBox;
|
|
|
+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.FosterwxMobileService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
-import org.apache.tomcat.jni.Local;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -44,6 +44,10 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
|
|
|
@Autowired
|
|
|
public FosterwxStationService fosterwxStationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public CorpService corpService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取数据列表 支持分页
|
|
|
* @param handle
|
|
|
@@ -53,7 +57,14 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
Integer pagesize = handle.getPagesize();
|
|
|
Integer page = handle.getPage();
|
|
|
Page<FosterwxMobile> pageObj = new Page<FosterwxMobile>(page, pagesize);
|
|
|
- List<FosterwxMobile> list = fosterwxMobileMapper.getList(pageObj,handle);
|
|
|
+ List<FosterwxMobile> list = fosterwxMobileMapper.getList(pageObj, handle);
|
|
|
+ list.forEach(fosterwxMobile -> {
|
|
|
+ Corp corp = corpService.getById(fosterwxMobile.getWorkWxCorpId());
|
|
|
+ if (null != corp) {
|
|
|
+ fosterwxMobile.setWorkWxCorp(corp.getName());
|
|
|
+ fosterwxMobile.setWxAppid(corp.getWxCorpid());
|
|
|
+ }
|
|
|
+ });
|
|
|
ResHandle<List<FosterwxMobile>> resHandle = new ResHandle<>();
|
|
|
resHandle.setList(list);
|
|
|
resHandle.setTotal(pageObj.getTotal());
|
|
|
@@ -68,7 +79,7 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
*/
|
|
|
public Map<String, Object> getListByStationId(GetForsterwxMobileHandle getForsterwxMobileHandle, Integer stationId) {
|
|
|
Page<FosterwxMobile> pageObj = new Page<FosterwxMobile>(getForsterwxMobileHandle.getPage(), getForsterwxMobileHandle.getPagesize());
|
|
|
- List<FosterwxMobile> list = fosterwxMobileMapper.getListByStationId(pageObj,getForsterwxMobileHandle,stationId);
|
|
|
+ List<FosterwxMobile> list = fosterwxMobileMapper.getListByStationId(pageObj, getForsterwxMobileHandle, stationId);
|
|
|
Map<String, Object> resMap = new HashMap<String, Object>();
|
|
|
resMap.put("list", list);
|
|
|
resMap.put("total", pageObj.getTotal());
|
|
|
@@ -80,50 +91,50 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
* @param row
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean importData(List<Map<String,String>> row, User authUser){
|
|
|
- if(row.size() <= 0){
|
|
|
+ public Boolean importData(List<Map<String, String>> row, User authUser) {
|
|
|
+ if (row.size() <= 0) {
|
|
|
return false;
|
|
|
}
|
|
|
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();
|
|
|
Map<String, String> cell = row.get(i);
|
|
|
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"))));
|
|
|
+ fosterwxMobile.setMobileCode(String.format("%03d", Integer.parseInt(row.get(i).get("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"),df));
|
|
|
+ fosterwxMobile.setMobileCreateAt(LocalDateTime.parse(row.get(i).get("mobileCreateAt"), 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"),df));
|
|
|
+ fosterwxMobile.setWxRegisterAt(LocalDateTime.parse(row.get(i).get("wxRegisterAt"), 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()){
|
|
|
+ if (row.get(i).get("workWxCorp") != null && !row.get(i).get("workWxCorp").isEmpty()) {
|
|
|
fosterwxMobile.setWorkWxCorp(row.get(i).get("workWxCorp"));
|
|
|
}
|
|
|
- if (row.get(i).get("workWxRegisterAt") != null && !row.get(i).get("workWxRegisterAt").isEmpty()){
|
|
|
- fosterwxMobile.setWorkWxRegisterAt(LocalDateTime.parse(row.get(i).get("workWxRegisterAt"),df));
|
|
|
+ if (row.get(i).get("workWxRegisterAt") != null && !row.get(i).get("workWxRegisterAt").isEmpty()) {
|
|
|
+ fosterwxMobile.setWorkWxRegisterAt(LocalDateTime.parse(row.get(i).get("workWxRegisterAt"), df));
|
|
|
}
|
|
|
fosterwxMobile.setCreateAt(nowDate);
|
|
|
fosterwxMobile.setUpdateAt(nowDate);
|
|
|
FosterwxStation stationInfo = fosterwxStationService.getOne(new QueryWrapper<FosterwxStation>()
|
|
|
- .eq("id",fosterwxMobile.getStationId()));
|
|
|
- fosterwxMobile.setMobileUnioCode(stationInfo.getStationName() + fosterwxMobile.getMobileCode());
|
|
|
+ .eq("id", fosterwxMobile.getStationId()));
|
|
|
+ fosterwxMobile.setMobileUnioCode(stationInfo.getStationName() + fosterwxMobile.getMobileCode());
|
|
|
this.save(fosterwxMobile);
|
|
|
//.批量录入微信好友
|
|
|
List<FosterwxMobileWxfriend> addFriend = new ArrayList<>();
|
|
|
- for (Integer s = 1;s<=3;s++) {
|
|
|
+ for (Integer s = 1; s <= 3; s++) {
|
|
|
String sStr = s.toString();
|
|
|
- String wxFriendName = row.get(i).get("wxFriendName"+sStr);
|
|
|
- String wxFriendUserName = row.get(i).get("wxFriendUserName"+sStr);
|
|
|
- if (wxFriendName == null || wxFriendName.isEmpty()){
|
|
|
+ String wxFriendName = row.get(i).get("wxFriendName" + sStr);
|
|
|
+ String wxFriendUserName = row.get(i).get("wxFriendUserName" + sStr);
|
|
|
+ if (wxFriendName == null || wxFriendName.isEmpty()) {
|
|
|
continue;
|
|
|
}
|
|
|
FosterwxMobileWxfriend fosterwxMobileWxfriend = new FosterwxMobileWxfriend();
|
|
|
@@ -132,13 +143,13 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
|
|
|
fosterwxMobileWxfriend.setUpdateAt(nowDate);
|
|
|
fosterwxMobileWxfriend.setSeq(s);
|
|
|
fosterwxMobileWxfriend.setWxName(wxFriendName);
|
|
|
- if (wxFriendUserName != null && !wxFriendUserName.isEmpty()){
|
|
|
+ if (wxFriendUserName != null && !wxFriendUserName.isEmpty()) {
|
|
|
fosterwxMobileWxfriend.setWxUsername(wxFriendUserName);
|
|
|
}
|
|
|
addFriend.add(fosterwxMobileWxfriend);
|
|
|
}
|
|
|
- if (addFriend.size() > 0){
|
|
|
- fosterwxMobileWxfriendService.remove(new QueryWrapper<FosterwxMobileWxfriend>().eq("mobile_id",fosterwxMobile.getId()));
|
|
|
+ if (addFriend.size() > 0) {
|
|
|
+ fosterwxMobileWxfriendService.remove(new QueryWrapper<FosterwxMobileWxfriend>().eq("mobile_id", fosterwxMobile.getId()));
|
|
|
fosterwxMobileWxfriendService.saveBatch(addFriend);
|
|
|
}
|
|
|
}
|