| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | |
| | | import com.java110.po.store.StoreUserPo; |
| | | import com.java110.po.user.UserPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.MappingConstant; |
| | | import com.java110.utils.constant.StoreUserRelConstant; |
| | | import com.java110.utils.constant.UserLevelConstant; |
| | |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | |
| | | if (!reqJson.containsKey("storeId")) { |
| | | String storeId = context.getReqHeaders().get("store-id"); |
| | | reqJson.put("storeId", storeId); |
| | | } |
| | | //获取数据上下文对象 |
| | | Assert.jsonObjectHaveKey(reqJson, "storeId", "请求参数中未包含storeId 节点,请确认"); |
| | | Assert.jsonObjectHaveKey(reqJson, "storeTypeCd", "请求参数中未包含storeTypeCd 节点,请确认"); |
| | | //判断员工手机号是否重复(员工可根据手机号登录平台) |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setTel(reqJson.getString("tel")); |
| | |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | String userId = ""; |
| | | String oldUserId = ""; |
| | | |
| | | String relCd = reqJson.getString("relCd");//员工 组织 岗位 |
| | | if (!reqJson.containsKey("userId") || "-1".equals(reqJson.getString("userId"))) { |
| | | //将userId 强制写成-1 |
| | | oldUserId = "-1"; |
| | | userId = GenerateCodeFactory.getUserId(); |
| | | reqJson.put("userId", userId); |
| | | //添加用户 |
| | | addUser(reqJson); |
| | | } |
| | | |
| | | userId = GenerateCodeFactory.getUserId(); |
| | | reqJson.put("userId", userId); |
| | | reqJson.put("relCd", "-1".equals(oldUserId) ? StoreUserRelConstant.REL_COMMON : StoreUserRelConstant.REL_ADMIN); |
| | | //添加用户 |
| | | addUser(reqJson); |
| | | reqJson.put("userId", userId); |
| | | if (!reqJson.containsKey("relCd") || StringUtil.isEmpty(reqJson.getString("relCd"))) { |
| | | reqJson.put("relCd", StoreUserRelConstant.REL_COMMON); |
| | | } |
| | | addStaff(reqJson); |
| | | //重写 员工岗位 |
| | | reqJson.put("relCd", relCd); |
| | |
| | | businessUnit.put("fileSaveName", fileName); |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | flag = fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | if(flag <1){ |
| | | if (flag < 1) { |
| | | throw new CmdException("保存图片异常"); |
| | | } |
| | | } |
| | |
| | | Assert.jsonObjectHaveKey(paramObj, "name", "请求参数中未包含name 节点,请确认"); |
| | | //Assert.jsonObjectHaveKey(paramObj,"email","请求参数中未包含email 节点,请确认"); |
| | | Assert.jsonObjectHaveKey(paramObj, "tel", "请求参数中未包含tel 节点,请确认"); |
| | | Assert.jsonObjectHaveKey(paramObj, "orgId", "请求报文格式错误或未包含部门信息"); |
| | | Assert.jsonObjectHaveKey(paramObj, "address", "请求报文格式错误或未包含地址信息"); |
| | | Assert.jsonObjectHaveKey(paramObj, "sex", "请求报文格式错误或未包含性别信息"); |
| | | Assert.jsonObjectHaveKey(paramObj, "relCd", "请求报文格式错误或未包含员工角色"); |
| | | |
| | | |
| | | if (paramObj.containsKey("email") && !StringUtil.isEmpty(paramObj.getString("email"))) { |
| | |
| | | |
| | | public void addStaffOrg(JSONObject paramInJson) { |
| | | |
| | | if (!paramInJson.containsKey("orgId") || StringUtil.isEmpty(paramInJson.getString("orgId"))) { |
| | | return; |
| | | } |
| | | |
| | | JSONObject businessOrgStaffRel = new JSONObject(); |
| | | businessOrgStaffRel.put("relId", "-1"); |
| | | businessOrgStaffRel.put("relId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_relId)); |
| | | businessOrgStaffRel.put("storeId", paramInJson.getString("storeId")); |
| | | businessOrgStaffRel.put("staffId", paramInJson.getString("userId")); |
| | | businessOrgStaffRel.put("orgId", paramInJson.getString("orgId")); |