| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.dto.communitySettingKey.CommunitySettingKeyDto; |
| | | import com.java110.dto.community.CommunitySettingDto; |
| | | import com.java110.dto.community.CommunitySettingKeyDto; |
| | | import com.java110.intf.community.ICommunitySettingInnerServiceSMO; |
| | | import com.java110.intf.community.ICommunitySettingKeyV1InnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行 |
| | | */ |
| | | @Java110Cmd(serviceCode = "communitySettingKey.listCommunitySettingKey") |
| | | public class ListCommunitySettingKeyCmd extends AbstractServiceCmdListener { |
| | | public class ListCommunitySettingKeyCmd extends Cmd { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(ListCommunitySettingKeyCmd.class); |
| | | @Autowired |
| | | private ICommunitySettingKeyV1InnerServiceSMO communitySettingKeyV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICommunitySettingInnerServiceSMO communitySettingInnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | //super.validatePageInfo(reqJson); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区"); |
| | | Assert.hasKeyAndValue(reqJson, "settingType", "未包含类型"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } else { |
| | | communitySettingKeyDtos = new ArrayList<>(); |
| | | } |
| | | |
| | | // todo 刷入 小区值 |
| | | computeKeyValue(communitySettingKeyDtos, reqJson.getString("communityId"), reqJson.getString("settingType")); |
| | | |
| | | if (!reqJson.containsKey("row")) { |
| | | reqJson.put("row", 10); |
| | | } |
| | |
| | | |
| | | cmdDataFlowContext.setResponseEntity(responseEntity); |
| | | } |
| | | |
| | | private void computeKeyValue(List<CommunitySettingKeyDto> communitySettingKeyDtos, String communityId, String settingType) { |
| | | if (communitySettingKeyDtos == null || communitySettingKeyDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | CommunitySettingDto communitySettingDto = new CommunitySettingDto(); |
| | | communitySettingDto.setSettingType(settingType); |
| | | communitySettingDto.setCommunityId(communityId); |
| | | List<CommunitySettingDto> communitySettingDtos = communitySettingInnerServiceSMOImpl.queryCommunitySettings(communitySettingDto); |
| | | if (communitySettingDtos == null || communitySettingDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | for (CommunitySettingKeyDto communitySettingKeyDto : communitySettingKeyDtos) { |
| | | for (CommunitySettingDto tmpCommunitySettingDto : communitySettingDtos) { |
| | | if (!communitySettingKeyDto.getSettingKey().equals(tmpCommunitySettingDto.getSettingKey())) { |
| | | continue; |
| | | } |
| | | communitySettingKeyDto.setSettingValue(tmpCommunitySettingDto.getSettingValue()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |