|
|
|
@ -1,12 +1,33 @@
|
|
|
|
|
package test;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.kiisoo.ic.app.IcApplication;
|
|
|
|
|
import com.kiisoo.ic.common.utils.RedisUtil;
|
|
|
|
|
import com.kiisoo.ic.employee.entity.PrivilageCpUserDO;
|
|
|
|
|
import com.kiisoo.ic.employee.mapper.PrivilageCpUserDOMapper;
|
|
|
|
|
import com.kiisoo.ic.store.constant.Constants;
|
|
|
|
|
import com.kiisoo.ic.store.entity.PoiStore;
|
|
|
|
|
import com.kiisoo.ic.store.entity.PoiStoreStaff;
|
|
|
|
|
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
|
|
|
|
|
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
|
|
|
|
|
import com.kiisoo.ic.store.service.StoreEmployeeService;
|
|
|
|
|
import com.kiisoo.ic.wx.service.AddWXService;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import static com.kiisoo.ic.store.constant.Constants.BSD_REQ_QRCODE_TYPE_STORE;
|
|
|
|
|
|
|
|
|
|
@RunWith(SpringRunner.class)
|
|
|
|
|
@SpringBootTest(classes = IcApplication.class)
|
|
|
|
|
public class Test {
|
|
|
|
@ -14,8 +35,130 @@ public class Test {
|
|
|
|
|
@Autowired
|
|
|
|
|
AddWXService addWXService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PrivilageCpUserDOMapper privilageCpUserDOMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PoiStoreDOMapper poiStoreDOMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PoiStoreStaffDOMapper poiStoreStaffDOMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 门店号管理service
|
|
|
|
|
*/
|
|
|
|
|
@Autowired
|
|
|
|
|
private StoreEmployeeService storeEmployeeService;
|
|
|
|
|
|
|
|
|
|
@org.junit.Test
|
|
|
|
|
public void te(){
|
|
|
|
|
addWXService.addWX("a","b");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@org.junit.Test
|
|
|
|
|
public void test2() throws IOException {
|
|
|
|
|
List<String> list2 = FileUtils.readLines(new File("data/1.txt"));
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < list2.size(); i++) {
|
|
|
|
|
String item = list2.get(i);
|
|
|
|
|
String[] arr = item.split(",");
|
|
|
|
|
|
|
|
|
|
String name = arr[0];
|
|
|
|
|
|
|
|
|
|
String staffCode = arr[2];
|
|
|
|
|
|
|
|
|
|
if(name.length() < 3){
|
|
|
|
|
System.out.println("不修改" + item);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("staff_code", staffCode);
|
|
|
|
|
map.put("status", "1");
|
|
|
|
|
List<PoiStoreStaff> staffList = poiStoreStaffDOMapper.selectByMap(map);
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(staffList)){
|
|
|
|
|
System.out.println("staff_code 空 | " + item);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(staffList.size() > 1){
|
|
|
|
|
System.out.println("多个人员编码" + item);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PoiStoreStaff poiStoreStaff = staffList.get(0);
|
|
|
|
|
|
|
|
|
|
PoiStore storeDO = new PoiStore();
|
|
|
|
|
storeDO.setId(poiStoreStaff.getStoreId());
|
|
|
|
|
PoiStore storeEntity = new PoiStore();
|
|
|
|
|
|
|
|
|
|
storeEntity = poiStoreDOMapper.selectOne(new QueryWrapper<>(storeDO));
|
|
|
|
|
|
|
|
|
|
storeEntity.setAbbreviation(name);
|
|
|
|
|
poiStoreDOMapper.updateById(storeEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@org.junit.Test
|
|
|
|
|
public void test3() throws IOException {
|
|
|
|
|
List<String> list2 = FileUtils.readLines(new File("data/2.txt"));
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < list2.size(); i++) {
|
|
|
|
|
String item = list2.get(i);
|
|
|
|
|
String[] arr = item.split(",");
|
|
|
|
|
|
|
|
|
|
Long storeId = Long.parseLong(arr[0]);
|
|
|
|
|
|
|
|
|
|
String abName = arr[3];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PoiStore storeDO = new PoiStore();
|
|
|
|
|
storeDO.setId(storeId);
|
|
|
|
|
PoiStore storeEntity = new PoiStore();
|
|
|
|
|
|
|
|
|
|
storeEntity = poiStoreDOMapper.selectOne(new QueryWrapper<>(storeDO));
|
|
|
|
|
if(null == storeEntity){
|
|
|
|
|
System.out.println(item);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
storeEntity.setAbbreviation(abName);
|
|
|
|
|
poiStoreDOMapper.updateById(storeEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@org.junit.Test
|
|
|
|
|
public void test5() throws Exception {
|
|
|
|
|
|
|
|
|
|
// 创建二维码
|
|
|
|
|
String qrCode = storeEmployeeService.getQrCodeFromBSD("mayifei", Constants.BSD_REQ_QRCODE_TYPE_ACTIVITY, "pmn_1_1_1", "A0645");
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(qrCode)){
|
|
|
|
|
System.out.println("error");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@org.junit.Test
|
|
|
|
|
public void test6() throws Exception {
|
|
|
|
|
|
|
|
|
|
// 门店号
|
|
|
|
|
boolean b = storeEmployeeService.cancelQrCodeFromBSD("18152147506", "0");
|
|
|
|
|
|
|
|
|
|
if(!b){
|
|
|
|
|
System.out.println("error");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
|
@org.junit.Test
|
|
|
|
|
public void test7(){
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// redisUtil.hget();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|