检查计划,公共区域

This commit is contained in:
wenc000 2020-04-21 18:48:14 +08:00
parent cc47e8c518
commit bfe474f779
29 changed files with 2656 additions and 11 deletions

View File

@ -150,7 +150,8 @@ public class CheckController extends AbstractController {
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "checkMonth", value = "检查月份yyyy-MM", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheckofmine")

View File

@ -0,0 +1,139 @@
package com.cm.inspection.controller.apis.checkplan;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.component.SecurityComponent;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.CurrentUserIdInfoDTO;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.checkplan.CheckPlanDTO;
import com.cm.inspection.pojo.vos.checkplan.CheckPlanVO;
import com.cm.inspection.service.checkplan.ICheckPlanService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: CheckPlanController
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "检查计划接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/checkplan")
public class CheckPlanController extends AbstractController {
@Autowired
private ICheckPlanService checkPlanService;
@Autowired
private SecurityComponent securityComponent;
@ApiOperation(value = "新增检查计划", notes = "新增检查计划接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savecheckplan")
@CheckRequestBodyAnnotation
public SuccessResult saveCheckPlan(@RequestBody CheckPlanVO checkPlanVO) throws Exception {
return checkPlanService.saveCheckPlan(checkPlanVO);
}
@ApiOperation(value = "删除检查计划(id列表)", notes = "删除检查计划(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removecheckplan/{ids}")
public SuccessResult removeCheckPlan(@PathVariable("ids") String ids) throws RemoveException {
return checkPlanService.removeCheckPlan(ids);
}
@ApiOperation(value = "修改检查计划", notes = "修改检查计划接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "checkPlanId", value = "检查计划ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatecheckplan/{checkPlanId}")
@CheckRequestBodyAnnotation
public SuccessResult updateCheckPlan(@PathVariable("checkPlanId") String checkPlanId, @RequestBody CheckPlanVO checkPlanVO) throws Exception {
return checkPlanService.updateCheckPlan(checkPlanId, checkPlanVO);
}
@ApiOperation(value = "检查计划详情(通过ID)", notes = "检查计划详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "checkPlanId", value = "检查计划ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcheckplanbyid/{checkPlanId}")
public CheckPlanDTO getCheckPlanById(@PathVariable("checkPlanId") String checkPlanId) throws SearchException {
return checkPlanService.getCheckPlanById(checkPlanId);
}
@ApiOperation(value = "检查计划列表", notes = "检查计划列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcheckplan")
public List<CheckPlanDTO> listCheckPlan() throws SearchException {
Map<String, Object> params = requestParams();
return checkPlanService.listCheckPlan(params);
}
@ApiOperation(value = "检查计划分页列表", notes = "检查计划分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheckplan")
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlan(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return checkPlanService.listPageCheckPlan(page);
}
@ApiOperation(value = "我的检查计划分页列表", notes = "我的检查计划分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheckplanofmine")
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlanOfMine(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return checkPlanService.listPageCheckPlanOfMine(page);
}
@ApiOperation(value = "当前用户id信息", notes = "当前用户id信息接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcurrentuseridinfo")
public CurrentUserIdInfoDTO getCurrentUserIdInfo() {
return securityComponent.getCurrentUserIdInfo();
}
@ApiOperation(value = "统计我的本月计划完成", notes = "统计我的本月计划完成接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countcurrentmonthcheckplanofmine")
public SuccessResultData<Map<String, Object>> countCurrentMonthCheckPlanOfMine() {
return checkPlanService.countCurrentMonthCheckPlanOfMine();
}
}

View File

@ -0,0 +1,84 @@
package com.cm.inspection.controller.apis.count;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResultData;
import com.cm.inspection.service.check.ICheckService;
import com.cm.inspection.service.enterprise.IEnterpriseService;
import com.cm.inspection.service.gridpersonnel.IGridPersonnelService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* When you feel like quitting. Think about why you started
* 当你想要放弃的时候想想当初你为何开始
*
* @ClassName: CountController
* @Description: 统计
* @Author: WangGeng
* @Date: 2020/4/21 10:57
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "统计接口")
@RestController
@RequestMapping(ISystemConstant.API_PREFIX + "/count")
public class CountController extends AbstractController {
@Autowired
private IGridPersonnelService gridPersonnelService;
@Autowired
private IEnterpriseService enterpriseService;
@Autowired
private ICheckService checkService;
@ApiOperation(value = "统计网格员", notes = "统计网格员接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countgridpersonnel")
public SuccessResultData<Integer> countGridPersonnel() {
Map<String, Object> params = requestParams();
return gridPersonnelService.countGridPersonnel(params);
}
@ApiOperation(value = "统计企业", notes = "统计企业接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countenterprise")
public SuccessResultData<Integer> countEnterprise() {
Map<String, Object> params = requestParams();
return enterpriseService.countEnterprise(params);
}
@ApiOperation(value = "统计检查", notes = "统计检查接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "isComplete", value = "是否完成", paramType = "query", dataType = "Integer"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countcheck")
public SuccessResultData<Integer> countCheck() {
Map<String, Object> params = requestParams();
return checkService.countCheckInfo(params);
}
@ApiOperation(value = "检查图表(显示天数)", notes = "检查图表(显示天数)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countcheckechartbydays/{days}")
public SuccessResultData<Map<String, Object>> countCheckEChartByDays(@PathVariable("days") Integer days) {
Map<String, Object> params = requestParams();
return checkService.countCheckEChartByDays(days, params);
}
@ApiOperation(value = "企业统计(行业性质)", notes = "企业统计(行业性质)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countenterprisebynature")
public SuccessResultData<Map<String, Object>> countEnterpriseByNature() {
Map<String, Object> params = requestParams();
return enterpriseService.countEnterpriseByNature(params);
}
}

View File

@ -142,7 +142,9 @@ public class CheckAppController extends AbstractController {
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "checkMonth", value = "检查月份yyyy-MM", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "checkType", value = "检查类型1检查2复查", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheckofmine")

View File

@ -0,0 +1,139 @@
package com.cm.inspection.controller.app.apis.checkplan;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.checkplan.CheckPlanDTO;
import com.cm.inspection.pojo.vos.checkplan.CheckPlanVO;
import com.cm.inspection.service.checkplan.ICheckPlanService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: CheckPlanAppController
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "检查计划接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/checkplan")
public class CheckPlanAppController extends AbstractController {
@Autowired
private ICheckPlanService checkPlanService;
@ApiOperation(value = "新增检查计划", notes = "新增检查计划接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savecheckplan")
@CheckRequestBodyAnnotation
public SuccessResult saveCheckPlan(@RequestHeader("token") String token, @RequestBody CheckPlanVO checkPlanVO) throws Exception {
return checkPlanService.saveCheckPlanByToken(token, checkPlanVO);
}
@ApiOperation(value = "删除检查计划(id列表)", notes = "删除检查计划(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removecheckplan/{ids}")
public SuccessResult removeCheckPlan(@RequestHeader("token") String token, @PathVariable("ids") String ids) throws RemoveException {
return checkPlanService.removeCheckPlanByToken(token, ids);
}
@ApiOperation(value = "修改检查计划", notes = "修改检查计划接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "checkPlanId", value = "检查计划ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatecheckplan/{checkPlanId}")
@CheckRequestBodyAnnotation
public SuccessResult updateCheckPlan(@RequestHeader("token") String token, @PathVariable("checkPlanId") String checkPlanId, @RequestBody CheckPlanVO checkPlanVO) throws Exception {
return checkPlanService.updateCheckPlanByToken(token, checkPlanId, checkPlanVO);
}
@ApiOperation(value = "检查计划详情(通过ID)", notes = "检查计划详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "checkPlanId", value = "检查计划ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcheckplanbyid/{checkPlanId}")
public CheckPlanDTO getCheckPlanById(@RequestHeader("token") String token, @PathVariable("checkPlanId") String checkPlanId) throws SearchException {
return checkPlanService.getCheckPlanById(checkPlanId);
}
@ApiOperation(value = "检查计划列表", notes = "检查计划列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcheckplan")
public List<CheckPlanDTO> listCheckPlan(@RequestHeader("token") String token) throws SearchException {
Map<String, Object> params = requestParams();
return checkPlanService.listCheckPlan(params);
}
@ApiOperation(value = "我的检查计划分页列表", notes = "我的检查计划分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheckplanofmine")
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlanOfMine(@RequestHeader("token") String token, ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return checkPlanService.listPageCheckPlanOfMine(token, page);
}
@ApiOperation(value = "检查计划分页列表", notes = "检查计划分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheckplan")
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlan(@RequestHeader("token") String token, ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return checkPlanService.listPageCheckPlan(page);
}
@ApiOperation(value = "统计我的本月计划完成数量", notes = "统计我的本月计划完成数量接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countcurrentmonthcheckplanofmine")
public SuccessResultData<Map<String, Object>> countCurrentMonthCheckPlanOfMine(@RequestHeader("token") String token) {
return checkPlanService.countCurrentMonthCheckPlanOfMine(token);
}
}

View File

@ -0,0 +1,111 @@
package com.cm.inspection.controller.resources.checkplan;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.checkplan.CheckPlanDTO;
import com.cm.inspection.pojo.vos.checkplan.CheckPlanVO;
import com.cm.inspection.service.checkplan.ICheckPlanService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName: CheckPlanResourceController
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "检查计划接口")
@RestController
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/checkplan")
public class CheckPlanResourceController extends AbstractController {
@Autowired
private ICheckPlanService checkPlanService;
@ApiOperation(value = "新增检查计划", notes = "新增检查计划接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("savecheckplan")
@CheckRequestBodyAnnotation
public SuccessResult saveCheckPlan(@RequestBody CheckPlanVO checkPlanVO) throws Exception {
return checkPlanService.saveCheckPlan(checkPlanVO);
}
@ApiOperation(value = "删除检查计划(id列表)", notes = "删除检查计划(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("removecheckplan/{ids}")
public SuccessResult removeCheckPlan(@PathVariable("ids") String ids) throws RemoveException {
return checkPlanService.removeCheckPlan(ids);
}
@ApiOperation(value = "修改检查计划", notes = "修改检查计划接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "checkPlanId", value = "检查计划ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updatecheckplan/{checkPlanId}")
@CheckRequestBodyAnnotation
public SuccessResult updateCheckPlan(@PathVariable("checkPlanId") String checkPlanId, @RequestBody CheckPlanVO checkPlanVO) throws Exception {
return checkPlanService.updateCheckPlan(checkPlanId, checkPlanVO);
}
@ApiOperation(value = "检查计划详情(通过ID)", notes = "检查计划详情(通过ID)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "checkPlanId", value = "检查计划ID", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("getcheckplanbyid/{checkPlanId}")
public CheckPlanDTO getCheckPlanById(@PathVariable("checkPlanId") String checkPlanId) throws SearchException {
return checkPlanService.getCheckPlanById(checkPlanId);
}
@ApiOperation(value = "检查计划列表", notes = "检查计划列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcheckplan")
public List<CheckPlanDTO> listCheckPlan() throws SearchException {
Map<String, Object> params = requestParams();
return checkPlanService.listCheckPlan(params);
}
@ApiOperation(value = "检查计划分页列表", notes = "检查计划分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheckplan")
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlan(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
page.setParams(params);
return checkPlanService.listPageCheckPlan(page);
}
}

View File

@ -0,0 +1,66 @@
package com.cm.inspection.dao.checkplan;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.checkplan.CheckPlanDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @ClassName: ICheckPlanDao
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
@Repository
public interface ICheckPlanDao {
/**
* 新增检查计划
*
* @param params
* @throws SaveException
*/
void saveCheckPlan(Map<String, Object> params) throws SaveException;
/**
* 删除检查计划
*
* @param params
* @throws RemoveException
*/
void removeCheckPlan(Map<String, Object> params) throws RemoveException;
/**
* 修改检查计划
*
* @param params
* @throws UpdateException
*/
void updateCheckPlan(Map<String, Object> params) throws UpdateException;
/**
* 检查计划详情
*
* @param params
* @return
* @throws SearchException
*/
CheckPlanDTO getCheckPlan(Map<String, Object> params) throws SearchException;
/**
* 检查计划列表
*
* @param params
* @return
* @throws SearchException
*/
List<CheckPlanDTO> listCheckPlan(Map<String, Object> params) throws SearchException;
}

View File

@ -80,4 +80,11 @@ public interface IEnterpriseDao {
*/
List<EnterpriseDTO> listEnterprise(Map<String, Object> params) throws SearchException;
/**
*
* @param params
* @return
* @throws SearchException
*/
Integer countEnterprise(Map<String, Object> params) throws SearchException;
}

View File

@ -4,6 +4,7 @@ import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import org.springframework.stereotype.Repository;
@ -62,5 +63,13 @@ public interface IGridPersonnelDao {
* @throws SearchException
*/
List<GridPersonnelDTO> listGridPersonnel(Map<String, Object> params) throws SearchException;
/**
* 统计网格员
*
* @param params
* @return
* @throws SearchException
*/
Integer countGridPersonnel(Map<String, Object> params) throws SearchException;
}

View File

@ -0,0 +1,107 @@
package com.cm.inspection.pojo.dtos.checkplan;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: CheckPlanDTO
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
@ApiModel
public class CheckPlanDTO {
@ApiModelProperty(name = "checkPlanId", value = "主键")
private String checkPlanId;
@ApiModelProperty(name = "checkPlanType", value = "计划类型")
private Integer checkPlanType;
@ApiModelProperty(name = "checkPlanYear", value = "计划年份")
private Integer checkPlanYear;
@ApiModelProperty(name = "checkPlanMonth", value = "计划月份")
private Integer checkPlanMonth;
@ApiModelProperty(name = "checkPlanCount", value = "计划数量")
private Integer checkPlanCount;
@ApiModelProperty(name = "checkPlanUserName", value = "计划人员")
private String checkPlanUserName;
@ApiModelProperty(name = "checkCount", value = "检查数量")
private Integer checkCount;
public String getCheckPlanId() {
return checkPlanId == null ? "" : checkPlanId;
}
public void setCheckPlanId(String checkPlanId) {
this.checkPlanId = checkPlanId;
}
public Integer getCheckPlanType() {
return checkPlanType == null ? 0 : checkPlanType;
}
public void setCheckPlanType(Integer checkPlanType) {
this.checkPlanType = checkPlanType;
}
public Integer getCheckPlanYear() {
return checkPlanYear == null ? 0 : checkPlanYear;
}
public void setCheckPlanYear(Integer checkPlanYear) {
this.checkPlanYear = checkPlanYear;
}
public Integer getCheckPlanMonth() {
return checkPlanMonth == null ? 0 : checkPlanMonth;
}
public void setCheckPlanMonth(Integer checkPlanMonth) {
this.checkPlanMonth = checkPlanMonth;
}
public Integer getCheckPlanCount() {
return checkPlanCount == null ? 0 : checkPlanCount;
}
public void setCheckPlanCount(Integer checkPlanCount) {
this.checkPlanCount = checkPlanCount;
}
public String getCheckPlanUserName() {
return checkPlanUserName == null ? "" : checkPlanUserName;
}
public void setCheckPlanUserName(String checkPlanUserName) {
this.checkPlanUserName = checkPlanUserName;
}
public Integer getCheckCount() {
return checkCount;
}
public void setCheckCount(Integer checkCount) {
this.checkCount = checkCount;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"checkPlanId\":\"")
.append(checkPlanId).append('\"');
sb.append(",\"checkPlanType\":")
.append(checkPlanType);
sb.append(",\"checkPlanYear\":")
.append(checkPlanYear);
sb.append(",\"checkPlanMonth\":")
.append(checkPlanMonth);
sb.append(",\"checkPlanCount\":")
.append(checkPlanCount);
sb.append(",\"checkPlanUserName\":\"")
.append(checkPlanUserName).append('\"');
sb.append(",\"checkCount\":")
.append(checkCount);
sb.append('}');
return sb.toString();
}
}

View File

@ -0,0 +1,75 @@
package com.cm.inspection.pojo.vos.checkplan;
import com.cm.common.annotation.CheckEmptyAnnotation;
import com.cm.common.annotation.CheckNumberAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: CheckPlanVO
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
@ApiModel
public class CheckPlanVO {
@ApiModelProperty(name = "checkPlanType", value = "计划类型")
@CheckNumberAnnotation(name = "计划类型")
private Integer checkPlanType;
@ApiModelProperty(name = "checkPlanYear", value = "计划年份")
@CheckNumberAnnotation(name = "计划年份", min = 0)
private Integer checkPlanYear;
@ApiModelProperty(name = "checkPlanMonth", value = "计划月份")
@CheckNumberAnnotation(name = "计划月份", min = 0)
private Integer checkPlanMonth;
@ApiModelProperty(name = "checkPlanCount", value = "计划数量")
@CheckNumberAnnotation(name = "计划数量", min = 0)
private Integer checkPlanCount;
@ApiModelProperty(name = "checkPlanUserName", value = "计划人员")
private String checkPlanUserName;
public Integer getCheckPlanType() {
return checkPlanType == null ? 0 : checkPlanType;
}
public void setCheckPlanType(Integer checkPlanType) {
this.checkPlanType = checkPlanType;
}
public Integer getCheckPlanYear() {
return checkPlanYear == null ? 0 : checkPlanYear;
}
public void setCheckPlanYear(Integer checkPlanYear) {
this.checkPlanYear = checkPlanYear;
}
public Integer getCheckPlanMonth() {
return checkPlanMonth == null ? 0 : checkPlanMonth;
}
public void setCheckPlanMonth(Integer checkPlanMonth) {
this.checkPlanMonth = checkPlanMonth;
}
public Integer getCheckPlanCount() {
return checkPlanCount == null ? 0 : checkPlanCount;
}
public void setCheckPlanCount(Integer checkPlanCount) {
this.checkPlanCount = checkPlanCount;
}
public String getCheckPlanUserName() {
return checkPlanUserName == null ? "" : checkPlanUserName;
}
public void setCheckPlanUserName(String checkPlanUserName) {
this.checkPlanUserName = checkPlanUserName;
}
}

View File

@ -241,4 +241,32 @@ public interface ICheckService {
* @throws SearchException
*/
Integer countCheckByTaskCheckId(String taskCheckId) throws SearchException;
/**
* 统计检查
*
* @param params
* @return
* @throws SearchException
*/
SuccessResultData<Integer> countCheckInfo(Map<String, Object> params) throws SearchException;
/**
* 检查图表显示天数
*
* @param days
* @param params
* @return
* @throws SearchException
*/
SuccessResultData<Map<String, Object>> countCheckEChartByDays(Integer days, Map<String, Object> params) throws SearchException;
/**
* 统计检查
*
* @param params
* @return
* @throws SearchException
*/
Integer countCheck(Map<String, Object> params) throws SearchException;
}

View File

@ -8,6 +8,7 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.common.token.app.AppTokenManager;
import com.cm.common.utils.DateUtil;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.check.ICheckDao;
@ -36,6 +37,8 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.omg.CORBA.OBJ_ADAPTER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -613,6 +616,61 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
return checkDao.countCheck(params);
}
@Override
public SuccessResultData<Integer> countCheckInfo(Map<String, Object> params) throws SearchException {
params.put("checkType", 1);
Integer countResult = checkDao.countCheck(params);
return new SuccessResultData<>(countResult == null ? 0 : countResult);
}
@Override
public SuccessResultData<Map<String, Object>> countCheckEChartByDays(Integer days, Map<String, Object> params) throws SearchException {
DateTime now = DateTime.now();
DateTime[] dateTimeArray = new DateTime[days];
for (int i = days; i > 0; i--) {
dateTimeArray[days - i] = now.minusDays(i - 1);
}
// 日期数组
String[] dateArray = new String[dateTimeArray.length];
// 检查数量数组
Integer[] checkCountArray = new Integer[dateTimeArray.length];
// 不配合数组
Integer[] unCoordinationArray = new Integer[dateTimeArray.length];
// 完成数量
Integer[] completeArray = new Integer[dateTimeArray.length];
for (int i = 0; i < dateTimeArray.length; i++) {
DateTime dateTime = dateTimeArray[i];
// 日期
String checkDay = dateTime.toString(DateTimeFormat.forPattern("yyyy-MM-dd"));
dateArray[i] = checkDay;
// 检查数量
params.clear();
params.put("checkType", 1);
params.put("checkDay", checkDay);
Integer countCheck = checkDao.countCheck(params);
checkCountArray[i] = countCheck == null ? 0 : countCheck;
// 不配合数量
params.put("isCoordination", 0);
Integer countCoordination = checkDao.countCheck(params);
unCoordinationArray[i] = countCoordination == null ? 0 : countCoordination;
// 完成数量
params.put("isComplete", 1);
Integer completeCount = checkDao.countCheck(params);
completeArray[i] = completeCount == null ? 0 : completeCount;
}
Map<String, Object> result = getHashMap(4);
result.put("dateArray", dateArray);
result.put("checkCountArray", checkCountArray);
result.put("unCoordinationArray", unCoordinationArray);
result.put("completeArray", completeArray);
return new SuccessResultData<>(result);
}
@Override
public Integer countCheck(Map<String, Object> params) throws SearchException {
return checkDao.countCheck(params);
}
/**
* 获取用户ID
*

View File

@ -0,0 +1,146 @@
package com.cm.inspection.service.checkplan;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.checkplan.CheckPlanDTO;
import com.cm.inspection.pojo.vos.checkplan.CheckPlanVO;
import java.util.List;
import java.util.Map;
/**
* @ClassName: ICheckPlanService
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
public interface ICheckPlanService {
/**
* 新增检查计划
*
* @param checkPlanVO
* @return
* @throws Exception
*/
SuccessResult saveCheckPlan(CheckPlanVO checkPlanVO) throws Exception;
/**
* 新增检查计划(APP)
*
* @param token
* @param checkPlanVO
* @return
* @throws Exception
*/
SuccessResult saveCheckPlanByToken(String token, CheckPlanVO checkPlanVO) throws Exception;
/**
* 删除检查计划
*
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removeCheckPlan(String ids) throws RemoveException;
/**
* 删除检查计划(APP)
*
* @param token
* @param ids
* @return
* @throws RemoveException
*/
SuccessResult removeCheckPlanByToken(String token, String ids) throws RemoveException;
/**
* 修改检查计划
*
* @param checkPlanId
* @param checkPlanVO
* @return
* @throws Exception
*/
SuccessResult updateCheckPlan(String checkPlanId, CheckPlanVO checkPlanVO) throws Exception;
/**
* 修改检查计划(APP)
*
* @param token
* @param checkPlanId
* @param checkPlanVO
* @return
* @throws Exception
*/
SuccessResult updateCheckPlanByToken(String token, String checkPlanId, CheckPlanVO checkPlanVO) throws Exception;
/**
* 检查计划详情(通过ID)
*
* @param checkPlanId
* @return
* @throws SearchException
*/
CheckPlanDTO getCheckPlanById(String checkPlanId) throws SearchException;
/**
* 检查计划列表
*
* @param params
* @return
* @throws SearchException
*/
List<CheckPlanDTO> listCheckPlan(Map<String, Object> params) throws SearchException;
/**
* 检查计划分页列表
*
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<CheckPlanDTO>> listPageCheckPlan(ListPage page) throws SearchException;
/**
* 统计我的本月计划完成
*
* @return
* @throws SearchException
*/
SuccessResultData<Map<String, Object>> countCurrentMonthCheckPlanOfMine() throws SearchException;
/**
* 统计我的本月计划完成
*
* @param token
* @return
* @throws SearchException
*/
SuccessResultData<Map<String, Object>> countCurrentMonthCheckPlanOfMine(String token) throws SearchException;
/**
* 我的检查计划分页列表
*
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<CheckPlanDTO>> listPageCheckPlanOfMine(ListPage page) throws SearchException;
/**
* 我的检查计划分页列表
*
* @param token
* @param page
* @return
* @throws SearchException
*/
SuccessResultList<List<CheckPlanDTO>> listPageCheckPlanOfMine(String token, ListPage page) throws SearchException;
}

View File

@ -0,0 +1,238 @@
package com.cm.inspection.service.checkplan.impl;
import com.cm.common.exception.ParamsException;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.common.token.app.AppTokenManager;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.checkplan.ICheckPlanDao;
import com.cm.inspection.pojo.dtos.checkplan.CheckPlanDTO;
import com.cm.inspection.pojo.vos.checkplan.CheckPlanVO;
import com.cm.inspection.service.BaseService;
import com.cm.inspection.service.check.ICheckService;
import com.cm.inspection.service.checkplan.ICheckPlanService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @ClassName: CheckPlanServiceImpl
* @Description: 检查计划
* @Author: WenG
* @Date: 2020-04-21 10:36
* @Version: 1.0
**/
@Service
public class CheckPlanServiceImpl extends BaseService implements ICheckPlanService {
@Autowired
private ICheckPlanDao checkPlanDao;
@Autowired
private ICheckService checkService;
@Override
public SuccessResult saveCheckPlan(CheckPlanVO checkPlanVO) throws Exception {
saveCheckPlanInfo(null, checkPlanVO);
return new SuccessResult();
}
@Override
public SuccessResult saveCheckPlanByToken(String token, CheckPlanVO checkPlanVO) throws Exception {
saveCheckPlanInfo(token, checkPlanVO);
return new SuccessResult();
}
/**
* 新增检查计划
*
* @param token
* @param checkPlanVO
* @throws Exception
*/
private void saveCheckPlanInfo(String token, CheckPlanVO checkPlanVO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(checkPlanVO);
params.put("checkPlanId", UUIDUtil.getUUID());
if (token != null) {
params.put("checkPlanUserName", AppTokenManager.getInstance().getToken(token).getAppTokenUser().getName());
setSaveInfo(token, params);
} else {
params.put("checkPlanUserName", securityComponent.getCurrentUser().getUserName());
setSaveInfo(params);
}
if (isCheckPlanExist(checkPlanVO.getCheckPlanYear(), checkPlanVO.getCheckPlanMonth(), params.get("creator").toString())) {
throw new SaveException("计划存在,无需提交");
}
checkPlanDao.saveCheckPlan(params);
}
/**
* 检查计划是否存在
*
* @param checkPlanYear
* @param checkPlanMonth
* @param userId
* @return
*/
private boolean isCheckPlanExist(Integer checkPlanYear, Integer checkPlanMonth, String userId) {
Map<String, Object> params = getHashMap(3);
params.put("checkPlanYear", checkPlanYear);
params.put("checkPlanMonth", checkPlanMonth);
params.put("creator", userId);
CheckPlanDTO checkPlanDTO = checkPlanDao.getCheckPlan(params);
if (checkPlanDTO != null) {
return true;
}
return false;
}
@Override
public SuccessResult removeCheckPlan(String ids) throws RemoveException {
removeCheckPlanInfo(null, ids);
return new SuccessResult();
}
@Override
public SuccessResult removeCheckPlanByToken(String token, String ids) throws RemoveException {
removeCheckPlanInfo(token, ids);
return new SuccessResult();
}
/**
* 删除检查计划
*
* @param token
* @param ids
*/
private void removeCheckPlanInfo(String token, String ids) {
Map<String, Object> params = getHashMap(3);
params.put("checkPlanIds", Arrays.asList(ids.split("_")));
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
checkPlanDao.removeCheckPlan(params);
}
@Override
public SuccessResult updateCheckPlan(String checkPlanId, CheckPlanVO checkPlanVO) throws Exception {
updateCheckPlanInfo(null, checkPlanId, checkPlanVO);
return new SuccessResult();
}
@Override
public SuccessResult updateCheckPlanByToken(String token, String checkPlanId, CheckPlanVO checkPlanVO) throws Exception {
updateCheckPlanInfo(token, checkPlanId, checkPlanVO);
return new SuccessResult();
}
/**
* 修改检查计划
*
* @param token
* @param checkPlanId
* @param checkPlanVO
*/
private void updateCheckPlanInfo(String token, String checkPlanId, CheckPlanVO checkPlanVO) throws Exception {
Map<String, Object> params = HashMapUtil.beanToMap(checkPlanVO);
params.put("checkPlanId", checkPlanId);
if (token != null) {
setUpdateInfo(token, params);
} else {
setUpdateInfo(params);
}
checkPlanDao.updateCheckPlan(params);
}
@Override
public CheckPlanDTO getCheckPlanById(String checkPlanId) throws SearchException {
Map<String, Object> params = super.getHashMap(1);
params.put("checkPlanId", checkPlanId);
return checkPlanDao.getCheckPlan(params);
}
@Override
public List<CheckPlanDTO> listCheckPlan(Map<String, Object> params) throws SearchException {
return checkPlanDao.listCheckPlan(params);
}
@Override
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlan(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows());
List<CheckPlanDTO> checkPlanDTOs = checkPlanDao.listCheckPlan(page.getParams());
PageInfo<CheckPlanDTO> pageInfo = new PageInfo<>(checkPlanDTOs);
return new SuccessResultList<>(checkPlanDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlanOfMine(ListPage page) throws SearchException {
return listPageCheckPlanOfMine(null, page);
}
@Override
public SuccessResultList<List<CheckPlanDTO>> listPageCheckPlanOfMine(String token, ListPage page) throws SearchException {
String creator;
if (StringUtils.isBlank(token)) {
creator = securityComponent.getCurrentUser().getUserId();
} else {
creator = AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId();
}
page.getParams().put("creator", creator);
PageHelper.startPage(page.getPage(), page.getRows());
List<CheckPlanDTO> checkPlanDTOs = checkPlanDao.listCheckPlan(page.getParams());
PageInfo<CheckPlanDTO> pageInfo = new PageInfo<>(checkPlanDTOs);
Map<String, Object> params = page.getParams();
for (CheckPlanDTO checkPlanDTO : checkPlanDTOs) {
params.put("checkMonth", String.format("%d-%02d", checkPlanDTO.getCheckPlanYear(), checkPlanDTO.getCheckPlanMonth()));
params.put("checkType", 1);
params.put("creator", creator);
Integer checkPlanCount = checkService.countCheck(params);
checkPlanDTO.setCheckCount(checkPlanCount == null ? 0 : checkPlanCount);
}
return new SuccessResultList<>(checkPlanDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public SuccessResultData<Map<String, Object>> countCurrentMonthCheckPlanOfMine() throws SearchException {
return countCurrentMonthCheckPlanOfMine(null);
}
@Override
public SuccessResultData<Map<String, Object>> countCurrentMonthCheckPlanOfMine(String token) throws SearchException {
DateTime now = DateTime.now();
Map<String, Object> params = getHashMap(1);
params.put("checkPlanYear", now.getYear());
params.put("checkPlanMonth", now.getMonthOfYear());
if (!StringUtils.isBlank(token)) {
params.put("creator", AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId());
} else {
params.put("creator", securityComponent.getCurrentUser().getUserId());
}
// 计划检查数量
Integer checkPlanCount = 0;
CheckPlanDTO checkPlanDTO = checkPlanDao.getCheckPlan(params);
if (checkPlanDTO != null) {
checkPlanCount = checkPlanDTO.getCheckPlanCount();
}
// 已完成的检查
params.put("checkType", 1);
params.put("checkMonth", String.format("%d-%02d", now.getYear(), now.getMonthOfYear()));
Integer countCheck = checkService.countCheck(params);
// 封装结果
Map<String, Object> result = getHashMap(1);
result.put("checkPlanCount", checkPlanCount);
result.put("countCheck", countCheck);
return new SuccessResultData<>(result);
}
}

View File

@ -138,4 +138,21 @@ public interface IEnterpriseService {
*/
SuccessResultList<List<EnterpriseDTO>> listPageEnterprise(ListPage page) throws SearchException;
/**
* 统计企业
*
* @param params
* @return
* @throws SearchException
*/
SuccessResultData<Integer> countEnterprise(Map<String, Object> params) throws SearchException;
/**
* 企业统计行业性质
*
* @param params
* @return
* @throws SearchException
*/
SuccessResultData<Map<String, Object>> countEnterpriseByNature(Map<String, Object> params) throws SearchException;
}

View File

@ -4,9 +4,11 @@ import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.dtos.datadictionary.DataDictionaryDTO;
import com.cm.common.plugin.service.datadictionary.IDataDictionaryService;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
@ -254,4 +256,31 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
return new SuccessResultList<>(enterpriseDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public SuccessResultData<Integer> countEnterprise(Map<String, Object> params) throws SearchException {
params.put("isLogOff", 0);
Integer countResult = enterpriseDao.countEnterprise(params);
return new SuccessResultData<>(countResult == null ? 0 : countResult);
}
@Override
public SuccessResultData<Map<String, Object>> countEnterpriseByNature(Map<String, Object> params) throws SearchException {
List<DataDictionaryDTO> dataDictionaryDTOs = dataDictionaryService.listDictionaryByParentId("54c583df-6a6f-4a55-bcb3-2d6ace99b8ef");
List<String> natureNameList = new ArrayList<>();
List<Map<String, Object>> dataArray = new ArrayList<>();
for (DataDictionaryDTO dataDictionaryDTO : dataDictionaryDTOs) {
natureNameList.add(dataDictionaryDTO.getDictionaryName());
params.put("nature", dataDictionaryDTO.getDictionaryId());
Integer countResult = enterpriseDao.countEnterprise(params);
// 数据
Map<String, Object> data = getHashMap(2);
data.put("name", dataDictionaryDTO.getDictionaryName());
data.put("value", countResult == null ? 0 : countResult);
dataArray.add(data);
}
Map<String, Object> result = getHashMap(2);
result.put("dataNames", natureNameList);
result.put("datas", dataArray);
return new SuccessResultData<>(result);
}
}

View File

@ -118,4 +118,13 @@ public interface IGridPersonnelService {
*/
List<GridPersonnelDTO> listGridPersonnelByUserIdAndIsGridOperator(String userId, int isGridOperator) throws SearchException;
/**
* 网格员数量
*
* @param params
* @return
* @throws SearchException
*/
SuccessResultData<Integer> countGridPersonnel(Map<String, Object> params) throws SearchException;
}

View File

@ -5,6 +5,7 @@ import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
@ -150,4 +151,11 @@ public class GridPersonnelServiceImpl extends BaseService implements IGridPerson
return listGridPersonnel(params);
}
@Override
public SuccessResultData<Integer> countGridPersonnel(Map<String, Object> params) throws SearchException {
params.put("isGridOperator", 1);
Integer countResult = gridPersonnelDao.countGridPersonnel(params);
return new SuccessResultData<>(countResult == null ? 0 : countResult);
}
}

View File

@ -290,6 +290,10 @@
AND
t1.creator = #{creator}
</if>
<if test="checkMonth != null">
AND
LEFT(t1.gmt_create, 7) = #{checkMonth}
</if>
ORDER BY
t1.gmt_create DESC
</select>
@ -310,6 +314,26 @@
AND
task_check_id = #{taskCheckId}
</if>
<if test="isComplete != null">
AND
is_complete = #{isComplete}
</if>
<if test="checkType != null">
AND
check_type = #{checkType}
</if>
<if test="isCoordination != null">
AND
is_coordination = #{isCoordination}
</if>
<if test="checkDay != null and checkDay != ''">
AND
LEFT(gmt_create, 10) = #{checkDay}
</if>
<if test="checkMonth != null and checkMonth != ''">
AND
LEFT(gmt_create, 7) = #{checkMonth}
</if>
</select>
</mapper>

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cm.inspection.dao.checkplan.ICheckPlanDao">
<resultMap id="checkPlanDTO" type="com.cm.inspection.pojo.dtos.checkplan.CheckPlanDTO">
<id column="check_plan_id" property="checkPlanId"/>
<result column="check_plan_type" property="checkPlanType"/>
<result column="check_plan_year" property="checkPlanYear"/>
<result column="check_plan_month" property="checkPlanMonth"/>
<result column="check_plan_count" property="checkPlanCount"/>
<result column="check_plan_user_name" property="checkPlanUserName"/>
</resultMap>
<!-- 新增检查计划 -->
<insert id="saveCheckPlan" parameterType="map">
INSERT INTO gen_check_plan(
check_plan_id,
check_plan_type,
check_plan_year,
check_plan_month,
check_plan_count,
check_plan_user_name,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{checkPlanId},
#{checkPlanType},
#{checkPlanYear},
#{checkPlanMonth},
#{checkPlanCount},
#{checkPlanUserName},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除检查计划 -->
<update id="removeCheckPlan" parameterType="map">
UPDATE
gen_check_plan
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
check_plan_id IN
<foreach collection="checkPlanIds" index="index" open="(" separator="," close=")">
#{checkPlanIds[${index}]}
</foreach>
</update>
<!-- 修改检查计划 -->
<update id="updateCheckPlan" parameterType="map">
UPDATE
gen_check_plan
SET
<if test="checkPlanType != null">
check_plan_type = #{checkPlanType},
</if>
<if test="checkPlanYear != null">
check_plan_year = #{checkPlanYear},
</if>
<if test="checkPlanMonth != null">
check_plan_month = #{checkPlanMonth},
</if>
<if test="checkPlanCount != null">
check_plan_count = #{checkPlanCount},
</if>
<if test="checkPlanUserName != null and checkPlanUserName != ''">
check_plan_user_name = #{checkPlanUserName},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
check_plan_id = #{checkPlanId}
</update>
<!-- 检查计划详情 -->
<select id="getCheckPlan" parameterType="map" resultMap="checkPlanDTO">
SELECT
t1.check_plan_type,
t1.check_plan_year,
t1.check_plan_month,
t1.check_plan_count,
t1.check_plan_id
FROM
gen_check_plan t1
WHERE
t1.is_delete = 0
<if test="checkPlanId != null and checkPlanId != ''">
AND
t1.check_plan_id = #{checkPlanId}
</if>
<if test="checkPlanYear != null">
AND
t1.check_plan_year = #{checkPlanYear}
</if>
<if test="checkPlanMonth != null">
AND
t1.check_plan_month = #{checkPlanMonth}
</if>
<if test="creator != null and creator != ''">
AND
t1.creator = #{creator}
</if>
</select>
<!-- 检查计划列表 -->
<select id="listCheckPlan" parameterType="map" resultMap="checkPlanDTO">
SELECT
t1.check_plan_type,
t1.check_plan_year,
t1.check_plan_month,
t1.check_plan_count,
t1.check_plan_user_name,
t1.check_plan_id
FROM
gen_check_plan t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
<!-- 这里添加检索关键字 -->
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="checkPlanIds != null and checkPlanIds.size > 0">
AND
t1.check_plan_id IN
<foreach collection="checkPlanIds" index="index" open="(" separator="," close=")">
#{checkPlanIds[${index}]}
</foreach>
</if>
<if test="creator != null and creator != ''">
AND
t1.creator = #{creator}
</if>
ORDER BY
t1.check_plan_year DESC, t1.check_plan_month DESC
</select>
</mapper>

View File

@ -433,5 +433,23 @@
</if>
</select>
<!-- 统计企业 -->
<select id="countEnterprise" parameterType="map" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
gen_enterprise
WHERE
is_delete = 0
<if test="isLogOff != null">
AND
is_log_off = #{isLogOff}
</if>
<if test="nature != null and nature != ''">
AND
nature = #{nature}
</if>
</select>
</mapper>

View File

@ -246,4 +246,18 @@
t1.level ASC
</select>
<!-- 统计网格员 -->
<select id="countGridPersonnel" parameterType="map" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
gen_grid_personnel
WHERE
is_delete = 0
<if test="isGridOperator != null">
AND
is_grid_operator = #{isGridOperator}
</if>
</select>
</mapper>

File diff suppressed because one or more lines are too long

View File

@ -5,32 +5,286 @@
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div id="LAY-app" class="layui-fluid">
<div class="layui-row layui-col-space15"></div>
<div class="layui-row layui-col-space15">
<div class="layui-col-sm6 layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">
网格员数量
<span class="layui-badge layui-bg-blue layuiadmin-badge"></span>
</div>
<div class="layui-card-body layuiadmin-card-list">
<p id="gridPersonnelCount" class="layuiadmin-big-font">0</p>
</div>
</div>
</div>
<div class="layui-col-sm6 layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">
企业数量
<span class="layui-badge layui-bg-orange layuiadmin-badge"></span>
</div>
<div class="layui-card-body layuiadmin-card-list">
<p id="enterpriseCount" class="layuiadmin-big-font">0</p>
</div>
</div>
</div>
<div class="layui-col-sm6 layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">
检查数量
<span class="layui-badge layui-bg-cyan layuiadmin-badge"></span>
</div>
<div class="layui-card-body layuiadmin-card-list">
<p id="checkCount" class="layuiadmin-big-font">0</p>
</div>
</div>
</div>
<div class="layui-col-sm6 layui-col-md3">
<div class="layui-card">
<div class="layui-card-header">
检查完成数量
<span class="layui-badge layui-bg-green layuiadmin-badge"></span>
</div>
<div class="layui-card-body layuiadmin-card-list">
<p id="checkCompleteCount" class="layuiadmin-big-font">0</p>
</div>
</div>
</div>
<div class="layui-col-sm12">
<div class="layui-row layui-col-space15">
<div class="layui-col-sm12">
<div class="layui-card">
<div class="layui-card-body">
<div id="checkEChart" style="width: 100%; height: 500px;"></div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-sm12">
<div class="layui-row layui-col-space15">
<div class="layui-col-sm12">
<div class="layui-card">
<div class="layui-card-body">
<div id="enterpriseByNatureEChart" style="width: 100%; height: 500px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="assets/js/vue.min.js"></script>
<script type="text/javascript" src="assets/js/vendor/echarts/echarts.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'animate-numbers'], function() {
index: 'lib/index', //主入口模块
}).use(['index', 'animate-numbers'], function () {
var $ = layui.$;
new Vue({
el: '#LAY-app',
data: {},
methods: {},
mounted: function() {
data: {
gridPersonnelCount: 0,
enterpriseCount: 0,
checkCount: 0,
checkCompleteCount: 0
},
methods: {
countGridPersonnel: function() {
var self = this;
top.restAjax.get('api/count/countgridpersonnel', {}, null, function(code, data) {
self.gridPersonnelCount = data.data;
self.$nextTick(function() {
$('#gridPersonnelCount').animateNumbers(self.gridPersonnelCount);
});
}, function(code, data) {
top.dialog.msg(data.msg);
});
},
countEnterprise: function() {
var self = this;
top.restAjax.get('api/count/countenterprise', {}, null, function(code, data) {
self.enterpriseCount = data.data;
self.$nextTick(function() {
$('#enterpriseCount').animateNumbers(self.enterpriseCount);
});
}, function(code, data) {
top.dialog.msg(data.msg);
});
},
countCheck: function() {
var self = this;
top.restAjax.get('api/count/countcheck', {}, null, function(code, data) {
self.checkCount = data.data;
self.$nextTick(function() {
$('#checkCount').animateNumbers(self.checkCount);
});
}, function(code, data) {
top.dialog.msg(data.msg);
});
},
countCheckComplete: function() {
var self = this;
top.restAjax.get('api/count/countcheck', {
isComplete: 1
}, null, function(code, data) {
self.checkCompleteCount = data.data;
self.$nextTick(function() {
$('#checkCompleteCount').animateNumbers(self.checkCompleteCount);
});
}, function(code, data) {
top.dialog.msg(data.msg);
});
},
initCheckEChart: function() {
var self = this;
top.restAjax.get('api/count/countcheckechartbydays/10', {}, null, function(code, data) {
var echart = echarts.init(document.getElementById('checkEChart'));
echart.setOption({
title: {
text: '近期检查情况'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
show: true,
},
legend: {
data: ['检查数', '不配合数', '完成数']
},
xAxis: {
type: 'category',
data: data.data.dateArray,
splitLine: {
show: true,
lineStyle: {
type: 'dashed'
}
}
},
yAxis: {
type: 'value'
},
series: [{
name: '检查数',
data: data.data.checkCountArray,
type: 'line',
smooth: true,
stack: '总数',
areaStyle: {},
}, {
name: '不配合数',
data: data.data.unCoordinationArray,
type: 'line',
smooth: true,
stack: '总数',
areaStyle: {},
}, {
name: '完成数',
data: data.data.completeArray,
type: 'line',
smooth: true,
stack: '总数',
areaStyle: {},
}]
});
}, function(code, data) {
top.dialog.msg(data.msg);
});
},
initEnterpriseByNature() {
var self = this;
top.restAjax.get('api/count/countenterprisebynature', {}, null, function(code, data) {
var echart = echarts.init(document.getElementById('enterpriseByNatureEChart'));
echart.setOption({
title: {
text: '企业数量占比',
subtext: '按行业性质统计',
left: 'left'
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
legend: {
orient: 'vertical',
right: 10,
data: data.data.dataNames
},
series: [{
name: '企业数量',
type: 'pie',
radius: '80%',
center: ['40%', '50%'],
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}}{c} {per|{d}%} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
rich: {
a: {
color: '#999',
lineHeight: 20,
align: 'center'
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5,
height: 0
},
b: {
fontSize: 13,
lineHeight: 22
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2, 4],
borderRadius: 2
}
}
},
data: data.data.datas
}]
});
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
},
mounted: function () {
var self = this;
self.countGridPersonnel();
self.countEnterprise();
self.countCheck();
self.countCheckComplete();
self.initCheckEChart();
self.initEnterpriseByNature();
}
})
});

View File

@ -0,0 +1,259 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
</div>
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/checkplan/listpagecheckplanofmine';
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'checkPlanType', width: 150, title: '计划类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanYear', width: 150, title: '计划年份', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanMonth', width: 150, title: '计划月份', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanCount', width: 100, title: '计划数量', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanUserName', width: 150, title: '计划人员', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, []),
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
},
page: {
curr: currentPage
},
height: $win.height() - 90,
});
}
// 初始化日期
function initDate() {
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd'
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/checkplan/removecheckplan/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
initDate();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/checkplan/save-checkplan.html', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/checkplan/update-checkplan.html?checkPlanId={checkPlanId}', [checkDatas[0].checkPlanId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['checkPlanId'];
}
removeData(ids);
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,256 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
</div>
<div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
</div>
<div class="layui-inline">
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
}).extend({
index: 'lib/index'
}).use(['index', 'table', 'laydate', 'common'], function() {
var $ = layui.$;
var $win = $(window);
var table = layui.table;
var admin = layui.admin;
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/checkplan/listpagecheckplan';
// 初始化表格
function initTable() {
table.render({
elem: '#dataTable',
id: 'dataTable',
url: top.restAjax.path(tableUrl, []),
width: admin.screen() > 1 ? '100%' : '',
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'checkPlanType', width: 150, title: '计划类型', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanYear', width: 150, title: '计划年份', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanMonth', width: 150, title: '计划月份', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanCount', width: 100, title: '计划数量', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'checkPlanUserName', width: 150, title: '计划人员', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
]],
page: true,
parseData: function(data) {
return {
'code': 0,
'msg': '',
'count': data.total,
'data': data.rows
};
}
});
}
// 重载表格
function reloadTable(currentPage) {
table.reload('dataTable', {
url: top.restAjax.path(tableUrl, []),
where: {
keywords: $('#keywords').val(),
startTime: $('#startTime').val(),
endTime: $('#endTime').val()
},
page: {
curr: currentPage
},
height: $win.height() - 90,
});
}
// 初始化日期
function initDate() {
// 日期选择
laydate.render({
elem: '#startTime',
format: 'yyyy-MM-dd'
});
laydate.render({
elem: '#endTime',
format: 'yyyy-MM-dd'
});
}
// 删除
function removeData(ids) {
top.dialog.msg(top.dataMessage.delete, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
var layIndex;
top.restAjax.delete(top.restAjax.path('api/checkplan/removecheckplan/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
reloadTable();
}, function (code, data) {
top.dialog.msg(data.msg);
}, function () {
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
}, function () {
top.dialog.close(layIndex);
});
}
});
}
initTable();
initDate();
// 事件 - 页面变化
$win.on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(function() {
reloadTable();
}, 500);
});
// 事件 - 搜索
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/checkplan/save-checkplan.html', []),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/checkplan/update-checkplan.html?checkPlanId={checkPlanId}', [checkDatas[0].checkPlanId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['checkPlanId'];
}
removeData(ids);
}
}
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,182 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>新增内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item" pane>
<label class="layui-form-label">计划类型</label>
<div class="layui-input-block">
<input type="radio" name="checkPlanType" value="1" title="月计划" checked>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计划年份</label>
<div class="layui-input-block">
<input type="number" id="checkPlanYear" name="checkPlanYear" class="layui-input" value="2020" placeholder="请输入计划年份" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计划月份</label>
<div class="layui-input-block">
<input type="number" id="checkPlanMonth" name="checkPlanMonth" class="layui-input" value="1" placeholder="请输入计划月份" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计划数量</label>
<div class="layui-input-block">
<input type="number" id="checkPlanCount" name="checkPlanCount" class="layui-input" value="0" placeholder="请输入计划数量" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
document.getElementById(fileName +'FileBox').innerHTML = html;
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/downloadfile/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
}
// 初始化内容
function initData() {
top.restAjax.get(top.restAjax.path('api/checkplan/getcurrentuseridinfo', []), {}, null, function(code, data) {
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/checkplan/savecheckplan', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,191 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">计划类型</label>
<div class="layui-input-block">
<input type="number" id="checkPlanType" name="checkPlanType" class="layui-input" value="1" placeholder="请输入计划类型" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计划年份</label>
<div class="layui-input-block">
<input type="number" id="checkPlanYear" name="checkPlanYear" class="layui-input" value="2020" placeholder="请输入计划年份" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计划月份</label>
<div class="layui-input-block">
<input type="number" id="checkPlanMonth" name="checkPlanMonth" class="layui-input" value="1" placeholder="请输入计划月份" lay-verify="required">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">计划数量</label>
<div class="layui-input-block">
<input type="number" id="checkPlanCount" name="checkPlanCount" class="layui-input" value="0" placeholder="请输入计划数量" lay-verify="required">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交编辑</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var checkPlanId = top.restAjax.params(window.location.href).checkPlanId;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
laytpl(document.getElementById(fileName +'FileDownload').innerHTML).render(dataRander, function(html) {
document.getElementById(fileName +'FileBox').innerHTML = html;
});
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化视频
function initVideo(fileName, data) {
for(var i = 0, item; item = data[i++];) {
var player = new ckplayer({
container: '#'+ fileName + i,
variable: 'player',
flashplayer: false,
video: {
file: 'route/file/downloadfile/true/'+ item.fileId,
type: 'video/mp4'
}
});
}
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/checkplan/getcheckplanbyid/{checkPlanId}', [checkPlanId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i];
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/checkplan/updatecheckplan/{checkPlanId}', [checkPlanId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
});
</script>
</body>
</html>