leon 4 lat temu
rodzic
commit
6db4a93335

+ 31 - 1
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashOasBoxController.java

@@ -191,12 +191,42 @@ public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOas
         }
         row = voltaRes.getData();
         try {
-            VoltaHandle<Boolean> res = fosterwxCashOasBoxService.importData(row, authUser);
+            VoltaHandle<Boolean> res = fosterwxCashOasBoxService.importData(row, authUser,1);
         } catch (Exception e) {
             return AjaxResult.error(e.getMessage());
         }
         return AjaxResult.success(HttpMsg.importSuccess);
     }
 
+    @PostMapping("/importWorkwx")
+    public Object uploadFileWorkwx(@RequestBody MultipartFile file, @AuthUser User authUser) {
+        Map<String, Object> map = new HashMap<>(16);
+        Map<Integer, String> feild = new HashMap<>();
+        feild.put(0, "stationName");
+        feild.put(1, "groupId");
+        feild.put(2, "mobileGroupId");
+        feild.put(3, "type");
+        feild.put(4, "boxType|default");
+        feild.put(5, "boxLocation|default");
+        feild.put(6, "ghId");
+        feild.put(7, "name");
+        feild.put(8, "scope");
+        feild.put(9, "remark|default");
+        List<Map<String, String>> row = new ArrayList<>();
+        VoltaHandle<ArrayList<Map<String, String>>> voltaRes = Analysis.analysis(file, feild);
+        if (voltaRes.getErr() != null) {
+            return AjaxResult.error(voltaRes.getErr());
+        }
+        row = voltaRes.getData();
+        try {
+            VoltaHandle<Boolean> res = fosterwxCashOasBoxService.importData(row, authUser,2);
+        } catch (Exception e) {
+            return AjaxResult.error(e.getMessage());
+        }
+        return AjaxResult.success(HttpMsg.importSuccess);
+    }
+
+
+
 }
 

+ 15 - 0
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileController.java

@@ -335,6 +335,21 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         return AjaxResult.success();
     }
 
+    /**
+     * 批量加入变现账号
+     * @param handle
+     * @param bindingResult
+     * @return
+     */
+    @PostMapping("/addCashWorkwxMobileList")
+    public Object addCashWorkwxMobileList(@Valid @RequestBody SetIdsHandle handle, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
+        }
+        fosterwxMobileService.addCashWorkwxMobileList(handle);
+        return AjaxResult.success();
+    }
+
     /*
      *@Leon 以下接口为站点负责人后台页面接口,需要独立登陆才可访问
      */

+ 35 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxCashWorkwxMobile.java

@@ -1,5 +1,6 @@
 package com.mokamrp.privates.mapper.pangu.pojo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
@@ -49,6 +50,40 @@ public class FosterwxCashWorkwxMobile extends Model<FosterwxCashWorkwxMobile> {
      */
     private Integer domainId;
 
+    @TableField(exist = false)
+    private String domain;
+
+    @TableField(exist = false)
+    private String stationName;
+
+    @TableField(exist = false)
+    private String mobileCode;
+
+    @TableField(exist = false)
+    private String mobileUnioCode;
+
+    /**
+     * 客服名称
+     */
+    @TableField(exist = false)
+    private String custserviceName;
+    /**
+     * 团队ID
+     */
+    @TableField(exist = false)
+    private String teamId;
+
+    @TableField(exist = false)
+    private String mobileNo;
+
+    @TableField(exist = false)
+    private String workWxCorpName;
+    /**
+     * 微信登录状态
+     */
+    @TableField(exist = false)
+    private Integer workWxLoginStatus;
+
     /**
      * 创建时间
      */

+ 1 - 1
src/main/java/com/mokamrp/privates/service/pangu/FosterwxCashOasBoxService.java

@@ -27,5 +27,5 @@ public interface FosterwxCashOasBoxService extends IService<FosterwxCashOasBox>
     //.@leon 获取一个正常状态的公众号
     public FosterwxCashOasBox getRandOas(Integer groupId,Integer wxType);
 
-    public VoltaHandle<Boolean> importData(List<Map<String, String>> row, User authUser) throws Exception;
+    public VoltaHandle<Boolean> importData(List<Map<String, String>> row, User authUser,Integer wxType) throws Exception;
 }

+ 2 - 0
src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileService.java

@@ -31,5 +31,7 @@ public interface FosterwxMobileService extends IService<FosterwxMobile> {
 //    public List<FosterwxMobileVo> setWxFriend(List<FosterwxMobileVo> list);
     //.@leon 批量加入变现账号
     public Boolean addCashMobileList(SetIdsHandle setIdsHandle);
+    //.@leon 批量加入变现企微账号
+    public Boolean addCashWorkwxMobileList(SetIdsHandle setIdsHandle);
 
 }

+ 18 - 4
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxCashOasBoxServiceImpl.java

@@ -46,6 +46,9 @@ public class FosterwxCashOasBoxServiceImpl extends ServiceImpl<FosterwxCashOasBo
     public FosterwxCashMobileGroupService fosterwxCashMobileGroupService;
 
     @Autowired
+    public FosterwxCashWorkwxMobileGroupService fosterwxCashWorkwxMobileGroupService;
+
+    @Autowired
     public FosterwxCashOasBoxMobileGroupService fosterwxCashOasBoxMobileGroupService;
 
     @Autowired
@@ -143,7 +146,7 @@ public class FosterwxCashOasBoxServiceImpl extends ServiceImpl<FosterwxCashOasBo
      * @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,Integer wxType) throws Exception {
         VoltaHandle<Boolean> res = new VoltaHandle<>();
         if (row.size() <= 0) {
             throw new Exception("表格读取完成后,没有获取到任何数据");
@@ -158,10 +161,20 @@ public class FosterwxCashOasBoxServiceImpl extends ServiceImpl<FosterwxCashOasBo
             if (stationInfo == null) {
                 throw new Exception("站点编号不存在");
             }
-            FosterwxCashMobileGroup fosterwxCashMobileGroup = fosterwxCashMobileGroupService.getOne(new QueryWrapper<FosterwxCashMobileGroup>().eq("id",Integer.parseInt(row.get(i).get("mobileGroupId"))));
-            if (fosterwxCashMobileGroup == null){
-                throw new Exception("第"+i+"行:账号分组ID不存在");
+            if (wxType == 1){
+                //.个微
+                FosterwxCashMobileGroup fosterwxCashMobileGroup = fosterwxCashMobileGroupService.getOne(new QueryWrapper<FosterwxCashMobileGroup>().eq("id",Integer.parseInt(row.get(i).get("mobileGroupId"))));
+                if (fosterwxCashMobileGroup == null){
+                    throw new Exception("第"+i+"行:账号分组ID不存在");
+                }
+            }else{
+                //.企微
+                FosterwxCashWorkwxMobileGroup fosterwxCashWorkwxMobileGroup = fosterwxCashWorkwxMobileGroupService.getOne(new QueryWrapper<FosterwxCashWorkwxMobileGroup>().eq("id",Integer.parseInt(row.get(i).get("mobileGroupId"))));
+                if (fosterwxCashWorkwxMobileGroup == null){
+                    throw new Exception("第"+i+"行:账号分组ID不存在");
+                }
             }
+            fosterwxCashOasBox.setWxType(wxType);
             fosterwxCashOasBox.setStationId(stationInfo.getId());
             fosterwxCashOasBox.setGroupId(Integer.parseInt(row.get(i).get("groupId")));
             fosterwxCashOasBox.setType(Integer.parseInt(row.get(i).get("type")));
@@ -177,6 +190,7 @@ public class FosterwxCashOasBoxServiceImpl extends ServiceImpl<FosterwxCashOasBo
             this.save(fosterwxCashOasBox);
 
             FosterwxCashOasBoxMobileGroup fosterwxCashOasBoxMobileGroup = fosterwxCashOasBoxMobileGroupService.getOne(new QueryWrapper<FosterwxCashOasBoxMobileGroup>()
+                    .eq("wx_type",wxType)
                     .eq("oas_box_id",fosterwxCashOasBox.getId())
             .eq("cash_mobile_group_id",Integer.parseInt(row.get(i).get("mobileGroupId"))));
             if (fosterwxCashOasBoxMobileGroup != null){

+ 39 - 0
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileServiceImpl.java

@@ -62,6 +62,9 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
     public FosterwxCashMobileService fosterwxCashMobileService;
 
     @Autowired
+    public FosterwxCashWorkwxMobileService fosterwxCashWorkwxMobileService;
+
+    @Autowired
     public FosterwxMobileTaskTimeListService fosterwxMobileTaskTimeListService;
 
     /**
@@ -290,6 +293,42 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
         return true;
     }
 
+    /**
+     * 批量加入变现账号
+     * @param setIdsHandle
+     * @return
+     */
+    public Boolean addCashWorkwxMobileList(SetIdsHandle setIdsHandle) {
+        LocalDateTime now = LocalDateTime.now();
+        for (Integer id : setIdsHandle.getIds()) {
+            FosterwxMobile fosterwxMobile = this.getOne(new QueryWrapper<FosterwxMobile>().eq("id", id));
+            FosterwxCashWorkwxMobile fosterwxCashMobile = fosterwxCashWorkwxMobileService.getOne(new QueryWrapper<FosterwxCashWorkwxMobile>().eq("mobile_id",id));
+            if (fosterwxCashMobile != null){
+                continue;
+            }
+            List<FosterwxDomain> domainList = fosterwxDomainService.list(new QueryWrapper<FosterwxDomain>().eq("station_id",fosterwxMobile.getStationId()));
+            FosterwxCashWorkwxMobile add = new FosterwxCashWorkwxMobile();
+            //.站点域名不存在则不插入域名信息
+            if (domainList.size() > 0){
+                Integer rand;
+                if (domainList.size() == 1){
+                    rand = 0;
+                }else{
+                    rand = (int)(0+Math.random()*((domainList.size()-1)-0+1));
+                }
+                add.setDomainId(rand);
+            }
+
+            add.setGroupId(setIdsHandle.getId());
+            add.setMobileId(fosterwxMobile.getId());
+            add.setStationId(fosterwxMobile.getStationId());
+            add.setCreateAt(now);
+            add.setUpdateAt(now);
+            fosterwxCashWorkwxMobileService.save(add);
+        }
+        return true;
+    }
+
     private Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row, Integer friendId) {
         Integer findCnt = 0;
         for (FosterwxMobileWxfriend fosterwxMobileWxfriend : row) {