| | |
| | | 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; |
| | |
| | | @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); |
| | | } |
| | | reqJson.put("userId", userId); |
| | | reqJson.put("relCd", "-1".equals(oldUserId) ? StoreUserRelConstant.REL_COMMON : StoreUserRelConstant.REL_ADMIN); |
| | | if (!reqJson.containsKey("relCd") || StringUtil.isEmpty(reqJson.getString("relCd"))) { |
| | | reqJson.put("relCd", StoreUserRelConstant.REL_COMMON); |
| | | } |
| | | addStaff(reqJson); |
| | | //重写 员工岗位 |
| | | reqJson.put("relCd", relCd); |
| | |
| | | |
| | | public void addStaffOrg(JSONObject paramInJson) { |
| | | |
| | | if (!paramInJson.containsKey("orgId") || StringUtil.isEmpty(paramInJson.getString("orgId"))) { |
| | | return; |
| | | } |
| | | |
| | | JSONObject businessOrgStaffRel = new JSONObject(); |
| | | businessOrgStaffRel.put("relId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_relId)); |
| | | businessOrgStaffRel.put("storeId", paramInJson.getString("storeId")); |