|
|
@@ -6,14 +6,18 @@ import com.java110.core.context.ICmdDataFlowContext;
|
|
|
import com.java110.core.event.cmd.Cmd;
|
|
|
import com.java110.core.event.cmd.CmdEvent;
|
|
|
import com.java110.dto.inspection.InspectionPlanDto;
|
|
|
+import com.java110.dto.inspection.InspectionPlanStaffDto;
|
|
|
import com.java110.dto.inspection.InspectionRouteDto;
|
|
|
import com.java110.dto.org.OrgStaffRelDto;
|
|
|
+import com.java110.intf.community.IInspectionPlanStaffV1InnerServiceSMO;
|
|
|
import com.java110.intf.community.IInspectionPlanV1InnerServiceSMO;
|
|
|
import com.java110.intf.community.IInspectionRouteInnerServiceSMO;
|
|
|
import com.java110.intf.user.IOrgStaffRelInnerServiceSMO;
|
|
|
import com.java110.utils.exception.CmdException;
|
|
|
import com.java110.utils.util.Assert;
|
|
|
import com.java110.utils.util.BeanConvertUtil;
|
|
|
+import com.java110.utils.util.ListUtil;
|
|
|
+import com.java110.vo.ResultVo;
|
|
|
import com.java110.vo.api.inspectionPlan.ApiInspectionPlanDataVo;
|
|
|
import com.java110.vo.api.inspectionPlan.ApiInspectionPlanVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -36,6 +40,9 @@ public class ListInspectionPlansCmd extends Cmd {
|
|
|
@Autowired
|
|
|
private IInspectionRouteInnerServiceSMO inspectionRouteInnerServiceSMOImpl;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IInspectionPlanStaffV1InnerServiceSMO inspectionPlanStaffV1InnerServiceSMOImpl;
|
|
|
+
|
|
|
@Override
|
|
|
public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
|
|
|
super.validatePageInfo(reqJson);
|
|
|
@@ -48,22 +55,57 @@ public class ListInspectionPlansCmd extends Cmd {
|
|
|
|
|
|
int count = inspectionPlanV1InnerServiceSMOImpl.queryInspectionPlansCount(inspectionPlanDto);
|
|
|
|
|
|
- List<ApiInspectionPlanDataVo> inspectionPlans = null;
|
|
|
-
|
|
|
+ List<InspectionPlanDto> inspectionPlans = null;
|
|
|
if (count > 0) {
|
|
|
- inspectionPlans = BeanConvertUtil.covertBeanList(inspectionPlanV1InnerServiceSMOImpl.queryInspectionPlans(inspectionPlanDto), ApiInspectionPlanDataVo.class);
|
|
|
+ inspectionPlans = BeanConvertUtil.covertBeanList(inspectionPlanV1InnerServiceSMOImpl.queryInspectionPlans(inspectionPlanDto), InspectionPlanDto.class);
|
|
|
+ queryStaffs(inspectionPlans);
|
|
|
} else {
|
|
|
inspectionPlans = new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
- ApiInspectionPlanVo apiInspectionPlanVo = new ApiInspectionPlanVo();
|
|
|
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, inspectionPlans);
|
|
|
|
|
|
- apiInspectionPlanVo.setTotal(count);
|
|
|
- apiInspectionPlanVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
|
|
|
- apiInspectionPlanVo.setInspectionPlans(inspectionPlans);
|
|
|
-
|
|
|
- ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiInspectionPlanVo), HttpStatus.OK);
|
|
|
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
|
|
|
|
|
|
context.setResponseEntity(responseEntity);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询员工
|
|
|
+ *
|
|
|
+ * @param inspectionPlans
|
|
|
+ */
|
|
|
+ private void queryStaffs(List<InspectionPlanDto> inspectionPlans) {
|
|
|
+
|
|
|
+ if (ListUtil.isNull(inspectionPlans)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> planIds = new ArrayList<>();
|
|
|
+
|
|
|
+ for (InspectionPlanDto inspectionPlanDto : inspectionPlans) {
|
|
|
+ planIds.add(inspectionPlanDto.getInspectionPlanId());
|
|
|
+ }
|
|
|
+
|
|
|
+ InspectionPlanStaffDto inspectionPlanStaffDto = new InspectionPlanStaffDto();
|
|
|
+ inspectionPlanStaffDto.setInspectionPlanIds(planIds.toArray(new String[planIds.size()]));
|
|
|
+ inspectionPlanStaffDto.setCommunityId(inspectionPlans.get(0).getCommunityId());
|
|
|
+ List<InspectionPlanStaffDto> inspectionPlanStaffDtos = inspectionPlanStaffV1InnerServiceSMOImpl.queryInspectionPlanStaffs(inspectionPlanStaffDto);
|
|
|
+
|
|
|
+ if (ListUtil.isNull(inspectionPlanStaffDtos)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<InspectionPlanStaffDto> staffDtos = null;
|
|
|
+ for (InspectionPlanDto inspectionPlanDto : inspectionPlans) {
|
|
|
+ staffDtos = new ArrayList<>();
|
|
|
+ for (InspectionPlanStaffDto tmpInspectionPlanStaffDto : inspectionPlanStaffDtos) {
|
|
|
+ if (inspectionPlanDto.getInspectionPlanId().equals(tmpInspectionPlanStaffDto.getInspectionPlanId())) {
|
|
|
+ staffDtos.add(tmpInspectionPlanStaffDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ inspectionPlanDto.setStaffs(staffDtos);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|