|
|
@@ -26,6 +26,7 @@ import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
import com.goafanti.common.enums.OrgProFields;
|
|
|
import com.goafanti.common.enums.OrganizationIdentityFields;
|
|
|
+import com.goafanti.common.enums.OrganizationTechFields;
|
|
|
import com.goafanti.common.enums.UserAbilityFields;
|
|
|
import com.goafanti.common.enums.UserCareerFields;
|
|
|
import com.goafanti.common.enums.UserEduFields;
|
|
|
@@ -49,6 +50,7 @@ import com.goafanti.common.utils.VerifyCodeUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.techproject.service.TechWebsiteService;
|
|
|
import com.goafanti.user.bo.InputOrgPro;
|
|
|
+import com.goafanti.user.bo.InputOrganizationTech;
|
|
|
import com.goafanti.user.bo.InputUserAbility;
|
|
|
import com.goafanti.user.bo.InputUserCareer;
|
|
|
import com.goafanti.user.bo.InputUserEdu;
|
|
|
@@ -100,9 +102,9 @@ public class UserApiController extends BaseApiController {
|
|
|
@Resource
|
|
|
private OrgHumanResourceService orgHumanResourceService;
|
|
|
@Resource
|
|
|
- private TechWebsiteService techWebsiteService;
|
|
|
+ private TechWebsiteService techWebsiteService;
|
|
|
@Resource
|
|
|
- private OrgRatepayService orgRatepayService;
|
|
|
+ private OrgRatepayService orgRatepayService;
|
|
|
|
|
|
/**
|
|
|
* 修改密码
|
|
|
@@ -159,24 +161,24 @@ public class UserApiController extends BaseApiController {
|
|
|
this.cleanCodeSession();
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- if (StringUtils.isBlank(newPwd)){
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(newPwd)) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新密码"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- if (StringUtils.isBlank(mobile)){
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(mobile)) {
|
|
|
res.getError().add(buildError(ErrorConstants.MOBILE_EMPTY_ERROR, "", "mobile"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- if (1 != type || 0 != type){
|
|
|
+
|
|
|
+ if (1 != type || 0 != type) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_PATTERN_ERROR, "", "type"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
User user = userService.selectByMobieAndType(mobile, type);
|
|
|
- if (null == user){
|
|
|
+ if (null == user) {
|
|
|
res.getError().add(buildError(ErrorConstants.MOBILE_EMPTY_ERROR, "", "mobile"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -196,12 +198,12 @@ public class UserApiController extends BaseApiController {
|
|
|
@RequestMapping(value = "/checkMCode", method = RequestMethod.POST)
|
|
|
public Result checkMCode(String mobileCode) {
|
|
|
Result res = new Result();
|
|
|
-
|
|
|
- if (StringUtils.isBlank(mobileCode)){
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(mobileCode)) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "手机验证码"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (TimeUtils.checkOverTime("register")) {
|
|
|
res.getError().add(buildError(ErrorConstants.MCODE_OVERTIME_ERROR, "手机验证码超时失效"));
|
|
|
TokenManager.getSession().removeAttribute(VerifyCodeUtils.M_CODE);
|
|
|
@@ -231,8 +233,8 @@ public class UserApiController extends BaseApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.MOBILE_EMPTY_ERROR, "手机号不能为空!"));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
- if (StringUtils.isBlank(mobileCode)){
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(mobileCode)) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "手机验证码"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -343,7 +345,7 @@ public class UserApiController extends BaseApiController {
|
|
|
u.setNickname(userInfoBo.getNickname());
|
|
|
u.setEmail(userInfoBo.getEmail());
|
|
|
userService.updateByPrimaryKeySelective(u);
|
|
|
-
|
|
|
+
|
|
|
UserInfo ui = new UserInfo();
|
|
|
BeanUtils.copyProperties(userInfoBo, ui);
|
|
|
if (StringUtils.isBlank(ui.getId())) {
|
|
|
@@ -372,10 +374,10 @@ public class UserApiController extends BaseApiController {
|
|
|
UserEduFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
UserEdu ue = new UserEdu();
|
|
|
BeanUtils.copyProperties(userEdu, ue);
|
|
|
-
|
|
|
+
|
|
|
if (StringUtils.isBlank(ue.getId())) {
|
|
|
userEdu.setId(UUID.randomUUID().toString());
|
|
|
userEdu.setUid(TokenManager.getUserId());
|
|
|
@@ -404,7 +406,6 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
UserCareer uc = new UserCareer();
|
|
|
BeanUtils.copyProperties(userCareer, uc);
|
|
|
-
|
|
|
|
|
|
if (StringUtils.isBlank(uc.getId())) {
|
|
|
uc.setId(UUID.randomUUID().toString());
|
|
|
@@ -489,7 +490,7 @@ public class UserApiController extends BaseApiController {
|
|
|
OrgProFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
OrganizationInfo oi = new OrganizationInfo();
|
|
|
OrganizationProperties op = new OrganizationProperties();
|
|
|
BeanUtils.copyProperties(pro, oi);
|
|
|
@@ -508,17 +509,23 @@ public class UserApiController extends BaseApiController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/orgTech", method = RequestMethod.POST)
|
|
|
- public Result tech(OrganizationTech orgTech, BindingResult bindingResult) {
|
|
|
+ public Result tech(@Valid InputOrganizationTech orgTech, BindingResult bindingResult) {
|
|
|
Result res = new Result();
|
|
|
- OrganizationTech tech = organizationTechService.selectOrgTechByUserId(TokenManager.getUserId());
|
|
|
- if (tech == null) {
|
|
|
- orgTech.setId(UUID.randomUUID().toString());
|
|
|
- orgTech.setUid(TokenManager.getUserId());
|
|
|
- organizationTechService.insert(orgTech);
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
+ OrganizationTechFields.getFieldDesc(bindingResult.getFieldError().getField())));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ OrganizationTech ot = new OrganizationTech();
|
|
|
+ BeanUtils.copyProperties(orgTech, ot);
|
|
|
+ if (StringUtils.isBlank(ot.getId())) {
|
|
|
+ ot.setId(UUID.randomUUID().toString());
|
|
|
+ ot.setUid(TokenManager.getUserId());
|
|
|
+ organizationTechService.insert(ot);
|
|
|
|
|
|
} else {
|
|
|
- orgTech.setId(tech.getId());
|
|
|
- organizationTechService.updateByPrimaryKeySelective(orgTech);
|
|
|
+ organizationTechService.updateByPrimaryKeySelective(ot);
|
|
|
}
|
|
|
res.setData(orgTech);
|
|
|
return res;
|
|
|
@@ -533,7 +540,7 @@ public class UserApiController extends BaseApiController {
|
|
|
public Result basic() {
|
|
|
Result res = new Result();
|
|
|
UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (ub.getType() == 0) {
|
|
|
+ if (null != ub && ub.getType() == 0) {
|
|
|
UserIdentityBo u = userIdentityService.selectUserIdentityBoByUserId(ub.getUid());
|
|
|
res.setData(u);
|
|
|
} else {
|
|
|
@@ -552,7 +559,7 @@ public class UserApiController extends BaseApiController {
|
|
|
public Result member() {
|
|
|
Result res = new Result();
|
|
|
UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (ub.getType() == 0) {
|
|
|
+ if (null != ub && ub.getType() == 0) {
|
|
|
UserInfoBo u = userInfoService.selectUserInfoBoByUserId(ub.getUid());
|
|
|
res.setData(u);
|
|
|
} else {
|
|
|
@@ -573,8 +580,10 @@ public class UserApiController extends BaseApiController {
|
|
|
public Result educate() {
|
|
|
Result res = new Result();
|
|
|
UidAndTypeBo ub = basicInfo(userService);
|
|
|
- UserEdu u = userEduService.selectUserEduByUserId(ub.getUid());
|
|
|
- res.setData(u);
|
|
|
+ if (null != ub) {
|
|
|
+ UserEdu u = userEduService.selectUserEduByUserId(ub.getUid());
|
|
|
+ res.setData(u);
|
|
|
+ }
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -587,7 +596,7 @@ public class UserApiController extends BaseApiController {
|
|
|
public Result job() {
|
|
|
Result res = new Result();
|
|
|
UidAndTypeBo ub = basicInfo(userService);
|
|
|
- if (ub.getType() == 0) {
|
|
|
+ if (null != ub && ub.getType() == 0) {
|
|
|
UserCareer u = userCareerService.selectUserCareerByUserId(ub.getUid());
|
|
|
res.setData(u);
|
|
|
} else {
|
|
|
@@ -606,18 +615,21 @@ public class UserApiController extends BaseApiController {
|
|
|
public Result ability() {
|
|
|
Result res = new Result();
|
|
|
UidAndTypeBo ub = basicInfo(userService);
|
|
|
- UserAbility u = userAbilityService.selectUserAbilityByUserId(ub.getUid());
|
|
|
- res.setData(u);
|
|
|
+ if (null != ub) {
|
|
|
+ UserAbility u = userAbilityService.selectUserAbilityByUserId(ub.getUid());
|
|
|
+ res.setData(u);
|
|
|
+ }
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 团体人力资源情况入口
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/humanResource", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public Result humanResource(Integer year, String pageNo, String pageSize ) {
|
|
|
+ public Result humanResource(Integer year, String pageNo, String pageSize) {
|
|
|
Result res = new Result();
|
|
|
res = checkCertify(res);
|
|
|
if (res.getError().isEmpty()) {
|
|
|
@@ -633,18 +645,19 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 团体人力资源情况修改保存(用户端)
|
|
|
+ *
|
|
|
* @param orgHumanResource
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/SaveHumanResource", method = RequestMethod.POST)
|
|
|
- public Result SaveHumanResource(OrgHumanResource orgHumanResource){
|
|
|
+ public Result SaveHumanResource(OrgHumanResource orgHumanResource) {
|
|
|
Result res = new Result();
|
|
|
- if (null == orgHumanResource.getId()){
|
|
|
+ if (null == orgHumanResource.getId()) {
|
|
|
if (null != orgHumanResourceService.selectOrgHumanResourceByUidAndYear(orgHumanResource.getYear(),
|
|
|
- orgHumanResource.getUid())){
|
|
|
+ orgHumanResource.getUid())) {
|
|
|
res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度人力资源情况已录入!"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -657,12 +670,13 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 删除团体人力资源
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public Result deleteHumanResource(@RequestParam(name = "ids[]", required = true) String[] ids){
|
|
|
+ public Result deleteHumanResource(@RequestParam(name = "ids[]", required = true) String[] ids) {
|
|
|
Result res = new Result();
|
|
|
List<String> id = new ArrayList<String>();
|
|
|
for (String s : ids) {
|
|
|
@@ -754,7 +768,7 @@ public class UserApiController extends BaseApiController {
|
|
|
if (0 != (u.getAmountMoney().compareTo(userIdentity.getAmountMoney()))) {
|
|
|
int t = 3 - u.getWrongCount() - 1;
|
|
|
u.setWrongCount(u.getWrongCount() + 1);
|
|
|
-
|
|
|
+
|
|
|
if (0 == t) {
|
|
|
u.setAuditStatus(4);
|
|
|
u.setProcess(5);
|
|
|
@@ -784,21 +798,25 @@ public class UserApiController extends BaseApiController {
|
|
|
|
|
|
/**
|
|
|
* 团体实名认证流程下一步
|
|
|
- * @throws ParseException
|
|
|
+ *
|
|
|
+ * @throws ParseException
|
|
|
*/
|
|
|
@RequestMapping(value = "/orgNextPro", method = RequestMethod.POST)
|
|
|
- public Result orgNextProcess(OrganizationIdentity orgIdentity, String listedDateFormattedDate, String verificationCode) throws ParseException {
|
|
|
+ public Result orgNextProcess(OrganizationIdentity orgIdentity, String listedDateFormattedDate,
|
|
|
+ String verificationCode) throws ParseException {
|
|
|
Result res = new Result();
|
|
|
if (1 == orgIdentity.getProcess()) {
|
|
|
if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.V_CODE).equals(verificationCode)) {
|
|
|
res.getError().add(buildError(ErrorConstants.VCODE_ERROR, "验证码错误"));
|
|
|
return res;
|
|
|
}
|
|
|
- if (!StringUtils.isBlank(listedDateFormattedDate)){
|
|
|
+ if (!StringUtils.isBlank(listedDateFormattedDate)) {
|
|
|
orgIdentity.setListedDate(DateUtils.parseDate(listedDateFormattedDate, AFTConstants.YYYYMMDD));
|
|
|
}
|
|
|
- /*res.setData(organizationIdentityService.saveLastYearTaxReprotUrl(orgIdentity, TokenManager.getUserId()));
|
|
|
- return res;*/
|
|
|
+ /*
|
|
|
+ * res.setData(organizationIdentityService.saveLastYearTaxReprotUrl(
|
|
|
+ * orgIdentity, TokenManager.getUserId())); return res;
|
|
|
+ */
|
|
|
}
|
|
|
if (3 == orgIdentity.getProcess()) {
|
|
|
OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
@@ -872,23 +890,19 @@ public class UserApiController extends BaseApiController {
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 获取公司联系人
|
|
|
+ *
|
|
|
* @param uid
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/getContacts", method = RequestMethod.GET)
|
|
|
- public Result getContacts(){
|
|
|
+ public Result getContacts() {
|
|
|
Result res = new Result();
|
|
|
res.setData(organizationIdentityService.selectContactsByUserId(TokenManager.getUserId()));
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
// 认证失败清除相关认证信息
|
|
|
private Result dealFaild(Result res) {
|
|
|
@@ -938,20 +952,21 @@ public class UserApiController extends BaseApiController {
|
|
|
private UidAndTypeBo basicInfo(UserService userService) {
|
|
|
User u = userService.selectByPrimaryKey(TokenManager.getUserId());
|
|
|
UidAndTypeBo ub = new UidAndTypeBo();
|
|
|
- ub.setType(u.getType());
|
|
|
- ub.setUid(u.getId());
|
|
|
+ if (null != u) {
|
|
|
+ ub.setType(u.getType());
|
|
|
+ ub.setUid(u.getId());
|
|
|
+ }
|
|
|
return ub;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 判断用户是否通过认证
|
|
|
- private Result checkCertify(Result res) {
|
|
|
- OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
- if (null == o || 5 != o.getAuditStatus()) {
|
|
|
- res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
|
|
|
- }
|
|
|
-
|
|
|
- return res;
|
|
|
+ private Result checkCertify(Result res) {
|
|
|
+ OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
|
|
|
+ if (null == o || 5 != o.getAuditStatus()) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
}
|