| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | |
| | | import com.java110.dto.file.FileRelDto; |
| | | import com.java110.dto.repair.RepairDto; |
| | | import com.java110.dto.repair.RepairUserDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.intf.common.IFileInnerServiceSMO; |
| | | import com.java110.intf.common.IFileRelInnerServiceSMO; |
| | | import com.java110.intf.community.IRepairPoolV1InnerServiceSMO; |
| | | import com.java110.intf.community.IRepairUserV1InnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeConfigInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.intf.user.INotepadV1InnerServiceSMO; |
| | | import com.java110.intf.user.IUserV1InnerServiceSMO; |
| | | import com.java110.po.file.FileRelPo; |
| | | import com.java110.po.notepad.NotepadPo; |
| | | import com.java110.po.owner.RepairPoolPo; |
| | | import com.java110.po.owner.RepairUserPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | |
| | | public class SaveOwnerRepairCmd extends Cmd { |
| | | |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRepairPoolV1InnerServiceSMO repairPoolV1InnerServiceSMOImpl; |
| | |
| | | |
| | | @Autowired |
| | | private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private INotepadV1InnerServiceSMO notepadV1InnerServiceSMOImpl; |
| | | |
| | | //域 |
| | | public static final String DOMAIN_COMMON = "DOMAIN.COMMON"; |
| | |
| | | Assert.hasKeyAndValue(reqJson, "repairObjName", "必填,请填写报修对象名称"); |
| | | Assert.hasKeyAndValue(reqJson, "appointmentTime", "必填,请填写预约时间"); |
| | | Assert.hasKeyAndValue(reqJson, "context", "必填,请填写报修内容"); |
| | | Assert.hasKeyAndValue(reqJson, "userId", "必填,请填写提交用户ID"); |
| | | Assert.hasKeyAndValue(reqJson, "userName", "必填,请填写提交用户名称"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "必填,请填写小区ID"); |
| | | |
| | | String userId = context.getReqHeaders().get("user-id"); |
| | | Assert.hasLength(userId, "请填写提交用户ID"); |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setUserId(userId); |
| | | userDto.setPage(1); |
| | | userDto.setRow(1); |
| | | List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto); |
| | | Assert.listOnlyOne(userDtos, "未查询到用户"); |
| | | reqJson.put("userId", userDtos.get(0).getUserId()); |
| | | reqJson.put("userName", userDtos.get(0).getName()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { |
| | | //获取当前小区id |
| | | String communityId = reqJson.getString("communityId"); |
| | |
| | | if (reqJson.containsKey("photos") && !StringUtils.isEmpty(reqJson.getString("photos"))) { |
| | | JSONArray photos = reqJson.getJSONArray("photos"); |
| | | for (int _photoIndex = 0; _photoIndex < photos.size(); _photoIndex++) { |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| | | fileDto.setFileName(fileDto.getFileId()); |
| | | fileDto.setContext(photos.getJSONObject(_photoIndex).getString("photo")); |
| | | fileDto.setSuffix("jpeg"); |
| | | fileDto.setCommunityId(reqJson.getString("communityId")); |
| | | String fileName = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | reqJson.put("ownerPhotoId", fileDto.getFileId()); |
| | | reqJson.put("fileSaveName", fileName); |
| | | String _photo = photos.getString(_photoIndex); |
| | | if(_photo.length()> 512){ |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| | | fileDto.setFileName(fileDto.getFileId()); |
| | | fileDto.setContext(_photo); |
| | | fileDto.setSuffix("jpeg"); |
| | | fileDto.setCommunityId(reqJson.getString("communityId")); |
| | | _photo = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | } |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("fileRelId", "-" + (_photoIndex + 1)); |
| | | businessUnit.put("fileRelId", GenerateCodeFactory.getGeneratorId("12")); |
| | | businessUnit.put("relTypeCd", FileRelDto.REL_TYPE_CD_REPAIR); |
| | | businessUnit.put("saveWay", "ftp"); |
| | | businessUnit.put("objId", businessOwnerRepair.getString("repairId")); |
| | | businessUnit.put("fileRealName", fileName); |
| | | businessUnit.put("fileSaveName", fileName); |
| | | businessUnit.put("fileRealName", _photo.toString()); |
| | | businessUnit.put("fileSaveName", _photo.toString()); |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | flag = fileRelInnerServiceSMOImpl.saveFileRel(fileRelPo); |
| | | if (flag < 1) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (StringUtil.jsonHasKayAndValue(reqJson, "noteId")) { |
| | | NotepadPo notepadPo = new NotepadPo(); |
| | | notepadPo.setNoteId(reqJson.getString("noteId")); |
| | | notepadPo.setThridId(repairPoolPo.getRepairId()); |
| | | flag = notepadV1InnerServiceSMOImpl.updateNotepad(notepadPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("修改业主反馈失败"); |
| | | } |
| | | } |
| | | } |
| | | } |