|  | @@ -0,0 +1,193 @@
 | 
	
		
			
				|  |  | +package com.ozs.web.controller.accountmanagment;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  | +import com.ozs.common.core.domain.AjaxResult;
 | 
	
		
			
				|  |  | +import com.ozs.common.utils.StringUtils;
 | 
	
		
			
				|  |  | +import com.ozs.common.utils.poi.ExcelUtil;
 | 
	
		
			
				|  |  | +import com.ozs.service.entity.BaseAccountManagement;
 | 
	
		
			
				|  |  | +import com.ozs.service.entity.vo.BaseAccountManagementVo;
 | 
	
		
			
				|  |  | +import com.ozs.service.service.BaseAccountManagementService;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | +import org.springframework.util.ObjectUtils;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.DeleteMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.PathVariable;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.PostMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.PutMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestBody;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | +import org.springframework.web.multipart.MultipartFile;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import javax.annotation.Resource;
 | 
	
		
			
				|  |  | +import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/**
 | 
	
		
			
				|  |  | + * <p>
 | 
	
		
			
				|  |  | + * 台账管理表 前端控制器
 | 
	
		
			
				|  |  | + * </p>
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * @author ozs
 | 
	
		
			
				|  |  | + * @since 2023-02-17
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +@RestController
 | 
	
		
			
				|  |  | +@RequestMapping("/service/baseAccountManagement")
 | 
	
		
			
				|  |  | +public class BaseAccountManagementController {
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    BaseAccountManagementService baseAccountManagementService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 相机台账管理分页
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param baseAccountManagementVo
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "相机台账管理分页")
 | 
	
		
			
				|  |  | +    @PostMapping("/list")
 | 
	
		
			
				|  |  | +    public AjaxResult selectHomeNotice(@RequestBody BaseAccountManagementVo baseAccountManagementVo) {
 | 
	
		
			
				|  |  | +        LambdaQueryWrapper<BaseAccountManagement> lw = new LambdaQueryWrapper<BaseAccountManagement>();
 | 
	
		
			
				|  |  | +        if (!StringUtils.isBlank(baseAccountManagementVo.getLine())) {
 | 
	
		
			
				|  |  | +            lw.eq(BaseAccountManagement::getLine, baseAccountManagementVo.getLine());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!StringUtils.isBlank(baseAccountManagementVo.getLineType())) {
 | 
	
		
			
				|  |  | +            lw.eq(BaseAccountManagement::getLineType, baseAccountManagementVo.getLineType());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!StringUtils.isBlank(baseAccountManagementVo.getPublicWorksSection())) {
 | 
	
		
			
				|  |  | +            lw.eq(BaseAccountManagement::getPublicWorksSection, baseAccountManagementVo.getPublicWorksSection());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!ObjectUtils.isEmpty(baseAccountManagementVo.getBeginMile())) {
 | 
	
		
			
				|  |  | +            lw.ge(BaseAccountManagement::getBeginMile, baseAccountManagementVo.getBeginMile());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!ObjectUtils.isEmpty(baseAccountManagementVo.getEndMile())) {
 | 
	
		
			
				|  |  | +            lw.le(BaseAccountManagement::getEndMile, baseAccountManagementVo.getEndMile());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        IPage<BaseAccountManagement> page = baseAccountManagementService.page(new Page<>(baseAccountManagementVo.getPageNum(), baseAccountManagementVo.getPageSize()), lw);
 | 
	
		
			
				|  |  | +        return AjaxResult.success(page);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 删除相机信息
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param accountManagementIds
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @DeleteMapping("/{accountManagementIds}")
 | 
	
		
			
				|  |  | +    @ApiOperation("删除相机信息")
 | 
	
		
			
				|  |  | +    public AjaxResult removeAccountManagement(@PathVariable List<Long> accountManagementIds) {
 | 
	
		
			
				|  |  | +        if (baseAccountManagementService.removeByIds(accountManagementIds)) {
 | 
	
		
			
				|  |  | +            return AjaxResult.success();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return AjaxResult.error();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 新增相机信息
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param baseAccountManagement
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PostMapping("/saveAccountManagement")
 | 
	
		
			
				|  |  | +    @ApiOperation("新增相机信息")
 | 
	
		
			
				|  |  | +    public AjaxResult saveDistributionModule(@RequestBody BaseAccountManagement baseAccountManagement) {
 | 
	
		
			
				|  |  | +        if (baseAccountManagementService.save(baseAccountManagement)) {
 | 
	
		
			
				|  |  | +            return AjaxResult.success();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return AjaxResult.error();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 修改相机信息
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param baseAccountManagement
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @PutMapping("/editAccountManagement")
 | 
	
		
			
				|  |  | +    @ApiOperation("修改相机信息")
 | 
	
		
			
				|  |  | +    public AjaxResult editAccountManagement(@RequestBody BaseAccountManagement baseAccountManagement) {
 | 
	
		
			
				|  |  | +        if (baseAccountManagementService.updateById(baseAccountManagement)) {
 | 
	
		
			
				|  |  | +            return AjaxResult.success();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return AjaxResult.error();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/{accountManagementId}")
 | 
	
		
			
				|  |  | +    @ApiOperation("根据相机ID获取详细信息")
 | 
	
		
			
				|  |  | +    public AjaxResult getInfo(@PathVariable Long accountManagementId) {
 | 
	
		
			
				|  |  | +        return AjaxResult.success(baseAccountManagementService.getById(accountManagementId));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 关联用户
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param accountManagementId
 | 
	
		
			
				|  |  | +     * @param roleId
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @GetMapping("/associatedUser/{accountManagementId}/{roleId}")
 | 
	
		
			
				|  |  | +    public AjaxResult associatedUser(@PathVariable Long accountManagementId, @PathVariable Long roleId) {
 | 
	
		
			
				|  |  | +        return baseAccountManagementService.associatedUser(accountManagementId, roleId);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 关联用户回显
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param accountManagementId
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @GetMapping("/getRoleId/{accountManagementId}")
 | 
	
		
			
				|  |  | +    public AjaxResult getRoleId(@PathVariable Long accountManagementId) {
 | 
	
		
			
				|  |  | +        return baseAccountManagementService.getRoleId(accountManagementId);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 台账管理导入
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param file
 | 
	
		
			
				|  |  | +     * @param updateSupport
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     * @throws Exception
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation("台账管理导入")
 | 
	
		
			
				|  |  | +    @PostMapping("/importBaseAccountManagement")
 | 
	
		
			
				|  |  | +    public AjaxResult importBaseAccountManagement(MultipartFile file, boolean updateSupport) throws Exception {
 | 
	
		
			
				|  |  | +        ExcelUtil<BaseAccountManagement> util = new ExcelUtil<BaseAccountManagement>(BaseAccountManagement.class);
 | 
	
		
			
				|  |  | +        List<BaseAccountManagement> AccountManageList = util.importExcel(file.getInputStream());
 | 
	
		
			
				|  |  | +        String message = baseAccountManagementService.importBaseAccountManagement(AccountManageList, updateSupport);
 | 
	
		
			
				|  |  | +        return AjaxResult.success(message);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 导出台账管理
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param response
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @ApiOperation("导出台账管理")
 | 
	
		
			
				|  |  | +    @PostMapping("/exportBaseAccountManagement")
 | 
	
		
			
				|  |  | +    public void exportBaseAccountManagement(HttpServletResponse response, @RequestBody BaseAccountManagementVo baseAccountManagementVo) {
 | 
	
		
			
				|  |  | +        LambdaQueryWrapper<BaseAccountManagement> lw = new LambdaQueryWrapper<BaseAccountManagement>();
 | 
	
		
			
				|  |  | +        if (!StringUtils.isBlank(baseAccountManagementVo.getLine())) {
 | 
	
		
			
				|  |  | +            lw.eq(BaseAccountManagement::getLine, baseAccountManagementVo.getLine());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!StringUtils.isBlank(baseAccountManagementVo.getLineType())) {
 | 
	
		
			
				|  |  | +            lw.eq(BaseAccountManagement::getLineType, baseAccountManagementVo.getLineType());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!StringUtils.isBlank(baseAccountManagementVo.getPublicWorksSection())) {
 | 
	
		
			
				|  |  | +            lw.eq(BaseAccountManagement::getPublicWorksSection, baseAccountManagementVo.getPublicWorksSection());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!ObjectUtils.isEmpty(baseAccountManagementVo.getBeginMile())) {
 | 
	
		
			
				|  |  | +            lw.ge(BaseAccountManagement::getBeginMile, baseAccountManagementVo.getBeginMile());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!ObjectUtils.isEmpty(baseAccountManagementVo.getEndMile())) {
 | 
	
		
			
				|  |  | +            lw.le(BaseAccountManagement::getEndMile, baseAccountManagementVo.getEndMile());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<BaseAccountManagement> list = baseAccountManagementService.list(lw);
 | 
	
		
			
				|  |  | +        ExcelUtil<BaseAccountManagement> util = new ExcelUtil<>(BaseAccountManagement.class);
 | 
	
		
			
				|  |  | +        util.exportExcel(response, list, "台账管理相机数据");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 |