UDIMS平台验证接口提交

test
郑明梁 2 years ago
parent dce2904b65
commit 26865894d0

@ -28,6 +28,7 @@ import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.service.auth.*;
import com.glxp.api.util.*;
import com.glxp.api.vo.inv.InvWarehouseTreeVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -316,7 +317,7 @@ public class LoginController extends BaseController {
return ResultVOUtils.error(ResultEnum.DATA_CHANGE);
}
//------------------------------------------UDIMS接口-----------------------------------------------------------
@Autowired
private InvWarehouseDao invWarehouseDao;
@ -366,7 +367,6 @@ public class LoginController extends BaseController {
return ResultVOUtils.success(authLicense1);
}
@GetMapping("/spms/inv/warehouse/filterInv/forUdims")
public BaseResponse forUdims() {
FilterInvWarehouseRequest filterInvWarehouseRequest=new FilterInvWarehouseRequest();
@ -397,9 +397,6 @@ public class LoginController extends BaseController {
}
@Value("${WEB_TITLE}")
private String WEB_TITLE;
@ -410,4 +407,53 @@ public class LoginController extends BaseController {
return ResultVOUtils.success(webTitleResponse);
}
//------------------------------------------UDIMS接口-----------------------------------------------------------
/**
*
*
* @return
*/
@ResponseBody
@PostMapping(value = "/udims/verify")
public BaseResponse udimsVerify(@RequestBody Map<String, Object> params,
HttpServletRequest request) {
AuthAdmin authAdmin;
authAdmin = authAdminService.findByUserName(params.get("username").toString());
if (authAdmin == null) {
throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误");
}
if (!PasswordUtils.authAdminPwd(params.get("password").toString()).equals(authAdmin.getPassWord())) {
throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误");
}
AuthLicense authLicense = new AuthLicense();
if (params.get("appid") != null) {
authLicense = authLicenseDao.get(params.get("appid").toString());
} else {
String appid = AppUtils.getAppid();
authLicense.setId(appid);
authLicense.setAppid(appid);
authLicense.setApiKey(appid);
if (params.get("name") != null)
authLicense.setName(params.get("name").toString());
authLicense.setSecretKey(AppUtils.getSecretKey(appid));
authLicense.setCustomerId(authAdmin.getCustomerId() + "");
CompanyEntity companyEntity = companyService.findCompany(authAdmin.getCustomerId());
authLicense.setCompanyName(companyEntity.getCompanyName());
authLicense.setCreateDate(new Date());
authLicenseDao.romveByCustomerId(authAdmin.getCustomerId() + "");
authLicenseDao.save(authLicense);
}
FilterInvWarehouseRequest filterInvWarehouseRequest = new FilterInvWarehouseRequest();
filterInvWarehouseRequest.setSpUse(true);
List<InvWarehouseTreeVo> invList = invWarehouseDao.selectInvListTreeByUser(filterInvWarehouseRequest);
Map<String, Object> res = new WeakHashMap<>(2);
res.put("license", authLicense);
res.put("invList", invList);
return ResultVOUtils.success(res);
}
}

Loading…
Cancel
Save