Commit 674f63f1 by 陶光胜

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-enterprise into developer
parents 6c41000b 84d7460d
......@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.entity.TabEnterpriseInit;
import com.gic.enterprise.service.*;
import com.gic.member.api.service.MemberInitApiService;
......@@ -261,7 +262,7 @@ public class EnterpriseApiServiceImpl implements EnterpriseApiService {
@Override
public ServiceResponse<List<EnterpriseDTO>> listEnterpriseByPhoneNumber(String phoneNumber) {
ServiceResponse<List<UserDTO>> listServiceResponse = this.userApiService.listUserByPhoneNumber(phoneNumber);
ServiceResponse<List<UserDTO>> listServiceResponse = this.userApiService.listUserByPhoneNumber(phoneNumber, Constants.NATION_CODE);
if (listServiceResponse.isSuccess()) {
List<UserDTO> result = listServiceResponse.getResult();
if (CollectionUtils.isEmpty(result)) {
......
......@@ -7,6 +7,9 @@ import java.util.List;
import java.util.Map;
import com.gic.auth.constant.UserConstants;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.utils.AutoCreatePasswordUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.finance.constant.EnterprisePlatformTypeEnum;
import com.gic.marketing.process.api.service.sms.SmsSendApiService;
import com.gic.open.api.dto.market.MarketUserDTO;
......@@ -112,7 +115,7 @@ public class EnterpriseController {
if (result.isSuccess() && UserConstants.CREATE_AUTO == userDTO.getPasswordType().intValue()) {
//发送短信,通知自动生成密码
if (StringUtils.isBlank(userDTO.getPhoneAreaCode())) {
userDTO.setPhoneAreaCode("86");
userDTO.setPhoneAreaCode("+86");
}
String[] smsArr = new String[] { enterpriseDTO.getEnterpriseName(), userDTO.getPhoneNumber(), password };
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICpassword001",
......@@ -192,7 +195,45 @@ public class EnterpriseController {
@RequestMapping("/edit-user")
public RestResponse editUser(UserDTO userDTO) {
return ResultControllerUtils.commonResult(userApiService.editAdmin(userDTO));
//自动密码
boolean isAutoPassword = userDTO.getPasswordType() == UserConstants.CREATE_AUTO;
String autoPassword = null;
if (isAutoPassword) {
String password = UserPasswordUtil.createPasswordAuto();
autoPassword = password;
//密码加密
userDTO.setPassword(UserPasswordUtil.getEncryptPassword(password));
}
if (userDTO.getPasswordType() != null && userDTO.getPasswordType().intValue() != UserConstants.CREATE_AUTO) {
//如果是自定义密码
if (StringUtils.isBlank(userDTO.getPassword())) {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "密码为空,操作有误");
}
userDTO.setPassword(AutoCreatePasswordUtils.encryptPassword(userDTO.getPassword()));
}
ServiceResponse<Void> result = userApiService.editAdmin(userDTO);
//自动创建密码,需要发送短信
if (result.isSuccess() && isAutoPassword) {
Integer enterpriseId = userDTO.getEnterpriseId();
//商户ID查询商户信息
//商户名称
String enterpriseName = null;
ServiceResponse<EnterpriseDTO> enterpriseResult = enterpriseApiService.getEnterpriseById(enterpriseId);
if (enterpriseResult.isSuccess()) {
enterpriseName = enterpriseResult.getResult().getEnterpriseName();
} else {
LOGGER.warn(enterpriseResult.getMessage());
}
String[] smsArr = new String[] { enterpriseName,
userDTO.getPhoneNumber(), autoPassword };
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms("GICpassword001",
enterpriseId, userDTO.getPhoneAreaCode(),
userDTO.getPhoneNumber(), smsArr);
if (!smsSendResult.isSuccess()) {
LOGGER.warn(smsSendResult.getMessage());
}
}
return ResultControllerUtils.commonResult(result);
}
@RequestMapping("/get-enterprise")
......@@ -435,7 +476,8 @@ public class EnterpriseController {
@RequestMapping("/list-coupon")
public RestResponse listCoupon(BigDecimal price, Long isvId, Long enterpriseId, Long serveId, Long skuId) {
return ResultControllerUtils.commonResult(
couponApiService.listEnterpriseCouponByServeId(price, isvId, enterpriseId, serveId, skuId), CouponLogVO.class);
couponApiService.listEnterpriseCouponByServeId(price, isvId, enterpriseId, serveId, skuId),
CouponLogVO.class);
}
@RequestMapping("/order-detail")
......
......@@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.open.api.service.market.MarketUserApiService;
......@@ -93,7 +94,8 @@ public class LoginController {
UserDetailsVO userDetailsVO = UserUtils.getUser();
String phone = userDetailsVO.getUserMobile();
ServiceResponse<UserDTO> userResult = userApiService.listUserByPhoneNumber(phone, enterpriseId);
//运营人员国内,默认数据
ServiceResponse<UserDTO> userResult = userApiService.listUserByPhoneNumber(Constants.NATION_CODE, phone, enterpriseId);
if (userResult.isSuccess()) {
//获取运营实施信息
UserDTO user = userResult.getResult();
......@@ -103,6 +105,7 @@ public class LoginController {
temp.setEnterpriseId(enterpriseId);
temp.setPhoneNumber(phone);
temp.setUserName(userDetailsVO.getRealName());
temp.setPhoneAreaCode(Constants.NATION_CODE);
temp.setSuperAdmin(1);
ServiceResponse<Integer> saveResult = userApiService.saveOperationUser(temp);
user = temp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment