dev-discount
199901012 4 years ago
commit b8a32ec1f7
  1. 42
      hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java
  2. 16
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  3. 2
      hai-service/src/main/java/com/hai/service/impl/BsCompanyServiceImpl.java

@ -89,39 +89,31 @@ public class BsCompanyController {
try {
BsCompany company = secCompanyModel.getCompany();
SecUser user = secCompanyModel.getUser();
if (StringUtils.isBlank(company.getName()) || StringUtils.isBlank(company.getRegionId()) ||
StringUtils.isBlank(company.getAddress()) || StringUtils.isBlank(company.getPhone()) ||
StringUtils.isBlank(user.getLoginName()) ||
StringUtils.isBlank(user.getPassword()) || StringUtils.isBlank(user.getTelephone())) {
if (StringUtils.isBlank(company.getName())
|| StringUtils.isBlank(company.getRegionId())
|| StringUtils.isBlank(company.getAddress())
|| StringUtils.isBlank(company.getPhone())
|| StringUtils.isBlank(user.getLoginName())
|| StringUtils.isBlank(user.getPassword())
) {
log.error("BsCompanyController --> addCompanyAndUser() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
//发布人员
SessionObject sessionObject = userCenter.getSessionObject(request);
if(sessionObject == null){
log.error("SecCompanyController --> updateCompany() error!", "");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, "");
}
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
// 校验区域
if (company.getRegionId().length() >= 4) {
company.setRegionId(company.getRegionId().substring(0,4));
} else {
log.error("BsCompanyController --> addCompanyAndUser() error!", "单位区域必须选择到市级区域");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_HAS_IN_CITY_ERROR, "");
}
// 校验公司名称
BsCompany secCompany = bsCompanyService.selectCompanyByName(company.getName());
if (secCompany != null) {
log.error("BsCompanyController --> addCompanyAndUser() error!", "该单位已经存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_NAME_IS_EXIST_ERROR, "");
}
// // 校验区域下是否存在公司
// BsCompany companyRegion = bsCompanyService.selectCompanyByRegion(company.getRegionId());
// if (companyRegion != null) {
// log.error("BsCompanyController --> addCompanyAndUser() error!", "该区域下已存在单位");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_IS_EXIST_ERROR, "");
// }
// 校验用户
SecUser secUser = secUserService.findByLoginName(user.getLoginName());
if (secUser != null) {
@ -135,7 +127,6 @@ public class BsCompanyController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PHONE_HAS_ONE_ERROR, "");
}
//生成公司状态
company.setStatus(1);
company.setCreateTime(new Date());
@ -203,33 +194,18 @@ public class BsCompanyController {
}
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
// 校验区域
if (company.getRegionId().length() >= 4) {
company.setRegionId(company.getRegionId().substring(0,4));
} else {
log.error("BsCompanyController --> updateCompany() error!", "单位区域必须选择到市级区域");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_HAS_IN_CITY_ERROR, "");
}
// 校验公司名称
BsCompany secCompany = bsCompanyService.selectCompanyByName(company.getName());
if (secCompany != null && !secCompany.getId().equals(company.getId())) {
log.error("BsCompanyController --> updateCompany() error!", "该单位已经存在");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_NAME_IS_EXIST_ERROR, "");
}
// // 校验区域下是否存在公司
// BsCompany companyRegion = bsCompanyService.selectCompanyByRegion(company.getRegionId());
// if (companyRegion != null && !companyRegion.getId().equals(company.getId())) {
// log.error("BsCompanyController --> updateCompany() error!", "该区域下已存在单位");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_IS_EXIST_ERROR, "");
// }
BsOrganization organization = bsOrganizationService.findTopByCompany(company.getId());
if (organization == null) {
log.error("BsCompanyController --> updateCompany() error!", "未找到该部门信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_FIND_ORGANIZATION_ERROR, "");
}
// 查询用户
SecUser secUser = secUserService.findById(user.getId());
if (secUser == null) {

@ -100,7 +100,7 @@ public class HighCouponController {
}
// 查询商户
HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getCompanyId());
HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getMerchantId());
if (merchant == null) {
log.error("HighCouponController -> insertCoupon() error!","未找到商户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, "");
@ -269,16 +269,24 @@ public class HighCouponController {
@RequestMapping(value="/getCouponList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "卡卷列表")
public ResponseData getCouponList(@RequestParam(name = "companyId", required = false) Long companyId,
public ResponseData getCouponList(
@RequestParam(name = "merchantId", required = false) Long merchantId,
@RequestParam(name = "couponName", required = false) String couponName,
@RequestParam(name = "couponType", required = false) Integer couponType,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
@RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) {
try {
Map<String, Object> map = new HashMap<>();
map.put("companyId", companyId);
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighCouponController -> getCouponList() error!","权限不足");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
map.put("companyId", userInfoModel.getBsCompany().getId());
map.put("merchantId", merchantId);
map.put("couponName", couponName);
map.put("couponType", couponType);

@ -71,7 +71,7 @@ public class BsCompanyServiceImpl implements BsCompanyService {
secOrganization.setManagerName(secUser.getUserName());
secOrganization.setManagerPhone(secUser.getTelephone());
bsOrganizationMapper.updateByPrimaryKey(secOrganization);
// 保存用户角色[就业局主角色]
// 保存用户角色
SecUserRoleRel userRole = new SecUserRoleRel();
userRole.setUserId(secUser.getId());
userRole.setRoleId(2L);

Loading…
Cancel
Save