|
@@ -6,6 +6,7 @@ import com.huimv.manager.enums.AuthExceptionEnum;
|
|
|
import com.huimv.manager.exception.AuthException;
|
|
|
import com.huimv.manager.exception.RRException;
|
|
|
import com.huimv.manager.modular.entity.MobileUser;
|
|
|
+import com.huimv.manager.modular.repository.MobileUnitRepository;
|
|
|
import com.huimv.manager.modular.repository.MobileUserRepository;
|
|
|
import com.huimv.manager.modular.service.MobileUserService;
|
|
|
import com.huimv.manager.result.R;
|
|
@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.DigestUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -66,6 +68,12 @@ public class MobileUserServiceImpl implements MobileUserService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
+ MobileUnitRepository mobileUnitRepository;
|
|
|
+
|
|
|
+ String ycgApi = mobileUnitRepository.findByShortNameLike("油车港").get(0).getApi();
|
|
|
+ String wyApi = mobileUnitRepository.findByShortNameLike("武义").get(0).getApi();
|
|
|
+ String wjjApi = mobileUnitRepository.findByShortNameLike("王江泾").get(0).getApi();
|
|
|
|
|
|
@Override
|
|
|
public Result add(MobileUser entity){
|
|
@@ -73,6 +81,15 @@ public class MobileUserServiceImpl implements MobileUserService {
|
|
|
return new Result(10002, ResultStatus.addNull);
|
|
|
}
|
|
|
try {
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ Integer id = mobileUserRepository.findID();
|
|
|
+ Integer grantClass = entity.getGrantClass();
|
|
|
+ if (grantClass ==null){
|
|
|
+ return new Result(10000,"msg");
|
|
|
+ }
|
|
|
+ restTemplate.getForEntity(ycgApi+"/video/mobileUser/register?id="+(id+1)+"&password=123456",null);
|
|
|
+ restTemplate.getForEntity(wyApi+"/video/mobileUser/register?id="+(id+1)+"&password=123456",null);
|
|
|
+ restTemplate.getForEntity(wjjApi+"/video/mobileUser/register?id="+(id+1)+"&password=123456",null);
|
|
|
mobileUserRepository.save(entity);
|
|
|
return new Result(10000,ResultStatus.addSuccess);
|
|
|
}catch (Exception e){
|
|
@@ -85,6 +102,13 @@ public class MobileUserServiceImpl implements MobileUserService {
|
|
|
if (ids == null || ids.length==0){
|
|
|
return new Result(10002,ResultStatus.deleteNull);
|
|
|
}
|
|
|
+
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ restTemplate.getForEntity(wjjApi+"/video/mobileUser/remove?ids="+ids,null);
|
|
|
+ restTemplate.getForEntity(wyApi+"/video/mobileUser/remove?ids="+ids,null);
|
|
|
+ restTemplate.getForEntity(ycgApi+"/video/mobileUser/remove?ids="+ids,null);
|
|
|
+
|
|
|
+
|
|
|
try {
|
|
|
for (Integer id : ids) {
|
|
|
mobileUserRepository.deleteById(id);
|