|
|
@@ -0,0 +1,41 @@
|
|
|
+package com.mokamrp;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.mokamrp.privates.PrivateServerStart;
|
|
|
+import com.mokamrp.privates.mapper.pojo.Corp;
|
|
|
+import com.mokamrp.privates.service.CorpService;
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxMobileService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@SpringBootTest(classes = PrivateServerStart.class)
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+public class WebTest {
|
|
|
+ @Autowired
|
|
|
+ private FosterwxMobileService fosterwxMobileService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CorpService corpService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void test1() {
|
|
|
+ // 清洗数据
|
|
|
+ fosterwxMobileService.list().forEach(fosterwxMobile -> {
|
|
|
+ if (corpService.count(new LambdaQueryWrapper<Corp>().eq(Corp::getName, fosterwxMobile.getWorkWxCorp())) > 1) {
|
|
|
+ log.warn("{}名字有两个主体", fosterwxMobile.getWorkWxCorp());
|
|
|
+ }
|
|
|
+ Corp corp = corpService.getOne(new LambdaQueryWrapper<Corp>().eq(Corp::getName, fosterwxMobile.getWorkWxCorp()).last("Limit 1"));
|
|
|
+ if (null != corp) {
|
|
|
+ fosterwxMobile.setWorkWxCorpId(corp.getId());
|
|
|
+ fosterwxMobile.setWxAppid(corp.getWxCorpid());
|
|
|
+ fosterwxMobileService.updateById(fosterwxMobile);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|