Merge branch 'dev_New_pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New_pro
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.annotation.Resource; |
| | |
| | | @RestController |
| | | @RequestMapping("/account/accountExpense") |
| | | @Tag(name = "财务管理--支出管理") |
| | | public class AccountExpenseController { |
| | | public class AccountExpenseController extends BaseController { |
| | | |
| | | @Resource |
| | | private AccountExpenseService accountExpenseService; |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody AccountExpense accountExpense) { |
| | | public R<?> add(@RequestBody AccountExpense accountExpense) { |
| | | accountExpense.setInputTime(new Date()); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | accountExpense.setInputUser(loginUser.getNickName()); |
| | | return AjaxResult.success(accountExpenseService.save(accountExpense)); |
| | | return R.ok(accountExpenseService.save(accountExpense)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验单 |
| | | return AjaxResult.success(accountExpenseService.removeBatchByIds(ids)); |
| | | return R.ok(accountExpenseService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody AccountExpense accountExpense) { |
| | | return AjaxResult.success(accountExpenseService.updateById(accountExpense)); |
| | | public R<?> update(@RequestBody AccountExpense accountExpense) { |
| | | return R.ok(accountExpenseService.updateById(accountExpense)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult accountExpenseListPage(Page page, AccountExpense accountExpense) { |
| | | return AjaxResult.success(accountExpenseService.accountExpenseListPage(page, accountExpense)); |
| | | public R<?> accountExpenseListPage(Page page, AccountExpense accountExpense) { |
| | | return R.ok(accountExpenseService.accountExpenseListPage(page, accountExpense)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @Operation(summary = "详情") |
| | | public AjaxResult accountExpenseDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(accountExpenseService.getById(id)); |
| | | public R<?> accountExpenseDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(accountExpenseService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/forms") |
| | | @Operation(summary = "财务报表图表查询") |
| | | public AjaxResult report(DateQueryDto dateQueryDto) { |
| | | return AjaxResult.success(accountExpenseService.report(dateQueryDto)); |
| | | public R<?> report(DateQueryDto dateQueryDto) { |
| | | return R.ok(accountExpenseService.report(dateQueryDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/analysis") |
| | | @Operation(summary = "财务报表-财务分析") |
| | | public AjaxResult analysis() { |
| | | return AjaxResult.success(accountExpenseService.analysis()); |
| | | public R<?> analysis() { |
| | | return R.ok(accountExpenseService.analysis()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/income") |
| | | @Operation(summary = "财务报表图表收入年度查询") |
| | | public AjaxResult reportIncome(ReportDateDto reportDateDto) { |
| | | return AjaxResult.success(accountIncomeService.reportIncome(reportDateDto)); |
| | | public R<?> reportIncome(ReportDateDto reportDateDto) { |
| | | return R.ok(accountIncomeService.reportIncome(reportDateDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/report/expense") |
| | | @Operation(summary = "财务报表图表支出年度查询") |
| | | public AjaxResult reportExpense(ReportDateDto reportDateDto) { |
| | | return AjaxResult.success(accountExpenseService.reportExpense(reportDateDto)); |
| | | public R<?> reportExpense(ReportDateDto reportDateDto) { |
| | | return R.ok(accountExpenseService.reportExpense(reportDateDto)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.AccountFile; |
| | | import com.ruoyi.account.service.AccountFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/account/accountFile") |
| | | @Tag(name = "财务附件") |
| | | public class AccountFileController { |
| | | public class AccountFileController extends BaseController { |
| | | |
| | | |
| | | @Resource |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody AccountFile accountFile) { |
| | | return AjaxResult.success(accountFileService.save(accountFile)); |
| | | public R<?> add(@RequestBody AccountFile accountFile) { |
| | | return R.ok(accountFileService.save(accountFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delAccountFile(@RequestBody List<Integer> ids) { |
| | | public R<?> delAccountFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验附件 |
| | | return AjaxResult.success(accountFileService.removeBatchByIds(ids)); |
| | | return R.ok(accountFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult accountFileListPage(Page page, AccountFile accountFile) { |
| | | return AjaxResult.success(accountFileService.accountFileListPage(page, accountFile)); |
| | | public R<?> accountFileListPage(Page page, AccountFile accountFile) { |
| | | return R.ok(accountFileService.accountFileListPage(page, accountFile)); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountFileService; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import com.ruoyi.quality.service.IQualityInspectParamService; |
| | | import com.ruoyi.quality.service.IQualityInspectService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/account/accountIncome") |
| | | @Tag(name = "财务管理--收入管理") |
| | | public class AccountIncomeController { |
| | | public class AccountIncomeController extends BaseController { |
| | | |
| | | @Resource |
| | | private AccountIncomeService accountIncomeService; |
| | |
| | | */ |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody AccountIncome accountIncome) { |
| | | public R<?> add(@RequestBody AccountIncome accountIncome) { |
| | | accountIncome.setInputTime(new Date()); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | accountIncome.setInputUser(loginUser.getNickName()); |
| | | return AjaxResult.success(accountIncomeService.save(accountIncome)); |
| | | return R.ok(accountIncomeService.save(accountIncome)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验单 |
| | | return AjaxResult.success(accountIncomeService.removeBatchByIds(ids)); |
| | | return R.ok(accountIncomeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody AccountIncome accountIncome) { |
| | | return AjaxResult.success(accountIncomeService.updateById(accountIncome)); |
| | | public R<?> update(@RequestBody AccountIncome accountIncome) { |
| | | return R.ok(accountIncomeService.updateById(accountIncome)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | return AjaxResult.success(accountIncomeService.accountIncomeListPage(page, accountIncome)); |
| | | public R<?> accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | return R.ok(accountIncomeService.accountIncomeListPage(page, accountIncome)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @Operation(summary = "详情") |
| | | public AjaxResult accountIncomeDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(accountIncomeService.getById(id)); |
| | | public R<?> accountIncomeDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(accountIncomeService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.service.impl.AccountingServiceImpl; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | |
| | | @Operation(summary = "总计") |
| | | @GetMapping("/total") |
| | | public AjaxResult total(@RequestParam Integer year) { |
| | | public R<?> total(@RequestParam Integer year) { |
| | | return accountingService.total(year); |
| | | } |
| | | |
| | | @Operation(summary = "设备类型分布") |
| | | @GetMapping("/deviceTypeDistribution") |
| | | public AjaxResult deviceTypeDistribution(@RequestParam Integer year) { |
| | | public R<?> deviceTypeDistribution(@RequestParam Integer year) { |
| | | return accountingService.deviceTypeDistribution(year); |
| | | } |
| | | |
| | | @Operation(summary = "设备分页查询计算折旧") |
| | | @GetMapping("/calculateDepreciation") |
| | | public AjaxResult calculateDepreciation(Page page, @RequestParam Integer year) { |
| | | public R<?> calculateDepreciation(Page page, @RequestParam Integer year) { |
| | | return accountingService.calculateDepreciation(page,year); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("/borrowInfo") |
| | | @AllArgsConstructor |
| | | public class BorrowInfoController { |
| | | public class BorrowInfoController extends BaseController { |
| | | |
| | | private BorrowInfoService borrowInfoService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult listPage(Page page, BorrowInfo borrowInfo) { |
| | | public R<?> listPage(Page page, BorrowInfo borrowInfo) { |
| | | return borrowInfoService.listPage(page,borrowInfo); |
| | | } |
| | | |
| | |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "新增借款信息", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody BorrowInfo borrowInfo) { |
| | | public R<?> add(@RequestBody BorrowInfo borrowInfo) { |
| | | return borrowInfoService.add(borrowInfo); |
| | | } |
| | | |
| | |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "修改借款信息", businessType = BusinessType.UPDATE) |
| | | public AjaxResult updateBorrowInfo(@RequestBody BorrowInfo borrowInfo) { |
| | | public R<?> updateBorrowInfo(@RequestBody BorrowInfo borrowInfo) { |
| | | return borrowInfoService.updateBorrowInfo(borrowInfo); |
| | | } |
| | | |
| | |
| | | @DeleteMapping("/delete") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "删除借款信息", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return borrowInfoService.delete(ids); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.BorrowInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface BorrowInfoService extends IService<BorrowInfo> { |
| | | |
| | | AjaxResult listPage(Page page, BorrowInfo borrowInfo); |
| | | R<?> listPage(Page page, BorrowInfo borrowInfo); |
| | | |
| | | AjaxResult add(BorrowInfo borrowInfo); |
| | | R<?> add(BorrowInfo borrowInfo); |
| | | |
| | | AjaxResult updateBorrowInfo(BorrowInfo borrowInfo); |
| | | R<?> updateBorrowInfo(BorrowInfo borrowInfo); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | } |
| | |
| | | import com.ruoyi.account.pojo.BorrowInfo; |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper; |
| | |
| | | private final ProcurementRecordMapper procurementRecordMapper; |
| | | private final ProcurementRecordOutMapper procurementRecordOutMapper; |
| | | |
| | | public AjaxResult total(Integer year) { |
| | | public R<?> total(Integer year) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("deprAmount",0); // 折旧金额 |
| | | map.put("deviceTotal",0); // 设备总数 |
| | |
| | | }); |
| | | } |
| | | map.put("inventoryValue",procurementRecordTotal.add(customStorageTotal)); |
| | | return AjaxResult.success( map); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | |
| | | return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | |
| | | public AjaxResult deviceTypeDistribution(Integer year) { |
| | | public R<?> deviceTypeDistribution(Integer year) { |
| | | // 2. 组装返回VO |
| | | DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO(); |
| | | List<DeviceTypeDetail> details = deviceLedgerMapper.getDeviceTypeDistributionByYear( year); |
| | |
| | | .collect(Collectors.toList())); |
| | | vo.setTotalCount(vo.getCategories().size()); |
| | | } |
| | | return AjaxResult.success(vo); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | public AjaxResult calculateDepreciation(Page page, Integer year) { |
| | | public R<?> calculateDepreciation(Page page, Integer year) { |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year) |
| | | .eq(DeviceLedger::getIsDepr,1); |
| | |
| | | record.setDeprAmount(calculatePreciseDepreciation(record)); |
| | | record.setNetValue(record.getTaxIncludingPriceTotal().subtract(record.getDeprAmount())); |
| | | } |
| | | return AjaxResult.success(deviceLedgerIPage); |
| | | return R.ok(deviceLedgerIPage); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.service.BorrowInfoService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final AccountExpenseService accountExpenseService; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, BorrowInfo borrowInfo) { |
| | | public R<?> listPage(Page page, BorrowInfo borrowInfo) { |
| | | LambdaQueryWrapper<BorrowInfo> borrowInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(borrowInfo != null){ |
| | | if(StringUtils.isNotEmpty(borrowInfo.getEntryDateStart()) && StringUtils.isNotEmpty(borrowInfo.getEntryDateEnd())){ |
| | |
| | | borrowInfoLambdaQueryWrapper.like(BorrowInfo::getBorrowerName, borrowInfo.getBorrowerName()); |
| | | } |
| | | } |
| | | return AjaxResult.success(borrowInfoMapper.selectPage(page, borrowInfoLambdaQueryWrapper)); |
| | | return R.ok(borrowInfoMapper.selectPage(page, borrowInfoLambdaQueryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(BorrowInfo borrowInfo) { |
| | | public R<?> add(BorrowInfo borrowInfo) { |
| | | int insert = borrowInfoMapper.insert(borrowInfo); |
| | | if(insert > 0){ |
| | | // 添加成功,进入收入管理 |
| | |
| | | accountIncome.setInputTime(DateUtils.getNowDate()); |
| | | accountIncome.setInputUser(borrowInfo.getBorrowerName()); |
| | | accountIncomeService.save(accountIncome); |
| | | return AjaxResult.success("添加成功"); |
| | | return R.ok(null, "添加成功"); |
| | | } |
| | | return AjaxResult.success("添加失败"); |
| | | return R.ok(null, "添加失败"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateBorrowInfo(BorrowInfo borrowInfo) { |
| | | public R<?> updateBorrowInfo(BorrowInfo borrowInfo) { |
| | | int update = borrowInfoMapper.updateById(borrowInfo); |
| | | if(update > 0){ |
| | | // 修改成功,修改收入管理 |
| | |
| | | accountExpense.setInputUser(borrowInfo.getBorrowerName()); |
| | | accountExpenseService.save(accountExpense); |
| | | } |
| | | return AjaxResult.success("修改成功"); |
| | | return R.ok(null, "修改成功"); |
| | | } |
| | | return AjaxResult.success("修改失败"); |
| | | return R.ok(null, "修改失败"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | int delete = borrowInfoMapper.deleteBatchIds(ids); |
| | | if(delete > 0){ |
| | | // 删除成功,删除收入管理 |
| | |
| | | accountExpenseService.remove(new LambdaQueryWrapper<AccountExpense>() |
| | | .in(AccountExpense::getBusinessId, ids) |
| | | .eq(AccountExpense::getBusinessType, 2)); |
| | | return AjaxResult.success("删除成功"); |
| | | return R.ok(null, "删除成功"); |
| | | } |
| | | return AjaxResult.success("删除失败"); |
| | | return R.ok(null, "删除失败"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增临期售后") |
| | | @Log(title = "新增临期售后", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesNearExpiry entity) { |
| | | public R<?> add(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.add(entity); |
| | | return AjaxResult.success("添加成功"); |
| | | return R.ok(null, "添加成功"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "更新临期售后") |
| | | @Log(title = "更新临期售后", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesNearExpiry entity) { |
| | | public R<?> update(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.update(entity); |
| | | return AjaxResult.success("更新成功"); |
| | | return R.ok(null, "更新成功"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除临期售后") |
| | | @Log(title = "删除临期售后", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(Long[] ids) { |
| | | public R<?> delete(Long[] ids) { |
| | | afterSalesNearExpiryService.delete(ids); |
| | | return AjaxResult.success("删除成功"); |
| | | return R.ok(null, "删除成功"); |
| | | } |
| | | |
| | | /** |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询临期售后") |
| | | @Log(title = "分页查询临期售后", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | public R<?> listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | IPage<AfterSalesNearExpiry> listPage = afterSalesNearExpiryService.listPage(page, entity); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "售后服务-分页查询") |
| | | @Log(title = "售后服务-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | public R<?> listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @Log(title = "售后服务-反馈登记", businessType = BusinessType.EXPORT) |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "售后服务-新增") |
| | | @Log(title = "售后服务-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error(); |
| | | public R<?> add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "售后服务-修改") |
| | | @Log(title = "售后服务-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | public R<?> update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) { |
| | | String productModelIds = afterSalesServiceNewDto.getProductModelIdList().stream() |
| | | .map(String::valueOf) |
| | |
| | | afterSalesServiceNewDto.setProductModelIds(productModelIds); |
| | | } |
| | | boolean update = afterSalesServiceService.updateById(afterSalesServiceNewDto); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "售后服务-删除") |
| | | @Log(title = "售后服务-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | boolean delete = afterSalesServiceService.removeByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/dispose") |
| | | @Operation(summary = "售后服务-处理") |
| | | @Log(title = "售后服务-处理", businessType = BusinessType.UPDATE) |
| | | public AjaxResult dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | public R<?> dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | AfterSalesService byId = afterSalesServiceService.getById(afterSalesService.getId()); |
| | | if(byId == null) throw new RuntimeException("未找到该数据"); |
| | | if(byId.getStatus().equals(2)) throw new RuntimeException("该数据已处理"); |
| | |
| | | afterSalesService.setDisposeNickName(sysUser.getNickName()); |
| | | afterSalesService.setStatus(2); |
| | | boolean update = afterSalesServiceService.updateById(afterSalesService); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("listSalesLedger") |
| | | @Operation(summary = "售后服务-获取销售台账") |
| | | public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | public R<?> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getById") |
| | | @Operation(summary = "售后服务-根据id获取详情") |
| | | public AjaxResult getById(Long id) { |
| | | return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | public R<?> getById(Long id) { |
| | | return R.ok(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | } |
| | | |
| | | @Operation(summary = "售后服务-统计工单情况") |
| | | @GetMapping("count") |
| | | public AjaxResult count() { |
| | | return AjaxResult.success(afterSalesServiceService.countAfterSalesService()); |
| | | public R<?> count() { |
| | | return R.ok(afterSalesServiceService.countAfterSalesService()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @PostMapping("/upload") |
| | | @Operation(summary = "售后服务-文件上传") |
| | | @Log(title = "售后服务-文件上传", businessType = BusinessType.INSERT) |
| | | public AjaxResult fileUpload(@RequestParam("file") MultipartFile file, |
| | | public R<?> fileUpload(@RequestParam("file") MultipartFile file, |
| | | @RequestParam("id") Long afterSalesServiceId) { |
| | | afterSalesServiceFileService.fileUpload(file, afterSalesServiceId); |
| | | return AjaxResult.success("上传成功"); |
| | | return R.ok(null, "上传成功"); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "售后处理-售后附件列表") |
| | | @Log(title = "售后处理-售后附件列表", businessType = BusinessType.OTHER) |
| | | public AjaxResult fileList(Page<AfterSalesServiceFile> page, Long afterSalesServiceId) { |
| | | return AjaxResult.success(afterSalesServiceFileService.fileList(page, afterSalesServiceId)); |
| | | public R<?> fileList(Page<AfterSalesServiceFile> page, Long afterSalesServiceId) { |
| | | return R.ok(afterSalesServiceFileService.fileList(page, afterSalesServiceId)); |
| | | } |
| | | |
| | | @DeleteMapping("/del/{fileId}") |
| | | @Operation(summary = "售后处理-删除附件") |
| | | @Log(title = "售后处理-删除附件", businessType = BusinessType.DELETE) |
| | | public AjaxResult delFile(@PathVariable Long fileId) { |
| | | public R<?> delFile(@PathVariable Long fileId) { |
| | | afterSalesServiceFileService.delFile(fileId); |
| | | return AjaxResult.success("删除成功!"); |
| | | return R.ok(null, "删除成功!"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | |
| | | @Operation(summary = "制造会话列表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | public R<?> listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "制造会话消息") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public R<?> listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "删除制造会话") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | public R<?> deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | |
| | | |
| | | @Operation(summary = "采购多文件分析确认处理") |
| | | @PostMapping("/analyze-files/confirm") |
| | | public AjaxResult confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) { |
| | | public R confirmAnalyzeResult(@RequestBody PurchaseAiConfirmRequest request) { |
| | | return purchaseAiService.confirmAnalyzeResult(request); |
| | | } |
| | | |
| | | @Operation(summary = "采购会话列表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | public R listSessions() { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return success(purchaseAiService.listSessions(loginUser)); |
| | | return R.ok(purchaseAiService.listSessions(loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "采购会话消息") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | public R listMessages(@PathVariable String memoryId) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return success(purchaseAiService.listMessages(memoryId, loginUser)); |
| | | return R.ok(purchaseAiService.listMessages(memoryId, loginUser)); |
| | | } |
| | | |
| | | @Operation(summary = "删除采购会话") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | public R deleteSession(@PathVariable String memoryId) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | return toAjax(purchaseAiService.deleteSession(memoryId, loginUser)); |
| | | return R.ok(purchaseAiService.deleteSession(memoryId, loginUser)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | |
| | | @Operation(summary = "销售助手会话列表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | public R<?> listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "销售助手会话消息") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public R<?> listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "删除销售助手会话") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | public R<?> deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | private boolean isBusinessDataIntent(String message) { |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | 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.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import reactor.core.publisher.Flux; |
| | | |
| | |
| | | |
| | | @Operation(summary = "会话列表") |
| | | @GetMapping("/history/sessions") |
| | | public AjaxResult listSessions() { |
| | | return success(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | public R listSessions() { |
| | | return R.ok(aiChatSessionService.listCurrentUserSessions(SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "会话消息") |
| | | @GetMapping("/history/messages/{memoryId}") |
| | | public AjaxResult listMessages(@PathVariable String memoryId) { |
| | | return success(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | public R listMessages(@PathVariable String memoryId) { |
| | | return R.ok(aiChatSessionService.listCurrentUserMessages(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | @Operation(summary = "删除会话") |
| | | @DeleteMapping("/history/{memoryId}") |
| | | public AjaxResult deleteSession(@PathVariable String memoryId) { |
| | | public R deleteSession(@PathVariable String memoryId) { |
| | | aiSessionUserContext.remove(memoryId); |
| | | return toAjax(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | return R.ok(aiChatSessionService.deleteCurrentUserSession(memoryId, SecurityUtils.getLoginUser())); |
| | | } |
| | | |
| | | private boolean isApproveTodoBusinessIntent(String message) { |
| | |
| | | import com.ruoyi.basic.service.StorageBlobService; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.pojo.PaymentRegistration; |
| | |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import dev.langchain4j.data.image.Image; |
| | | import dev.langchain4j.data.message.AiMessage; |
| | | import dev.langchain4j.data.message.ChatMessage; |
| | | import dev.langchain4j.data.message.Content; |
| | | import dev.langchain4j.data.message.ImageContent; |
| | | import dev.langchain4j.data.message.SystemMessage; |
| | | import dev.langchain4j.data.message.TextContent; |
| | | import dev.langchain4j.data.message.UserMessage; |
| | | import dev.langchain4j.data.message.*; |
| | | import dev.langchain4j.model.chat.StreamingChatLanguageModel; |
| | | import dev.langchain4j.model.chat.response.ChatResponse; |
| | | import dev.langchain4j.model.chat.response.StreamingChatResponseHandler; |
| | |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Base64; |
| | | import java.util.Arrays; |
| | | import java.nio.file.Files; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Date; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.NoSuchElementException; |
| | | import java.util.UUID; |
| | | import java.nio.file.Files; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class PurchaseAiService { |
| | |
| | | .doOnError(ex -> aiChatSessionService.refreshSessionStats(finalMemoryId, loginUser)); |
| | | } |
| | | |
| | | public AjaxResult confirmAnalyzeResult(PurchaseAiConfirmRequest request) { |
| | | public R confirmAnalyzeResult(PurchaseAiConfirmRequest request) { |
| | | if (request == null || !StringUtils.hasText(request.getBusinessType())) { |
| | | return AjaxResult.error("businessType不能为空"); |
| | | return R.fail("businessType不能为空"); |
| | | } |
| | | if (request.getPayload() == null || request.getPayload().isEmpty()) { |
| | | return AjaxResult.error("payload不能为空"); |
| | | return R.fail("payload不能为空"); |
| | | } |
| | | |
| | | try { |
| | |
| | | case "purchase_ledger" -> processPurchaseLedger(request.getPayload()); |
| | | case "payment_registration" -> processPaymentRegistration(request.getPayload()); |
| | | case "purchase_return_order" -> processPurchaseReturnOrder(request.getPayload()); |
| | | default -> AjaxResult.error("暂不支持该业务类型: " + businessType); |
| | | default -> R.fail("暂不支持该业务类型: " + businessType); |
| | | }; |
| | | } catch (Exception ex) { |
| | | return AjaxResult.error(toCustomerMessage(ex)); |
| | | return R.fail(toCustomerMessage(ex)); |
| | | } |
| | | } |
| | | |
| | |
| | | 输出要求: |
| | | 1. 只输出合法 JSON,不要 Markdown,不要额外解释。 |
| | | 2. JSON 顶层字段固定为: |
| | | - success: boolean |
| | | - ok: boolean |
| | | - businessType: purchase_ledger | payment_registration | purchase_return_order | unknown |
| | | - action: confirm_required |
| | | - description: 中文说明 |
| | |
| | | """.formatted(message, fileContent); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseLedger(Map<String, Object> payload) throws Exception { |
| | | private R processPurchaseLedger(Map<String, Object> payload) throws Exception { |
| | | if (payload.containsKey("purchaseLedgers")) { |
| | | return processPurchaseLedgerBatch(payload); |
| | | } |
| | | |
| | | Map<String, Object> normalizedPayload = normalizePurchaseLedgerMap(payload); |
| | | PurchaseLedgerDto dto = objectMapper.convertValue(normalizedPayload, PurchaseLedgerDto.class); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, 0); |
| | | R ledgerResult = validatePurchaseLedger(dto, 0); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | R supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | | AjaxResult productResult = validatePurchaseProducts(dto.getProductData(), 0); |
| | | R productResult = validatePurchaseProducts(dto.getProductData(), 0); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | | int result = purchaseLedgerService.addOrEditPurchase(dto); |
| | | return AjaxResult.success("采购台账已处理", result); |
| | | return R.ok( result,"采购台账已处理"); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception { |
| | | private R processPurchaseLedgerBatch(Map<String, Object> payload) throws Exception { |
| | | List<Map<String, Object>> purchaseLedgers = toMapList(payload.get("purchaseLedgers")); |
| | | if (purchaseLedgers.isEmpty()) { |
| | | return AjaxResult.error("purchaseLedgers不能为空"); |
| | | return R.fail("purchaseLedgers不能为空"); |
| | | } |
| | | |
| | | List<Map<String, Object>> topLevelProductData = toMapList(payload.get("productData")); |
| | |
| | | for (int i = 0; i < purchaseLedgers.size(); i++) { |
| | | Map<String, Object> ledgerMap = normalizePurchaseLedgerMap(purchaseLedgers.get(i)); |
| | | PurchaseLedgerDto dto = objectMapper.convertValue(ledgerMap, PurchaseLedgerDto.class); |
| | | AjaxResult ledgerResult = validatePurchaseLedger(dto, i); |
| | | R ledgerResult = validatePurchaseLedger(dto, i); |
| | | if (ledgerResult != null) { |
| | | return ledgerResult; |
| | | } |
| | | AjaxResult supplierResult = fillSupplierIdByName(dto); |
| | | R supplierResult = fillSupplierIdByName(dto); |
| | | if (supplierResult != null) { |
| | | return supplierResult; |
| | | } |
| | |
| | | products = matchProductsForLedger(ledgerMap, dto, topLevelProductData, purchaseLedgers.size() == 1); |
| | | dto.setProductData(products); |
| | | } |
| | | AjaxResult productResult = validatePurchaseProducts(products, i); |
| | | R productResult = validatePurchaseProducts(products, i); |
| | | if (productResult != null) { |
| | | return productResult; |
| | | } |
| | |
| | | item.put("result", result); |
| | | results.add(item); |
| | | } |
| | | return AjaxResult.success("采购台账已批量处理", results); |
| | | return R.ok( results,"采购台账已批量处理"); |
| | | } |
| | | |
| | | private List<SalesLedgerProduct> matchProductsForLedger(Map<String, Object> ledgerMap, |
| | |
| | | } |
| | | } |
| | | |
| | | private AjaxResult validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) { |
| | | private R validatePurchaseProducts(List<SalesLedgerProduct> products, int ledgerIndex) { |
| | | if (products == null || products.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | SalesLedgerProduct product = products.get(i); |
| | | String prefix = "第" + (ledgerIndex + 1) + "个采购台账的第" + (i + 1) + "条产品"; |
| | | if (!StringUtils.hasText(product.getProductCategory())) { |
| | | return AjaxResult.error(prefix + "缺少产品名称,请补充后再确认"); |
| | | return R.fail(prefix + "缺少产品名称,请补充后再确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getSpecificationModel())) { |
| | | return AjaxResult.error(prefix + "缺少规格型号,请补充后再确认"); |
| | | return R.fail(prefix + "缺少规格型号,请补充后再确认"); |
| | | } |
| | | if (!StringUtils.hasText(product.getUnit())) { |
| | | return AjaxResult.error(prefix + "缺少单位,请补充后再确认"); |
| | | return R.fail(prefix + "缺少单位,请补充后再确认"); |
| | | } |
| | | if (product.getQuantity() == null) { |
| | | return AjaxResult.error(prefix + "缺少数量"); |
| | | return R.fail(prefix + "缺少数量"); |
| | | } |
| | | if (product.getTaxInclusiveUnitPrice() == null) { |
| | | return AjaxResult.error(prefix + "缺少含税单价,请补充后再确认"); |
| | | return R.fail(prefix + "缺少含税单价,请补充后再确认"); |
| | | } |
| | | if (product.getTaxInclusiveTotalPrice() == null) { |
| | | return AjaxResult.error(prefix + "缺少含税总价,请补充后再确认"); |
| | | return R.fail(prefix + "缺少含税总价,请补充后再确认"); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private AjaxResult validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) { |
| | | private R validatePurchaseLedger(PurchaseLedgerDto dto, int ledgerIndex) { |
| | | String prefix = "第" + (ledgerIndex + 1) + "个采购台账"; |
| | | if (!StringUtils.hasText(dto.getPurchaseContractNumber())) { |
| | | return AjaxResult.error(prefix + "缺少采购合同号,请补充后再确认"); |
| | | return R.fail(prefix + "缺少采购合同号,请补充后再确认"); |
| | | } |
| | | if (dto.getSupplierId() == null && !StringUtils.hasText(dto.getSupplierName())) { |
| | | return AjaxResult.error(prefix + "缺少供应商名称,请补充后再确认"); |
| | | return R.fail(prefix + "缺少供应商名称,请补充后再确认"); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | return "处理失败:" + message; |
| | | } |
| | | |
| | | private AjaxResult fillSupplierIdByName(PurchaseLedgerDto dto) { |
| | | private R fillSupplierIdByName(PurchaseLedgerDto dto) { |
| | | if (dto.getSupplierId() != null) { |
| | | return null; |
| | | } |
| | | if (!StringUtils.hasText(dto.getSupplierName())) { |
| | | return AjaxResult.error("供应商ID不能为空;未识别到供应商名称,无法自动匹配供应商ID"); |
| | | return R.fail("供应商ID不能为空;未识别到供应商名称,无法自动匹配供应商ID"); |
| | | } |
| | | |
| | | SupplierManage supplier = supplierManageMapper.selectOne(new LambdaQueryWrapper<SupplierManage>() |
| | | .eq(SupplierManage::getSupplierName, dto.getSupplierName().trim()) |
| | | .last("limit 1")); |
| | | if (supplier == null) { |
| | | return AjaxResult.error("未找到供应商:" + dto.getSupplierName() + ",请先维护供应商或手动选择供应商ID"); |
| | | return R.fail("未找到供应商:" + dto.getSupplierName() + ",请先维护供应商或手动选择供应商ID"); |
| | | } |
| | | dto.setSupplierId(supplier.getId()); |
| | | return null; |
| | | } |
| | | |
| | | private AjaxResult processPaymentRegistration(Map<String, Object> payload) { |
| | | private R processPaymentRegistration(Map<String, Object> payload) { |
| | | Object recordsValue = payload.get("records"); |
| | | List<PaymentRegistration> records; |
| | | if (recordsValue == null) { |
| | |
| | | }); |
| | | } |
| | | int result = paymentRegistrationService.insertPaymentRegistration(records); |
| | | return AjaxResult.success("付款登记已处理", result); |
| | | return R.ok( result,"付款登记已处理"); |
| | | } |
| | | |
| | | private AjaxResult processPurchaseReturnOrder(Map<String, Object> payload) { |
| | | private R processPurchaseReturnOrder(Map<String, Object> payload) { |
| | | PurchaseReturnOrderDto dto = objectMapper.convertValue(payload, PurchaseReturnOrderDto.class); |
| | | Boolean result = purchaseReturnOrdersService.add(dto); |
| | | return AjaxResult.success("采购退货单已处理", result); |
| | | return R.ok( result,"采购退货单已处理"); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RestController |
| | | @RequestMapping("/approveNode") |
| | | @AllArgsConstructor |
| | | public class ApproveNodeController { |
| | | public class ApproveNodeController extends BaseController { |
| | | |
| | | private IApproveNodeService approveNodeService; |
| | | |
| | |
| | | */ |
| | | @GetMapping("/details/{id}") |
| | | @Operation(summary = "流程状态详情") |
| | | public AjaxResult details(@PathVariable String id) { |
| | | return AjaxResult.success(approveNodeService.details(id)); |
| | | public R<?> details(@PathVariable String id) { |
| | | return R.ok(approveNodeService.details(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/updateApproveNode") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "审批节点") |
| | | public AjaxResult updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | public R<?> updateApproveNode(@RequestBody ApproveNode approveNode) throws IOException { |
| | | approveNodeService.updateApproveNode(approveNode); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/init") |
| | | public AjaxResult init(String id) { |
| | | public R<?> init(String id) { |
| | | approveNodeService.initApproveNodes("",id,1L); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @RequestMapping("/approveProcess") |
| | | @AllArgsConstructor |
| | | @Tag(name = "审批") |
| | | public class ApproveProcessController { |
| | | public class ApproveProcessController extends BaseController { |
| | | |
| | | private IApproveProcessService approveProcessService; |
| | | /**、 |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDept") |
| | | public AjaxResult getDept() { |
| | | public R<?> getDept() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | LoginUser user = SecurityUtils.getLoginUser(); |
| | | Long[] deptIds = SecurityUtils.getDeptId(); |
| | | |
| | | List<SysDept> sysDeptList = approveProcessService.selectDeptListByDeptIds(deptIds); |
| | | return AjaxResult.success(sysDeptList); |
| | | return R.ok(sysDeptList); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "添加审批") |
| | | public AjaxResult add(@RequestBody ApproveProcessVO approveProcessVO) throws Exception { |
| | | public R<?> add(@RequestBody ApproveProcessVO approveProcessVO) throws Exception { |
| | | if (approveProcessVO == null) { |
| | | return AjaxResult.warn("参数不能为空"); |
| | | return R.fail(HttpStatus.WARN,"参数不能为空"); |
| | | } |
| | | |
| | | approveProcessService.addApprove(approveProcessVO); |
| | | return AjaxResult.success("添加成功"); |
| | | return R.ok(null, "添加成功"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/get") |
| | | @Operation(summary = "审批详情") |
| | | public AjaxResult get(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | public R<?> get(ApproveGetAndUpdateVo approveGetAndUpdateVo){ |
| | | if (approveGetAndUpdateVo.getId() == null || approveGetAndUpdateVo.getId().isEmpty()) { |
| | | return AjaxResult.warn("参数不能为空"); |
| | | return R.fail(HttpStatus.WARN,"参数不能为空"); |
| | | } |
| | | return AjaxResult.success(approveProcessService.getApproveById(approveGetAndUpdateVo.getId())); |
| | | return R.ok(approveProcessService.getApproveById(approveGetAndUpdateVo.getId())); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Operation(summary = "更新审批") |
| | | public AjaxResult update(@RequestBody ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | | public R<?> update(@RequestBody ApproveGetAndUpdateVo approveGetAndUpdateVo) throws IOException { |
| | | if (approveGetAndUpdateVo == null) { |
| | | return AjaxResult.warn("参数不能为空"); |
| | | return R.fail(HttpStatus.WARN,"参数不能为空"); |
| | | } |
| | | approveProcessService.updateByApproveId(approveGetAndUpdateVo); |
| | | return AjaxResult.success("操作成功"); |
| | | return R.ok(null, "操作成功"); |
| | | } |
| | | /** |
| | | * 获取审批列表 |
| | |
| | | */ |
| | | @GetMapping("/list") |
| | | @Operation(summary = "获取审批列表") |
| | | public AjaxResult list(Page page, ApproveProcess approveProcess) { |
| | | return AjaxResult.success(approveProcessService.listAll(page, approveProcess)); |
| | | public R<?> list(Page page, ApproveProcess approveProcess) { |
| | | return R.ok(approveProcessService.listAll(page, approveProcess)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @DeleteMapping("/deleteIds") |
| | | @Operation(summary = "删除审批") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult deleteIds(@RequestBody List<Long> ids) { |
| | | public R<?> deleteIds(@RequestBody List<Long> ids) { |
| | | if (ids == null || ids.size() == 0) { |
| | | return AjaxResult.warn("参数不能为空"); |
| | | return R.fail(HttpStatus.WARN,"参数不能为空"); |
| | | } |
| | | approveProcessService.delApprove(ids); |
| | | return AjaxResult.success("操作成功"); |
| | | return R.ok(null, "操作成功"); |
| | | } |
| | | |
| | | @Operation(summary = "公出管理导出") |
| | |
| | | import com.ruoyi.approve.mapper.WorkingHoursSettingMapper; |
| | | import com.ruoyi.approve.pojo.*; |
| | | import com.ruoyi.approve.service.HolidaySettingsService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/holidaySettings") |
| | | @AllArgsConstructor |
| | | public class HolidaySettingsController { |
| | | public class HolidaySettingsController extends BaseController { |
| | | private HolidaySettingsService holidaySettingsService; |
| | | private AnnualLeaveSettingMapper annualLeaveSettingMapper; |
| | | private OvertimeSettingMapper overtimeSettingMapper; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, HolidaySettings holidaySettings) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(holidaySettingsService.listpage(page,holidaySettings)); |
| | | return R.ok(holidaySettingsService.listpage(page,holidaySettings)); |
| | | } |
| | | /**、 |
| | | * 增添 |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody HolidaySettings holidaySettings){ |
| | | return AjaxResult.success(holidaySettingsService.save(holidaySettings)); |
| | | public R<?> add(@RequestBody HolidaySettings holidaySettings){ |
| | | return R.ok(holidaySettingsService.save(holidaySettings)); |
| | | } |
| | | /** |
| | | * 更新 |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody HolidaySettings holidaySettings){ |
| | | return AjaxResult.success(holidaySettingsService.updateById(holidaySettings)); |
| | | public R<?> update(@RequestBody HolidaySettings holidaySettings){ |
| | | return R.ok(holidaySettingsService.updateById(holidaySettings)); |
| | | } |
| | | /** |
| | | * 删除 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(holidaySettingsService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(holidaySettingsService.removeByIds(ids)); |
| | | } |
| | | /**、 |
| | | * 获取年假规则列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getAnnualLeaveSettingList") |
| | | public AjaxResult getAnnualLeaveSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getAnnualLeaveSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, AnnualLeaveSetting annualLeaveSetting) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(annualLeaveSettingMapper.listPage(page,annualLeaveSetting)); |
| | | return R.ok(annualLeaveSettingMapper.listPage(page,annualLeaveSetting)); |
| | | } |
| | | /**、 |
| | | * 增添年假规则 |
| | | * @return |
| | | */ |
| | | @PostMapping("/addAnnualLeaveSetting") |
| | | public AjaxResult addAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return AjaxResult.success(annualLeaveSettingMapper.insert(annualLeaveSetting)); |
| | | public R<?> addAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return R.ok(annualLeaveSettingMapper.insert(annualLeaveSetting)); |
| | | } |
| | | /**、 |
| | | * 更新年假规则 |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateAnnualLeaveSetting") |
| | | public AjaxResult updateAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return AjaxResult.success(annualLeaveSettingMapper.updateById(annualLeaveSetting)); |
| | | public R<?> updateAnnualLeaveSetting(@RequestBody AnnualLeaveSetting annualLeaveSetting){ |
| | | return R.ok(annualLeaveSettingMapper.updateById(annualLeaveSetting)); |
| | | } |
| | | /**、 |
| | | * 删除年假规则 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteAnnualLeaveSetting") |
| | | public AjaxResult deleteAnnualLeaveSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(annualLeaveSettingMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteAnnualLeaveSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(annualLeaveSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | /**、 |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getOvertimeSettingList") |
| | | public AjaxResult getOvertimeSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getOvertimeSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, OvertimeSetting overtimeSetting) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(overtimeSettingMapper.listPage(page,overtimeSetting)); |
| | | return R.ok(overtimeSettingMapper.listPage(page,overtimeSetting)); |
| | | } |
| | | /**、 |
| | | * 增添加班规则 |
| | | * @return |
| | | */ |
| | | @PostMapping("/addOvertimeSetting") |
| | | public AjaxResult addOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return AjaxResult.success(overtimeSettingMapper.insert(overtimeSetting)); |
| | | public R<?> addOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return R.ok(overtimeSettingMapper.insert(overtimeSetting)); |
| | | } |
| | | /**、 |
| | | * 更新加班规则 |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateOvertimeSetting") |
| | | public AjaxResult updateOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return AjaxResult.success(overtimeSettingMapper.updateById(overtimeSetting)); |
| | | public R<?> updateOvertimeSetting(@RequestBody OvertimeSetting overtimeSetting){ |
| | | return R.ok(overtimeSettingMapper.updateById(overtimeSetting)); |
| | | } |
| | | /**、 |
| | | * 删除加班规则 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteOvertimeSetting") |
| | | public AjaxResult deleteOvertimeSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(overtimeSettingMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteOvertimeSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(overtimeSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | /**、 |
| | | * 获取上班时间设置-班制规则列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getWorkingHoursSettingList") |
| | | public AjaxResult getWorkingHoursSettingList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getWorkingHoursSettingList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, WorkingHoursSetting workingHoursSetting) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(workingHoursSettingMapper.listPage(page,workingHoursSetting)); |
| | | return R.ok(workingHoursSettingMapper.listPage(page,workingHoursSetting)); |
| | | } |
| | | /**、 |
| | | * 增添班制规则 |
| | | * @return |
| | | */ |
| | | @PostMapping("/addWorkingHoursSetting") |
| | | public AjaxResult addWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return AjaxResult.success(workingHoursSettingMapper.insert(workingHoursSetting)); |
| | | public R<?> addWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return R.ok(workingHoursSettingMapper.insert(workingHoursSetting)); |
| | | } |
| | | /**、 |
| | | * 更新班制规则 |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateWorkingHoursSetting") |
| | | public AjaxResult updateWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return AjaxResult.success(workingHoursSettingMapper.updateById(workingHoursSetting)); |
| | | public R<?> updateWorkingHoursSetting(@RequestBody WorkingHoursSetting workingHoursSetting){ |
| | | return R.ok(workingHoursSettingMapper.updateById(workingHoursSetting)); |
| | | } |
| | | /**、 |
| | | * 删除班制规则 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/deleteWorkingHoursSetting") |
| | | public AjaxResult deleteWorkingHoursSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(workingHoursSettingMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteWorkingHoursSetting(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(workingHoursSettingMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.approve.pojo.KnowledgeBase; |
| | | import com.ruoyi.approve.service.KnowledgeBaseService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/knowledgeBase") |
| | | @AllArgsConstructor |
| | | @Tag(name = "知识库管理") |
| | | public class KnowledgeBaseController { |
| | | public class KnowledgeBaseController extends BaseController { |
| | | private KnowledgeBaseService knowledgeBaseService; |
| | | |
| | | /**、 |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "10") long size, KnowledgeBase knowledgeBase) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | return R.ok(knowledgeBaseService.listpage(page,knowledgeBase)); |
| | | } |
| | | /**、 |
| | | * 增添 |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.save(knowledgeBase)); |
| | | public R<?> add(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.save(knowledgeBase)); |
| | | } |
| | | /** |
| | | * 更新 |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return AjaxResult.success(knowledgeBaseService.updateById(knowledgeBase)); |
| | | public R<?> update(@RequestBody KnowledgeBase knowledgeBase){ |
| | | return R.ok(knowledgeBaseService.updateById(knowledgeBase)); |
| | | } |
| | | /** |
| | | * 删除 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(knowledgeBaseService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(knowledgeBaseService.removeByIds(ids)); |
| | | } |
| | | |
| | | @Operation(summary = "知识库管理导出") |
| | |
| | | import com.ruoyi.approve.pojo.NotificationManagement; |
| | | import com.ruoyi.approve.pojo.OnlineMeeting; |
| | | import com.ruoyi.approve.service.NotificationManagementService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/notificationManagement") |
| | | @AllArgsConstructor |
| | | public class NotificationManagementController { |
| | | public class NotificationManagementController extends BaseController { |
| | | private NotificationManagementService notificationManagementService ; |
| | | private OnlineMeetingMapper onlineMeetingMapper; |
| | | private FileSharingMapper fileSharingMapper; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "50") long size, NotificationManagement notificationManagement) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(notificationManagementService.listpage(page,notificationManagement)); |
| | | return R.ok(notificationManagementService.listpage(page,notificationManagement)); |
| | | } |
| | | /**、 |
| | | * 增添 |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody NotificationManagement notificationManagement){ |
| | | return AjaxResult.success(notificationManagementService.save(notificationManagement)); |
| | | public R<?> add(@RequestBody NotificationManagement notificationManagement){ |
| | | return R.ok(notificationManagementService.save(notificationManagement)); |
| | | } |
| | | /** |
| | | * 更新 |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody NotificationManagement notificationManagement){ |
| | | return AjaxResult.success(notificationManagementService.updateById(notificationManagement)); |
| | | public R<?> update(@RequestBody NotificationManagement notificationManagement){ |
| | | return R.ok(notificationManagementService.updateById(notificationManagement)); |
| | | } |
| | | /** |
| | | * 删除 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(notificationManagementService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(notificationManagementService.removeByIds(ids)); |
| | | } |
| | | /** |
| | | *新增会议 |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/addOnlineMeeting") |
| | | public AjaxResult addOnlineMeeting(@RequestBody OnlineMeeting onlineMeeting){ |
| | | return AjaxResult.success(onlineMeetingMapper.insert(onlineMeeting)); |
| | | public R<?> addOnlineMeeting(@RequestBody OnlineMeeting onlineMeeting){ |
| | | return R.ok(onlineMeetingMapper.insert(onlineMeeting)); |
| | | } |
| | | /** |
| | | *新增文件共享 |
| | | * |
| | | */ |
| | | @PostMapping("/addFileSharing") |
| | | public AjaxResult addFileSharing(@RequestBody FileSharing fileSharing){ |
| | | return AjaxResult.success(fileSharingMapper.insert(fileSharing)); |
| | | public R<?> addFileSharing(@RequestBody FileSharing fileSharing){ |
| | | return R.ok(fileSharingMapper.insert(fileSharing)); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.approve.pojo.RpaProcessAutomation; |
| | | import com.ruoyi.approve.service.RpaProcessAutomationService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/rpaProcessAutomation") |
| | | @AllArgsConstructor |
| | | @Tag(name = "RPA流程自动化") |
| | | public class RpaProcessAutomationController { |
| | | public class RpaProcessAutomationController extends BaseController { |
| | | private RpaProcessAutomationService rpaProcessAutomationService; |
| | | /**、 |
| | | * 获取列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList(@RequestParam(defaultValue = "1") long current, |
| | | public R<?> getList(@RequestParam(defaultValue = "1") long current, |
| | | @RequestParam(defaultValue = "100") long size, RpaProcessAutomation rpaProcessAutomation) { |
| | | Page page = new Page(current, size); |
| | | return AjaxResult.success(rpaProcessAutomationService.listpage(page,rpaProcessAutomation)); |
| | | return R.ok(rpaProcessAutomationService.listpage(page,rpaProcessAutomation)); |
| | | } |
| | | /**、 |
| | | * 增添 |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return AjaxResult.success(rpaProcessAutomationService.save(rpaProcessAutomation)); |
| | | public R<?> add(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return R.ok(rpaProcessAutomationService.save(rpaProcessAutomation)); |
| | | } |
| | | /** |
| | | * 更新 |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return AjaxResult.success(rpaProcessAutomationService.updateById(rpaProcessAutomation)); |
| | | public R<?> update(@RequestBody RpaProcessAutomation rpaProcessAutomation){ |
| | | return R.ok(rpaProcessAutomationService.updateById(rpaProcessAutomation)); |
| | | } |
| | | /** |
| | | * 删除 |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(rpaProcessAutomationService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(rpaProcessAutomationService.removeByIds(ids)); |
| | | } |
| | | |
| | | @Operation(summary = "RPA流程自动化导出") |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | */ |
| | | @Operation(summary = "获取客户跟进详细信息") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpWithFiles(id)); |
| | | public R getInfo(@PathVariable("id") Integer id) { |
| | | return R.ok(customerFollowUpService.getFollowUpWithFiles(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增客户跟进") |
| | | @Log(title = "客户跟进-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.insertCustomerFollowUp(customerFollowUp)); |
| | | public R<?> add(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PutMapping("/edit") |
| | | @Operation(summary = "修改客户跟进") |
| | | @Log(title = "客户跟进-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult edit(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return toAjax(customerFollowUpService.updateCustomerFollowUp(customerFollowUp)); |
| | | public R<?> edit(@RequestBody CustomerFollowUp customerFollowUp) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "上传跟进附件") |
| | | @PostMapping("/upload/{followUpId}") |
| | | @Log(title = "客户跟进-上传附件", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | | return AjaxResult.success(customerFollowUpService.addFollowUpFiles(files, followUpId)); |
| | | public R uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) { |
| | | return R.ok(customerFollowUpService.addFollowUpFiles(files, followUpId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "上传附件(复用)") |
| | | @PostMapping("/upload") |
| | | @Log(title = "上传附件(复用)", businessType = BusinessType.INSERT) |
| | | public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | | public R uploadFiles(@RequestParam("files") List<MultipartFile> files, @RequestParam(required = false) String name) { |
| | | List<CustomerFollowUpFileDto> uploadedFiles = customerFollowUpService.addFollowUpFiles(files, null); |
| | | return AjaxResult.success(uploadedFiles); |
| | | return R.ok(uploadedFiles); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "批量查询附件列表") |
| | | @PostMapping("/file/list") |
| | | public AjaxResult getFileList(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | | public R getFileList(@RequestBody List<Long> ids) { |
| | | return R.ok(customerFollowUpService.getFollowUpFilesByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "删除跟进附件") |
| | | @DeleteMapping("/file/{fileId}") |
| | | @Log(title = "客户跟进-删除附件", businessType = BusinessType.DELETE) |
| | | public AjaxResult deleteFile(@PathVariable Integer fileId) { |
| | | public R deleteFile(@PathVariable Integer fileId) { |
| | | customerFollowUpService.deleteFollowUpFile(fileId); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "删除客户跟进") |
| | | @DeleteMapping("/{id}") |
| | | @Log(title = "客户跟进-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult remove(@PathVariable Integer id) { |
| | | return toAjax(customerFollowUpService.deleteCustomerFollowUpById(id)); |
| | | public R remove(@PathVariable Integer id) { |
| | | return R.ok(customerFollowUpService.deleteCustomerFollowUpById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "新增/更新回访提醒") |
| | | @PostMapping("/return-visit") |
| | | @Log(title = "回访提醒-新增/更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) { |
| | | return toAjax(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit)); |
| | | public R saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) { |
| | | return R.ok(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "获取回访提醒详情") |
| | | @GetMapping("/return-visit/{customerId}") |
| | | public AjaxResult getReturnVisit(@PathVariable Integer customerId) { |
| | | return AjaxResult.success(customerReturnVisitService.getByCustomerId(customerId)); |
| | | public R getReturnVisit(@PathVariable Integer customerId) { |
| | | return R.ok(customerReturnVisitService.getByCustomerId(customerId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "标记回访提醒已读") |
| | | @PutMapping("/return-visit/read/{id}") |
| | | @Log(title = "回访提醒-标记已读", businessType = BusinessType.UPDATE) |
| | | public AjaxResult markAsRead(@PathVariable Long id) { |
| | | public R markAsRead(@PathVariable Long id) { |
| | | customerReturnVisitService.markAsRead(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | */ |
| | | @Log(title = "产品", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditProduct") |
| | | public AjaxResult addOrEditProduct(@RequestBody ProductDto productDto) { |
| | | return toAjax(productService.addOrEditProduct(productDto)); |
| | | public R<?> addOrEditProduct(@RequestBody ProductDto productDto) { |
| | | productService.addOrEditProduct(productDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产品规格型号", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditProductModel") |
| | | public AjaxResult addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { |
| | | return toAjax(productModelService.addOrEditProductModel(productModelDto)); |
| | | public R<?> addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { |
| | | productModelService.addOrEditProductModel(productModelDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产品", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProduct") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | // 检查是否有销售商品记录关联该产品 |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(SalesLedgerProduct::getProductId, ids); |
| | | List<SalesLedgerProduct> salesLedgerProductList = salesLedgerProductService.list(queryWrapper); |
| | | if (salesLedgerProductList.size() > 0) { |
| | | return AjaxResult.error("该产品存在销售/采购记录,不能删除"); |
| | | return R.fail("该产品存在销售/采购记录,不能删除"); |
| | | } |
| | | return toAjax(productService.delProductByIds(ids)); |
| | | productService.delProductByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产品规格型号", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProductModel") |
| | | public AjaxResult delProductModel(@RequestBody Long[] ids) { |
| | | public R<?> delProductModel(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | // 检查是否有销售商品记录关联该产品规格型号 |
| | | LambdaQueryWrapper<SalesLedgerProduct> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(SalesLedgerProduct::getProductModelId, ids); |
| | | List<SalesLedgerProduct> salesLedgerProductList = salesLedgerProductService.list(queryWrapper); |
| | | if (salesLedgerProductList.size() > 0) { |
| | | return AjaxResult.error("该产品规格型号存在销售/采购记录,不能删除"); |
| | | return R.fail("该产品规格型号存在销售/采购记录,不能删除"); |
| | | } |
| | | return toAjax(productModelService.delProductModel(ids)); |
| | | productModelService.delProductModel(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "导入产品", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importProductModel(@RequestParam("file") MultipartFile file, Integer productId) { |
| | | public R<?> importProductModel(@RequestParam("file") MultipartFile file, Integer productId) { |
| | | return productModelService.importProductModel(file, productId); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SupplierManage supplierManage) { |
| | | public R add(@RequestBody SupplierManage supplierManage) { |
| | | supplierService.saveSupplier(supplierManage); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delSupplier(@RequestBody List<Integer> ids) { |
| | | public R delSupplier(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | supplierService.delSupplier(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult supplierDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(supplierService.supplierDetail(id)); |
| | | public R supplierDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(supplierService.supplierDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody SupplierManage supplierManage) { |
| | | public R update(@RequestBody SupplierManage supplierManage) { |
| | | supplierService.supplierUpdate(supplierManage); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult supplierListPage(Page page, SupplierManageDto supplierManageDto) { |
| | | return AjaxResult.success(supplierService.supplierListPage(page, supplierManageDto)); |
| | | public R supplierListPage(Page page, SupplierManageDto supplierManageDto) { |
| | | return R.ok(supplierService.supplierListPage(page, supplierManageDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getOptions") |
| | | public AjaxResult getOptions() { |
| | | return AjaxResult.success(supplierService.list()); |
| | | public R getOptions() { |
| | | return R.ok(supplierService.list()); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.SupplierManageFile; |
| | | import com.ruoyi.basic.service.SupplierManageFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/basic/supplierManageFile") |
| | | public class SupplierManageFileController { |
| | | public class SupplierManageFileController extends BaseController { |
| | | |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.save(supplierManageFile)); |
| | | public R<?> add(@RequestBody SupplierManageFile supplierManageFile) { |
| | | return R.ok(supplierManageFileService.save(supplierManageFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delSupplierManageFile(@RequestBody List<Integer> ids) { |
| | | public R<?> delSupplierManageFile(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验附件 |
| | | return AjaxResult.success(supplierManageFileService.removeBatchByIds(ids)); |
| | | return R.ok(supplierManageFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return AjaxResult.success(supplierManageFileService.supplierManageFileListPage(page, supplierManageFile)); |
| | | public R<?> supplierManageFileListPage(Page page, SupplierManageFile supplierManageFile) { |
| | | return R.ok(supplierManageFileService.supplierManageFileListPage(page, supplierManageFile)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.basic.dto.ProductDto; |
| | | import com.ruoyi.basic.dto.ProductModelDto; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | IPage<ProductModel> modelListPage(Page page , ProductDto productDto); |
| | | |
| | | AjaxResult importProductModel(MultipartFile file, Integer productId); |
| | | R<?> importProductModel(MultipartFile file, Integer productId); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult importProductModel(MultipartFile file, Integer productId) { |
| | | public R<?> importProductModel(MultipartFile file, Integer productId) { |
| | | if (productId == null) { |
| | | return AjaxResult.error("请先选择产品再导入规格型号"); |
| | | return R.fail("请先选择产品再导入规格型号"); |
| | | } |
| | | |
| | | Product product = productMapper.selectById(productId); |
| | | if (product == null) { |
| | | return AjaxResult.error("选择的产品不存在"); |
| | | return R.fail("选择的产品不存在"); |
| | | } |
| | | |
| | | try { |
| | |
| | | List<ProductModel> productModelList = productModelExcelUtil.importExcel(file.getInputStream()); |
| | | |
| | | if (CollectionUtils.isEmpty(productModelList)) { |
| | | return AjaxResult.error("导入数据不能为空"); |
| | | return R.fail("导入数据不能为空"); |
| | | } |
| | | |
| | | // 获取当前产品下所有的规格型号名 |
| | |
| | | int rowNum = i + 2; |
| | | |
| | | if (StringUtils.isEmpty(item.getProductCode())) { |
| | | return AjaxResult.error("第 " + rowNum + " 行导入失败: [产品编码] 不能为空"); |
| | | return R.fail("第 " + rowNum + " 行导入失败: [产品编码] 不能为空"); |
| | | } |
| | | if (StringUtils.isEmpty(item.getModel())) { |
| | | return AjaxResult.error("第 " + rowNum + " 行导入失败: [规格型号] 不能为空"); |
| | | return R.fail("第 " + rowNum + " 行导入失败: [规格型号] 不能为空"); |
| | | } |
| | | if (StringUtils.isEmpty(item.getUnit())) { |
| | | return AjaxResult.error("第 " + rowNum + " 行导入失败: [单位] 不能为空"); |
| | | return R.fail("第 " + rowNum + " 行导入失败: [单位] 不能为空"); |
| | | } |
| | | |
| | | // 去重,如果已包含该型号,则跳过 |
| | |
| | | } |
| | | |
| | | if (skipCount == 0) { |
| | | return AjaxResult.success(String.format("成功导入 %d 条数据", waitToSaveList.size())); |
| | | return R.ok(null, String.format("成功导入 %d 条数据", waitToSaveList.size())); |
| | | } else { |
| | | return AjaxResult.success(String.format("成功导入 %d 条,跳过已存在数据 %d 条", waitToSaveList.size(), skipCount)); |
| | | return R.ok(null, String.format("成功导入 %d 条,跳过已存在数据 %d 条", waitToSaveList.size(), skipCount)); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("导入产品规格异常", e); |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagement; |
| | | import com.ruoyi.collaborativeApproval.service.DutyPlanService; |
| | | import com.ruoyi.common.utils.excel.ExcelUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @RestController |
| | | @RequestMapping("/dutyPlan") |
| | | @AllArgsConstructor |
| | | public class DutyPlanController { |
| | | public class DutyPlanController extends BaseController { |
| | | private DutyPlanService dutyPlanService; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult listPage(Page page, DutyPlanDTO dutyPlanDTO){ |
| | | return AjaxResult.success(dutyPlanService.listPage(page, dutyPlanDTO)); |
| | | public R<?> listPage(Page page, DutyPlanDTO dutyPlanDTO){ |
| | | return R.ok(dutyPlanService.listPage(page, dutyPlanDTO)); |
| | | } |
| | | @GetMapping("/getNum") |
| | | @Operation(summary = "获取等级数据") |
| | | public AjaxResult getNum(){ |
| | | return AjaxResult.success(dutyPlanService.getNum()); |
| | | public R<?> getNum(){ |
| | | return R.ok(dutyPlanService.getNum()); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.save(dutyPlan)); |
| | | public R<?> add(@RequestBody DutyPlan dutyPlan){ |
| | | return R.ok(dutyPlanService.save(dutyPlan)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody DutyPlan dutyPlan){ |
| | | return AjaxResult.success(dutyPlanService.updateById(dutyPlan)); |
| | | public R<?> update(@RequestBody DutyPlan dutyPlan){ |
| | | return R.ok(dutyPlanService.updateById(dutyPlan)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("请传入要删除的ID"); |
| | | } |
| | | return AjaxResult.success(dutyPlanService.removeBatchByIds(ids)); |
| | | return R.ok(dutyPlanService.removeBatchByIds(ids)); |
| | | } |
| | | @PostMapping("/export") |
| | | @Operation(summary = "导出") |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @GetMapping("/page") |
| | | @Log(title = "分页查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult listPage(Page page, NoticeDTO noticeDTO){ |
| | | return AjaxResult.success(noticeService.listPage(page, noticeDTO)); |
| | | public R<?> listPage(Page page, NoticeDTO noticeDTO){ |
| | | return R.ok(noticeService.listPage(page, noticeDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "新增", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody NoticeDTO noticeDTO){ |
| | | public R<?> add(@RequestBody NoticeDTO noticeDTO){ |
| | | if (noticeDTO.getStatus()==1){ |
| | | //正式发布通知所有人的消息通知 |
| | | sysNoticeService.simpleNoticeAll("通知公告", |
| | | noticeDTO.getTitle(), |
| | | "/collaborativeApproval/noticeManagement?type="+noticeDTO.getType()); |
| | | } |
| | | return AjaxResult.success(noticeService.save(noticeDTO)); |
| | | return R.ok(noticeService.save(noticeDTO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "修改", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody NoticeDTO noticeDTO){ |
| | | public R<?> update(@RequestBody NoticeDTO noticeDTO){ |
| | | if (ObjectUtils.isNotNull(noticeDTO.getStatus()) && noticeDTO.getStatus()==1){ |
| | | Notice notice = noticeService.getById(noticeDTO.getId()); |
| | | //正式发布通知所有人的消息通知 |
| | |
| | | notice.getTitle(), |
| | | "/collaborativeApproval/noticeManagement?type="+notice.getType()); |
| | | } |
| | | return AjaxResult.success(noticeService.updateById(noticeDTO)); |
| | | return R.ok(noticeService.updateById(noticeDTO)); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Log(title = "删除", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("请传入要删除的ID"); |
| | | } |
| | | return AjaxResult.success(noticeService.removeBatchByIds(ids)); |
| | | return R.ok(noticeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @GetMapping("/count") |
| | | @Log(title = "获取公告数量", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "获取公告数量") |
| | | public AjaxResult count(){ |
| | | return AjaxResult.success(noticeService.selectCount()); |
| | | public R<?> count(){ |
| | | return R.ok(noticeService.selectCount()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.collaborativeApproval.pojo.NoticeType; |
| | | import com.ruoyi.collaborativeApproval.service.NoticeTypeService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @RestController |
| | | @RequestMapping("/noticeType") |
| | | @AllArgsConstructor |
| | | public class NoticeTypeController { |
| | | public class NoticeTypeController extends BaseController { |
| | | |
| | | private NoticeTypeService noticeTypeService; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody NoticeType noticeType) { |
| | | return AjaxResult.success(noticeTypeService.saveOrUpdate(noticeType)); |
| | | public R<?> add(@RequestBody NoticeType noticeType) { |
| | | return R.ok(noticeTypeService.saveOrUpdate(noticeType)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delNoticeType(@RequestBody List<Integer> ids) { |
| | | public R<?> delNoticeType(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(noticeTypeService.removeBatchByIds(ids)); |
| | | return R.ok(noticeTypeService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult noticeTypeList() { |
| | | return AjaxResult.success(noticeTypeService.list()); |
| | | public R<?> noticeTypeList() { |
| | | return R.ok(noticeTypeService.list()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.pojo.SealApplicationManagement; |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RequestMapping("/rulesRegulationsManagement") |
| | | @AllArgsConstructor |
| | | @Tag(name = "制度管理") |
| | | public class RulesRegulationsManagementController { |
| | | public class RulesRegulationsManagementController extends BaseController { |
| | | private RulesRegulationsManagementService rulesRegulationsManagementService; |
| | | private ReadingStatusMapper readingStatusMapper; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.listPage(page, rulesRegulationsManagement)); |
| | | public R<?> listPage(Page page, RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return R.ok(rulesRegulationsManagementService.listPage(page, rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | public R<?> add(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | rulesRegulationsManagementService.save(rulesRegulationsManagement); |
| | | return AjaxResult.success(rulesRegulationsManagement.getId()); |
| | | return R.ok(rulesRegulationsManagement.getId()); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return AjaxResult.success(rulesRegulationsManagementService.updateById(rulesRegulationsManagement)); |
| | | public R<?> update(@RequestBody RulesRegulationsManagement rulesRegulationsManagement){ |
| | | return R.ok(rulesRegulationsManagementService.updateById(rulesRegulationsManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("请传入要删除的ID"); |
| | | } |
| | | return AjaxResult.success(rulesRegulationsManagementService.removeBatchByIds(ids)); |
| | | return R.ok(rulesRegulationsManagementService.removeBatchByIds(ids)); |
| | | } |
| | | //规则查看时新增阅读状态 |
| | | @PostMapping("/addReadingStatus") |
| | | @Operation(summary = "新增阅读状态") |
| | | public AjaxResult addReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.insert(readingStatus)); |
| | | public R<?> addReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.insert(readingStatus)); |
| | | } |
| | | @PostMapping("/updateReadingStatus") |
| | | @Operation(summary = "修改阅读状态") |
| | | public AjaxResult updateReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.updateById(readingStatus)); |
| | | public R<?> updateReadingStatus(@RequestBody ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.updateById(readingStatus)); |
| | | } |
| | | @GetMapping("/getReadingStatusList") |
| | | @Operation(summary = "分页查询阅读状态") |
| | | public AjaxResult listPage(Page page, ReadingStatus readingStatus){ |
| | | return AjaxResult.success(readingStatusMapper.selectPage(page,new QueryWrapper<ReadingStatus>(readingStatus))); |
| | | public R<?> listPage(Page page, ReadingStatus readingStatus){ |
| | | return R.ok(readingStatusMapper.selectPage(page,new QueryWrapper<ReadingStatus>(readingStatus))); |
| | | } |
| | | @GetMapping("/getReadingStatusByRuleId/{ruleId}") |
| | | @Operation(summary = "根据制度id查询阅读状态") |
| | | public AjaxResult getReadingStatusByRuleId(@PathVariable Long ruleId){ |
| | | return AjaxResult.success(readingStatusMapper.selectList(new QueryWrapper<ReadingStatus>().eq("rule_id", ruleId))); |
| | | public R<?> getReadingStatusByRuleId(@PathVariable Long ruleId){ |
| | | return R.ok(readingStatusMapper.selectList(new QueryWrapper<ReadingStatus>().eq("rule_id", ruleId))); |
| | | } |
| | | |
| | | @Operation(summary = "规章制度管理导出") |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.collaborativeApproval.pojo.RulesRegulationsManagementFile; |
| | | import com.ruoyi.collaborativeApproval.service.RulesRegulationsManagementFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.service.IQualityInspectFileService; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/rulesRegulationsManagementFile") |
| | | public class RulesRegulationsManagementFileController { |
| | | public class RulesRegulationsManagementFileController extends BaseController { |
| | | |
| | | @Resource |
| | | private RulesRegulationsManagementFileService rulesRegulationsManagementFileService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.save(rulesRegulationsManagementFile)); |
| | | public R<?> add(@RequestBody RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return R.ok(rulesRegulationsManagementFileService.save(rulesRegulationsManagementFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验附件 |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.removeBatchByIds(ids)); |
| | | return R.ok(rulesRegulationsManagementFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return AjaxResult.success(rulesRegulationsManagementFileService.listPage(page, rulesRegulationsManagementFile)); |
| | | public R<?> listPage(Page page, RulesRegulationsManagementFile rulesRegulationsManagementFile) { |
| | | return R.ok(rulesRegulationsManagementFileService.listPage(page, rulesRegulationsManagementFile)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @RestController |
| | | @RequestMapping("/sealApplicationManagement") |
| | | @Tag(name = "用印申请管理") |
| | | public class SealApplicationManagementController { |
| | | public class SealApplicationManagementController extends BaseController { |
| | | private SealApplicationManagementService sealApplicationManagementService; |
| | | private ISysNoticeService sysNoticeService; |
| | | private FileUtil fileUtil; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult listPage(Page page, SealApplicationManagement sealApplicationManagement){ |
| | | return AjaxResult.success(sealApplicationManagementService.listPage(page,sealApplicationManagement)); |
| | | public R<?> listPage(Page page, SealApplicationManagement sealApplicationManagement){ |
| | | return R.ok(sealApplicationManagementService.listPage(page,sealApplicationManagement)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | public R<?> add(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | sealApplicationManagementService.save(sealApplicationManagement); |
| | | // 5. 保存销售台账附件 |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, |
| | |
| | | +"申请标题:"+sealApplicationManagement.getTitle(), |
| | | Arrays.asList(sealApplicationManagement.getApproveUserId()), |
| | | "/collaborativeApproval/sealManagement?applicationNum="+sealApplicationManagement.getApplicationNum()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | public R<?> update(@RequestBody SealApplicationManagementDTO sealApplicationManagement){ |
| | | // 5. 保存销售台账附件 |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, |
| | | sealApplicationManagement.getId(), |
| | | sealApplicationManagement.getStorageBlobDTOs()); |
| | | return AjaxResult.success(sealApplicationManagementService.updateById(sealApplicationManagement)); |
| | | return R.ok(sealApplicationManagementService.updateById(sealApplicationManagement)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@PathVariable("ids") List<Long> ids){ |
| | | public R<?> delete(@PathVariable("ids") List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | throw new RuntimeException("请传入要删除的ID"); |
| | | } |
| | | fileUtil.deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordIds(ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SEAL_APPLICATION_MANAGEMENT, |
| | | ids); |
| | | return AjaxResult.success(sealApplicationManagementService.removeBatchByIds(ids)); |
| | | return R.ok(sealApplicationManagementService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @Operation(summary = "用印申请管理导出") |
| | |
| | | import com.ruoyi.collaborativeApproval.dto.StaffContactsPersonalDTO; |
| | | import com.ruoyi.collaborativeApproval.pojo.StaffContactsPersonal; |
| | | import com.ruoyi.collaborativeApproval.service.StaffContactsPersonalService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/staffContactsPersonal") |
| | | @AllArgsConstructor |
| | | public class StaffContactsPersonalController { |
| | | public class StaffContactsPersonalController extends BaseController { |
| | | private StaffContactsPersonalService staffContactsPersonalService; |
| | | |
| | | @GetMapping("/getList") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return AjaxResult.success(staffContactsPersonalService.listPage(page, staffContactsPersonalDTO)); |
| | | public R<?> listPage(Page page, StaffContactsPersonalDTO staffContactsPersonalDTO) { |
| | | return R.ok(staffContactsPersonalService.listPage(page, staffContactsPersonalDTO)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody StaffContactsPersonal staffContactsPersonal) { |
| | | return AjaxResult.success(staffContactsPersonalService.save(staffContactsPersonal)); |
| | | public R<?> add(@RequestBody StaffContactsPersonal staffContactsPersonal) { |
| | | return R.ok(staffContactsPersonalService.save(staffContactsPersonal)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete/{id}") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@PathVariable("id") Long id) { |
| | | public R<?> delete(@PathVariable("id") Long id) { |
| | | // if (CollectionUtils.isEmpty(id)) { |
| | | // throw new RuntimeException("请传入要删除的ID"); |
| | | // } |
| | | return AjaxResult.success(staffContactsPersonalService.removeById(id)); |
| | | return R.ok(staffContactsPersonalService.removeById(id)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.mapper.StaffOnJobMapper; |
| | | import com.ruoyi.staff.pojo.StaffOnJob; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "薪酬绩效-分页查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "薪酬绩效-分页查询") |
| | | public AjaxResult listPage(Page page, String staffName, String payDateStr) { |
| | | public R<?> listPage(Page page, String staffName, String payDateStr) { |
| | | IPage<CompensationPerformance> listPage = compensationPerformanceService.listPage(page, staffName, payDateStr); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "薪酬绩效-添加", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "薪酬绩效-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | public R<?> add(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean save = compensationPerformanceService.save(compensationPerformance); |
| | | return save ? AjaxResult.success("添加成功") : AjaxResult.error("添加失败"); |
| | | return save ? R.ok(null, "添加成功") : R.fail("添加失败"); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "薪酬绩效-修改", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "薪酬绩效-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | public R<?> update(@RequestBody CompensationPerformance compensationPerformance) { |
| | | boolean update = compensationPerformanceService.updateById(compensationPerformance); |
| | | return update ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败"); |
| | | return update ? R.ok(null, "修改成功") : R.fail("修改失败"); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "薪酬绩效-删除", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "薪酬绩效-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | boolean delete = compensationPerformanceService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败"); |
| | | return delete ? R.ok(null, "删除成功") : R.fail("删除失败"); |
| | | } |
| | | |
| | | @Log(title = "导出薪资管理列表", businessType = BusinessType.EXPORT) |
| | |
| | | |
| | | @Log(title = "导入薪资管理列表", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | ExcelUtil<CompensationPerformance> util = new ExcelUtil<>(CompensationPerformance.class); |
| | | List<CompensationPerformance> list = util.importExcel(file.getInputStream()); |
| | | list.forEach(item -> { |
| | |
| | | } |
| | | }); |
| | | boolean b = compensationPerformanceService.saveBatch(list); |
| | | return AjaxResult.success(b); |
| | | return R.ok(b); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "客户拜访-分页查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "客户拜访-分页查询") |
| | | public AjaxResult listPage(Page page, CustomerVisits customerVisits) { |
| | | public R<?> listPage(Page page, CustomerVisits customerVisits) { |
| | | IPage<CustomerVisits> listPage = customerVisitsService.listPage(page, customerVisits); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @Log(title = "客户拜访-添加", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "客户拜访-添加") |
| | | @PostMapping("/add") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody CustomerVisits customerVisits) { |
| | | public R<?> add(@RequestBody CustomerVisits customerVisits) { |
| | | boolean save = customerVisitsService.save(customerVisits); |
| | | if (save) { |
| | | return AjaxResult.success("添加成功"); |
| | | return R.ok(null, "添加成功"); |
| | | } |
| | | return AjaxResult.error("添加失败"); |
| | | return R.fail("添加失败"); |
| | | } |
| | | |
| | | @Log(title = "客户拜访-编辑", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "客户拜访-编辑") |
| | | @PostMapping("update") |
| | | public AjaxResult updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | public R<?> updateCustomerVisit(@RequestBody CustomerVisits customerVisits) { |
| | | boolean updateResult = customerVisitsService.updateCustomerVisit(customerVisits); |
| | | if (updateResult) { |
| | | return AjaxResult.success("编辑成功"); |
| | | return R.ok(null, "编辑成功"); |
| | | } |
| | | return AjaxResult.error("编辑失败"); |
| | | return R.fail("编辑失败"); |
| | | } |
| | | |
| | | @Log(title = "客户拜访-删除", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "客户拜访-删除") |
| | | @DeleteMapping("{customerId}") |
| | | public AjaxResult deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | public R<?> deleteCustomerVisit(@PathVariable Integer customerId) { |
| | | if (customerId == null) { |
| | | return AjaxResult.error("客户ID不能为空"); |
| | | return R.fail("客户ID不能为空"); |
| | | } |
| | | boolean deleteResult = customerVisitsService.removeById(customerId); |
| | | if (deleteResult) { |
| | | return AjaxResult.success("删除成功"); |
| | | return R.ok(null, "删除成功"); |
| | | } |
| | | return AjaxResult.error("删除失败"); |
| | | return R.fail("删除失败"); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.customervisits.pojo.CustomerVisits; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | import com.ruoyi.device.dto.DeviceDefectRecordDto; |
| | | import com.ruoyi.device.pojo.DeviceDefectRecord; |
| | | import com.ruoyi.device.service.DeviceDefectRecordService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RequestMapping("/defect") |
| | | @AllArgsConstructor |
| | | @RestController |
| | | public class DeviceDefectRecordController { |
| | | public class DeviceDefectRecordController extends BaseController { |
| | | private DeviceDefectRecordService deviceDefectRecordService; |
| | | @Operation(summary = "设备缺陷记录列表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | public R<?> page(Page page , DeviceDefectRecordDto deviceDefectRecordDto) { |
| | | return R.ok(deviceDefectRecordService.listPage(page,deviceDefectRecordDto)); |
| | | } |
| | | @Operation(summary = "设备id查询设备缺陷记录列表") |
| | | @GetMapping("/find/{deviceLedgerId}") |
| | | public AjaxResult find(@PathVariable Long deviceLedgerId) { |
| | | public R<?> find(@PathVariable Long deviceLedgerId) { |
| | | DeviceDefectRecordDto deviceDefectRecordDto = new DeviceDefectRecordDto(); |
| | | deviceDefectRecordDto.setDeviceLedgerId(deviceLedgerId); |
| | | return AjaxResult.success(deviceDefectRecordService.listPage(new Page<>(1,-1),deviceDefectRecordDto)); |
| | | return R.ok(deviceDefectRecordService.listPage(new Page<>(1,-1),deviceDefectRecordDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "添加设备缺陷记录") |
| | | public AjaxResult add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | public R<?> add(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return R.ok(deviceDefectRecordService.add(deviceDefectRecord)); |
| | | } |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改设备缺陷记录") |
| | | public AjaxResult update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return AjaxResult.success(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | public R<?> update(@RequestBody DeviceDefectRecord deviceDefectRecord) { |
| | | return R.ok(deviceDefectRecordService.updateByDDR(deviceDefectRecord)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除设备缺陷记录") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceDefectRecordService.removeById(id)); |
| | | public R<?> delete(@PathVariable Long id) { |
| | | return R.ok(deviceDefectRecordService.removeById(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Anonymous; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/device/ledger") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class DeviceLedgerController { |
| | | public class DeviceLedgerController extends BaseController { |
| | | |
| | | private IDeviceLedgerService deviceLedgerService; |
| | | private DeviceLedgerMapper deviceLedgerMapper; |
| | |
| | | |
| | | @Operation(summary = "设备台账列表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return AjaxResult.success(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | public R<?> page(Page page , DeviceLedgerDto deviceLedger) { |
| | | return R.ok(deviceLedgerService.queryPage(page,deviceLedger)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "添加设备台账") |
| | | public AjaxResult add(@RequestBody DeviceLedger deviceLedger) { |
| | | public R<?> add(@RequestBody DeviceLedger deviceLedger) { |
| | | |
| | | return deviceLedgerService.saveDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @Operation(summary = "根据id查询设备台账") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceLedgerService.getById(id)); |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceLedgerService.getById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "修改设备台账") |
| | | public AjaxResult update(@RequestBody DeviceLedger deviceLedger) { |
| | | public R<?> update(@RequestBody DeviceLedger deviceLedger) { |
| | | return deviceLedgerService.updateDeviceLedger(deviceLedger); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "删除设备台账") |
| | | public AjaxResult delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | public R<?> delete(@PathVariable("ids") ArrayList<Long> ids) { |
| | | boolean b = deviceLedgerService.removeBatchByIds(ids); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | return R.fail("删除失败"); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("export") |
| | |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入设备台账") |
| | | public AjaxResult importData(MultipartFile file) throws IOException { |
| | | public R<?> importData(MultipartFile file) throws IOException { |
| | | Boolean b = deviceLedgerService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导入成功"); |
| | | return R.ok(null, "导入成功"); |
| | | } |
| | | return AjaxResult.error("导入失败"); |
| | | return R.fail("导入失败"); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getDeviceLedger") |
| | | @Operation(summary = "获取设备台账") |
| | | public AjaxResult getDeviceLedger( ) { |
| | | return AjaxResult.success(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | public R<?> getDeviceLedger( ) { |
| | | return R.ok(deviceLedgerService.list(new QueryWrapper<DeviceLedger>().lambda() |
| | | .select(DeviceLedger::getId, DeviceLedger::getDeviceName,DeviceLedger::getDeviceModel))); |
| | | } |
| | | |
| | | @GetMapping("scanDevice") |
| | | @Operation(summary = "获取设备台账") |
| | | @Anonymous |
| | | public AjaxResult scanDevice(Long id) { |
| | | public R<?> scanDevice(Long id) { |
| | | List<DeviceMaintenance> list = deviceMaintenanceMapper.list1(id); |
| | | DeviceLedger deviceLedger = deviceLedgerMapper.selectById1(id); |
| | | if (list.size()>0){ |
| | | deviceLedger.setUpdateTime(list.get(0).getMaintenanceActuallyTime());//最后维护时间 |
| | | } |
| | | deviceLedger.setCreateTime(deviceLedger.getUpdateTime().plusMonths(1));//下次维护时间 |
| | | return AjaxResult.success(deviceLedger); |
| | | return R.ok(deviceLedger); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RestController |
| | | @RequestMapping("/device/maintenance") |
| | | @AllArgsConstructor |
| | | public class DeviceMaintenanceController { |
| | | public class DeviceMaintenanceController extends BaseController { |
| | | |
| | | |
| | | private IDeviceMaintenanceService deviceMaintenanceService; |
| | |
| | | |
| | | @Operation(summary = "设备保养列表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return AjaxResult.success(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | public R<?> page(Page page , DeviceMaintenanceDto deviceMaintenanceDto) { |
| | | return R.ok(deviceMaintenanceService.queryPage(page,deviceMaintenanceDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "添加设备保养") |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> add(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | |
| | | @Operation(summary = "根据id查询设备保养") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceMaintenanceService.detailById(id)); |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceMaintenanceService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "修改设备保养") |
| | | public AjaxResult update(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> update(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceMaintenance.getDeviceLedgerId()); |
| | | deviceMaintenance.setDeviceName(byId.getDeviceName()); |
| | | deviceMaintenance.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | |
| | | @PostMapping ("maintenance") |
| | | @Operation(summary = "修改设备保养") |
| | | public AjaxResult maintenance(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> maintenance(@RequestBody DeviceMaintenanceDto deviceMaintenance) { |
| | | return deviceMaintenanceService.updateDeviceDeviceMaintenance(deviceMaintenance); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "删除设备保养") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | public R<?> delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceMaintenanceService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | return R.fail("删除失败"); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("export") |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.device.pojo.DeviceMaintenanceFile; |
| | | import com.ruoyi.device.service.DeviceMaintenanceFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RestController |
| | | @RequestMapping("/maintenanceTaskFile") |
| | | @Tag(name = "设备保养附件") |
| | | public class DeviceMaintenanceFileController { |
| | | public class DeviceMaintenanceFileController extends BaseController { |
| | | |
| | | @Resource |
| | | private DeviceMaintenanceFileService deviceMaintenanceFileService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.save(deviceMaintenanceFile)); |
| | | public R<?> add(@RequestBody DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return R.ok(deviceMaintenanceFileService.save(deviceMaintenanceFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验附件 |
| | | return AjaxResult.success(deviceMaintenanceFileService.removeBatchByIds(ids)); |
| | | return R.ok(deviceMaintenanceFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityInspectFileListPage(Page page, DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return AjaxResult.success(deviceMaintenanceFileService.page(page, Wrappers.<DeviceMaintenanceFile>lambdaQuery().eq(DeviceMaintenanceFile::getDeviceMaintenanceId,deviceMaintenanceFile.getDeviceMaintenanceId()))); |
| | | public R<?> qualityInspectFileListPage(Page page, DeviceMaintenanceFile deviceMaintenanceFile) { |
| | | return R.ok(deviceMaintenanceFileService.page(page, Wrappers.<DeviceMaintenanceFile>lambdaQuery().eq(DeviceMaintenanceFile::getDeviceMaintenanceId,deviceMaintenanceFile.getDeviceMaintenanceId()))); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RequestMapping("/device/repair") |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class DeviceRepairController { |
| | | public class DeviceRepairController extends BaseController { |
| | | |
| | | private IDeviceRepairService deviceRepairService; |
| | | |
| | | @Operation(summary = "设备报修列表") |
| | | @GetMapping("/page") |
| | | public AjaxResult page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return AjaxResult.success(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | public R<?> page(Page page , DeviceRepairDto deviceRepairDto) { |
| | | return R.ok(deviceRepairService.queryPage(page,deviceRepairDto)); |
| | | } |
| | | |
| | | @PostMapping() |
| | | @Operation(summary = "添加设备报修") |
| | | public AjaxResult add( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> add( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.saveDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @Operation(summary = "根据id查询设备报修") |
| | | @GetMapping("/{id}") |
| | | public AjaxResult detail(@PathVariable Long id) { |
| | | return AjaxResult.success(deviceRepairService.detailById(id)); |
| | | public R<?> detail(@PathVariable Long id) { |
| | | return R.ok(deviceRepairService.detailById(id)); |
| | | } |
| | | |
| | | @PutMapping () |
| | | @Operation(summary = "修改设备报修") |
| | | public AjaxResult update( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> update( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.updateDeviceRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @PostMapping ("/repair") |
| | | @Operation(summary = "设备维修") |
| | | public AjaxResult repair( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> repair( @RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.confirmRepair(deviceRepairDto); |
| | | } |
| | | |
| | | @PostMapping ("/acceptance") |
| | | @Operation(summary = "设备报修验收审批") |
| | | public AjaxResult acceptance(@RequestBody DeviceRepairDto deviceRepairDto) { |
| | | public R<?> acceptance(@RequestBody DeviceRepairDto deviceRepairDto) { |
| | | return deviceRepairService.approveRepairAcceptance(deviceRepairDto); |
| | | } |
| | | |
| | | @DeleteMapping("/{ids}") |
| | | @Operation(summary = "删除设备报修") |
| | | public AjaxResult delete(@PathVariable("ids") Long[] ids) { |
| | | public R<?> delete(@PathVariable("ids") Long[] ids) { |
| | | boolean b = deviceRepairService.removeBatchByIds(Arrays.asList(ids)); |
| | | if (!b) { |
| | | return AjaxResult.error("删除失败"); |
| | | return R.fail("删除失败"); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("export") |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "设备保养定时任务列表") |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | public R<?> listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.listPage(page,maintenanceTask); |
| | | } |
| | | |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "添加设备保养定时任务") |
| | | @Log(title = "设备保养定时任务", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | public R<?> add(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.add(maintenanceTask); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改设备保养定时任务") |
| | | @Log(title = "设备保养定时任务", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | public R<?> update(@RequestBody MaintenanceTask maintenanceTask) { |
| | | return maintenanceTaskService.updateByMaintenanceTaskId(maintenanceTask); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除设备保养定时任务") |
| | | @Log(title = "设备保养定时任务", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return maintenanceTaskService.delete(ids); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.dto.DeviceLedgerDto; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | public interface IDeviceLedgerService extends IService<DeviceLedger> { |
| | | IPage<DeviceLedgerDto> queryPage(Page page, DeviceLedgerDto deviceLedger); |
| | | |
| | | AjaxResult saveDeviceLedger(DeviceLedger deviceLedger); |
| | | R<?> saveDeviceLedger(DeviceLedger deviceLedger); |
| | | |
| | | AjaxResult updateDeviceLedger(DeviceLedger deviceLedger); |
| | | R<?> updateDeviceLedger(DeviceLedger deviceLedger); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | |
| | | import com.ruoyi.device.dto.DeviceMaintenanceDto; |
| | | import com.ruoyi.device.pojo.DeviceMaintenance; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | |
| | | IPage<DeviceMaintenanceDto> queryPage(Page page, DeviceMaintenanceDto deviceMaintenanceDto); |
| | | |
| | | AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance); |
| | | R<?> saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance); |
| | | |
| | | AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance); |
| | | R<?> updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | |
| | | import com.ruoyi.device.dto.DeviceRepairDto; |
| | | import com.ruoyi.device.pojo.DeviceRepair; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | |
| | | |
| | | IPage<DeviceRepairVo> queryPage(Page page, DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | R<?> saveDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | R<?> updateDeviceRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto); |
| | | R<?> confirmRepair(DeviceRepairDto deviceRepairDto); |
| | | |
| | | AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto); |
| | | R<?> approveRepairAcceptance(DeviceRepairDto deviceRepairDto); |
| | | |
| | | void export(HttpServletResponse response, Long[] ids); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @date : 2025/12/22 14:56 |
| | | */ |
| | | public interface MaintenanceTaskService extends IService<MaintenanceTask> { |
| | | AjaxResult listPage(Page page, MaintenanceTask maintenanceTask); |
| | | R<?> listPage(Page page, MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult add(MaintenanceTask maintenanceTask); |
| | | R<?> add(MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask); |
| | | R<?> updateByMaintenanceTaskId(MaintenanceTask maintenanceTask); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | } |
| | |
| | | import com.ruoyi.device.mapper.DeviceLedgerMapper; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | public R<?> saveDeviceLedger(DeviceLedger deviceLedger) { |
| | | LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceName,deviceLedger.getDeviceName()); |
| | | if (this.count(deviceLedgerLambdaQueryWrapper) > 0) { |
| | | return AjaxResult.error("设备名称已存在"); |
| | | return R.fail("设备名称已存在"); |
| | | } |
| | | boolean save = this.save(deviceLedger); |
| | | if (save){ |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateDeviceLedger(DeviceLedger deviceLedger) { |
| | | public R<?> updateDeviceLedger(DeviceLedger deviceLedger) { |
| | | if (this.updateById(deviceLedger)) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.device.service.IDeviceMaintenanceService; |
| | | import com.ruoyi.device.vo.DeviceMaintenanceVo; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> saveDeviceRepair(DeviceMaintenanceDto deviceMaintenance) { |
| | | boolean save = this.save(deviceMaintenance); |
| | | if (save){ |
| | | // 处理图片上传 |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) { |
| | | public R<?> updateDeviceDeviceMaintenance(DeviceMaintenanceDto deviceMaintenance) { |
| | | DeviceMaintenance oldDeviceMaintenance = this.getById(deviceMaintenance.getId()); |
| | | // 处理备件使用情况 |
| | | if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(deviceMaintenance.getSparePartsUseList())) { |
| | |
| | | record.setQuantity(sparePartUse.getQuantity()); |
| | | sparePartsRequisitionRecordService.save(record); |
| | | } else { |
| | | return AjaxResult.error("备件 " + spareParts.getName() + " 数量不足"); |
| | | return R.fail("备件 " + spareParts.getName() + " 数量不足"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (this.updateById(deviceMaintenance)) { |
| | | // 处理图片上传 |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_MAINTENANCE, deviceMaintenance.getId(), deviceMaintenance.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.device.service.IDeviceLedgerService; |
| | | import com.ruoyi.device.service.IDeviceRepairService; |
| | | import com.ruoyi.device.vo.DeviceRepairVo; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.SparePartsMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SparePartsRequisitionRecord; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult saveDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> saveDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceLedger byId = deviceLedgerService.getById(deviceRepairDto.getDeviceLedgerId()); |
| | | deviceRepairDto.setDeviceName(byId.getDeviceName()); |
| | | deviceRepairDto.setDeviceModel(byId.getDeviceModel()); |
| | |
| | | if (save) { |
| | | // 处理图片上传 |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, deviceRepairDto.getId(), deviceRepairDto.getStorageBlobDTOs()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error("保存失败"); |
| | | return R.fail("保存失败"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> updateDeviceRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return AjaxResult.error("报修记录不存在"); |
| | | return R.fail("报修记录不存在"); |
| | | } |
| | | if (deviceRepairDto.getStatus() != null |
| | | && deviceRepairDto.getStatus() == STATUS_COMPLETED |
| | | && (oldDeviceRepair.getStatus() == null |
| | | || oldDeviceRepair.getStatus() != STATUS_COMPLETED)) { |
| | | return AjaxResult.error("请先提交验收审批,验收通过后才可完结"); |
| | | return R.fail("请先提交验收审批,验收通过后才可完结"); |
| | | } |
| | | // 处理备件使用情况 |
| | | if (CollectionUtils.isNotEmpty(deviceRepairDto.getSparePartsUseList())) { |
| | |
| | | record.setQuantity(sparePartUse.getQuantity()); |
| | | sparePartsRequisitionRecordService.save(record); |
| | | } else { |
| | | return AjaxResult.error("备件 " + spareParts.getName() + " 数量不足"); |
| | | return R.fail("备件 " + spareParts.getName() + " 数量不足"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (deviceRepairDto.getStorageBlobDTOs() != null) { |
| | | fileUtil.saveStorageAttachmentByRecordTypeAndRecordId("file", RecordTypeEnum.DEVICE_REPAIR, id, deviceRepairDto.getStorageBlobDTOs()); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult confirmRepair(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> confirmRepair(DeviceRepairDto deviceRepairDto) { |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return AjaxResult.error("报修记录不存在"); |
| | | return R.fail("报修记录不存在"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_COMPLETED) { |
| | | return AjaxResult.error("该报修已完结,不能重复确认维修"); |
| | | return R.fail("该报修已完结,不能重复确认维修"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() != null && oldDeviceRepair.getStatus() == STATUS_PENDING_ACCEPTANCE) { |
| | | return AjaxResult.error("该报修已提交验收审批"); |
| | | return R.fail("该报修已提交验收审批"); |
| | | } |
| | | deviceRepairDto.setStatus(STATUS_PENDING_ACCEPTANCE); |
| | | return updateDeviceRepair(deviceRepairDto); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult approveRepairAcceptance(DeviceRepairDto deviceRepairDto) { |
| | | public R<?> approveRepairAcceptance(DeviceRepairDto deviceRepairDto) { |
| | | if (deviceRepairDto.getId() == null) { |
| | | return AjaxResult.error("报修记录id不能为空"); |
| | | return R.fail("报修记录id不能为空"); |
| | | } |
| | | DeviceRepair oldDeviceRepair = this.getById(deviceRepairDto.getId()); |
| | | if (oldDeviceRepair == null) { |
| | | return AjaxResult.error("报修记录不存在"); |
| | | return R.fail("报修记录不存在"); |
| | | } |
| | | if (oldDeviceRepair.getStatus() == null || oldDeviceRepair.getStatus() != STATUS_PENDING_ACCEPTANCE) { |
| | | return AjaxResult.error("该报修未进入待验收状态,不能审批"); |
| | | return R.fail("该报修未进入待验收状态,不能审批"); |
| | | } |
| | | if (StringUtils.isBlank(deviceRepairDto.getAcceptanceName())) { |
| | | return AjaxResult.error("验收人不能为空"); |
| | | return R.fail("验收人不能为空"); |
| | | } |
| | | if (deviceRepairDto.getAcceptanceTime() == null) { |
| | | return AjaxResult.error("验收时间不能为空"); |
| | | return R.fail("验收时间不能为空"); |
| | | } |
| | | if (StringUtils.isBlank(deviceRepairDto.getAcceptanceRemark())) { |
| | | return AjaxResult.error("验收备注不能为空"); |
| | | return R.fail("验收备注不能为空"); |
| | | } |
| | | |
| | | DeviceRepair update = new DeviceRepair(); |
| | |
| | | update.setAcceptanceRemark(deviceRepairDto.getAcceptanceRemark()); |
| | | update.setStatus(STATUS_COMPLETED); |
| | | if (this.updateById(update)) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error("验收审批失败"); |
| | | return R.fail("验收审批失败"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.device.mapper.MaintenanceTaskMapper; |
| | | import com.ruoyi.device.pojo.MaintenanceTask; |
| | | import com.ruoyi.device.service.MaintenanceTaskService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.inspectiontask.pojo.TimingTask; |
| | | import com.ruoyi.inspectiontask.service.impl.TimingTaskServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | private final MaintenanceTaskScheduler maintenanceTaskScheduler; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | public R<?> listPage(Page page, MaintenanceTask maintenanceTask) { |
| | | Page<MaintenanceTask> taskPage = maintenanceTaskMapper.selectPage(page, null); |
| | | // 2. 如果没有数据,直接返回空分页 |
| | | if (taskPage.getRecords().isEmpty()) { |
| | | return AjaxResult.success(taskPage); |
| | | return R.ok(taskPage); |
| | | } |
| | | |
| | | // 3. 收集所有需要查询的用户ID |
| | |
| | | task.setRegistrant(userNickNameMap.getOrDefault(task.getRegistrantId(), "未知用户")); |
| | | } |
| | | }); |
| | | return AjaxResult.success(taskPage); |
| | | return R.ok(taskPage); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(MaintenanceTask maintenanceTask) { |
| | | public R<?> add(MaintenanceTask maintenanceTask) { |
| | | maintenanceTask.setActive(true); |
| | | // 计算首次执行时间 |
| | | TimingTask task = new TimingTask(); |
| | |
| | | if (insert > 0) { |
| | | maintenanceTaskScheduler.scheduleMaintenanceTask(maintenanceTask); |
| | | } |
| | | return AjaxResult.success("添加成功"); |
| | | return R.ok(null, "添加成功"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateByMaintenanceTaskId(MaintenanceTask maintenanceTask) { |
| | | public R<?> updateByMaintenanceTaskId(MaintenanceTask maintenanceTask) { |
| | | MaintenanceTask maintenanceTask1 = maintenanceTaskMapper.selectById(maintenanceTask.getId()); |
| | | if (maintenanceTask1 == null) { |
| | | return AjaxResult.warn("没有此数据"); |
| | | return R.fail(HttpStatus.WARN, "没有此数据"); |
| | | } |
| | | BeanUtils.copyProperties(maintenanceTask, maintenanceTask1); |
| | | int update = maintenanceTaskMapper.updateById(maintenanceTask1); |
| | | if (update > 0) { |
| | | maintenanceTaskScheduler.rescheduleMaintenanceTask(maintenanceTask1); |
| | | } |
| | | return AjaxResult.success("更新成功"); |
| | | return R.ok(null, "更新成功"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | int delete = maintenanceTaskMapper.deleteBatchIds(ids); |
| | | if (delete > 0) { |
| | | ids.forEach(id -> { |
| | | maintenanceTaskScheduler.unscheduleMaintenanceTask(id); |
| | | }); |
| | | } |
| | | return AjaxResult.success("删除成功"); |
| | | return R.ok(null, "删除成功"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "用电区域-分页查询") |
| | | @Log(title = "用电区域-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | | public R<?> listPage(Page page, ElectricityConsumptionArea electricityConsumptionArea) { |
| | | IPage<ElectricityConsumptionArea> listPage = electricityConsumptionAreaService.listPage(page, electricityConsumptionArea); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "用电区域-新增") |
| | | @Log(title = "用电区域-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody ElectricityConsumptionArea electricityConsumptionArea) { |
| | | public R<?> add(@RequestBody ElectricityConsumptionArea electricityConsumptionArea) { |
| | | boolean save = electricityConsumptionAreaService.saveOrUpdate(electricityConsumptionArea); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "用电区域-删除") |
| | | @Log(title = "用电区域-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | boolean remove = electricityConsumptionAreaService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error(); |
| | | return remove ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "用电时段-分页查询") |
| | | @Log(title = "用电时段-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EnergyPeriod energyPeriod) { |
| | | public R<?> listPage(Page page, EnergyPeriod energyPeriod) { |
| | | IPage<EnergyPeriod> listPage = energyPeriodService.listPage(page, energyPeriod); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "用电时段-新增") |
| | | @Log(title = "用电时段-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EnergyPeriod energyPeriod) { |
| | | public R<?> add(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean save = energyPeriodService.save(energyPeriod); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @Operation(summary = "用电时段-批量新增") |
| | | @Log(title = "用电时段-批量新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | public R<?> addBatch(@RequestBody List<EnergyPeriod> energyPeriods) { |
| | | boolean save = energyPeriodService.saveBatch(energyPeriods); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "用电时段-修改") |
| | | @Log(title = "用电时段-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EnergyPeriod energyPeriod) { |
| | | public R<?> update(@RequestBody EnergyPeriod energyPeriod) { |
| | | boolean update = energyPeriodService.updateById(energyPeriod); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "用电时段-删除") |
| | | @Log(title = "用电时段-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | boolean remove = energyPeriodService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error("删除失败"); |
| | | return remove ? R.ok() : R.fail("删除失败"); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "设备能耗-分页查询") |
| | | @Log(title = "设备能耗-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPage(page, equipmentEnergyConsumption); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/deviceList") |
| | | @Operation(summary = "设备台账-查询") |
| | | @Log(title = "设备台账-查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult deviceList(DeviceLedger deviceLedger) { |
| | | public R<?> deviceList(DeviceLedger deviceLedger) { |
| | | List<DeviceLedger> listPage = equipmentEnergyConsumptionService.deviceList(deviceLedger); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "设备能耗-新增") |
| | | @Log(title = "设备能耗-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> add(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean save = equipmentEnergyConsumptionService.save(equipmentEnergyConsumption); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/addBatch") |
| | | @Operation(summary = "设备能耗-批量新增") |
| | | @Log(title = "设备能耗-批量新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | public R<?> addBatch(@RequestBody List<EquipmentEnergyConsumption> list) { |
| | | boolean save = equipmentEnergyConsumptionService.saveBatch(list); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "设备能耗-修改") |
| | | @Log(title = "设备能耗-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> update(@RequestBody EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | boolean update = equipmentEnergyConsumptionService.updateById(equipmentEnergyConsumption); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "设备能耗-删除") |
| | | @Log(title = "设备能耗-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | boolean remove = equipmentEnergyConsumptionService.removeBatchByIds(ids); |
| | | return remove ? AjaxResult.success() : AjaxResult.error(); |
| | | return remove ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "导入设备能耗", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | @Operation(summary = "导入设备能耗") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | return equipmentEnergyConsumptionService.importData(file); |
| | | } |
| | | |
| | |
| | | @GetMapping("/listPageByTrend") |
| | | @Operation(summary = "设备能耗-能源趋势-分页查询") |
| | | @Log(title = "设备能耗-能源趋势-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | public R<?> listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption) { |
| | | IPage<EquipmentEnergyConsumption> listPage = equipmentEnergyConsumptionService.listPageByTrend(page, equipmentEnergyConsumption); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.device.pojo.DeviceLedger; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | IPage<EquipmentEnergyConsumption> listPage(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R<?> importData(MultipartFile file); |
| | | |
| | | IPage<EquipmentEnergyConsumption> listPageByTrend(Page page, EquipmentEnergyConsumption equipmentEnergyConsumption); |
| | | |
| | |
| | | import com.ruoyi.equipmentenergyconsumption.mapper.EquipmentEnergyConsumptionMapper; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | import com.ruoyi.equipmentenergyconsumption.service.EquipmentEnergyConsumptionService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R<?> importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<EquipmentEnergyConsumption> util = new ExcelUtil<EquipmentEnergyConsumption>(EquipmentEnergyConsumption.class); |
| | | List<EquipmentEnergyConsumption> userList = util.importExcel(file.getInputStream()); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return AjaxResult.warn("模板错误或导入数据为空"); |
| | | return R.fail(HttpStatus.WARN, "模板错误或导入数据为空"); |
| | | } |
| | | this.saveOrUpdateBatch(userList); |
| | | return AjaxResult.success(true); |
| | | return R.ok(true); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("导入失败"); |
| | | return R.fail("导入失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.sql.SqlUtil;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.domain.R;
|
| | | import com.ruoyi.framework.web.page.PageDomain;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.framework.web.page.TableSupport;
|
| | |
| | | /**
|
| | | * 返回成功
|
| | | */
|
| | | public AjaxResult success()
|
| | | public R<?> success()
|
| | | {
|
| | | return AjaxResult.success();
|
| | | return R.ok();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返回成功消息
|
| | | */
|
| | | public AjaxResult success(String message)
|
| | | public R<?> success(String message)
|
| | | {
|
| | | return AjaxResult.success(message);
|
| | | return R.ok(null, message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返回成功消息
|
| | | */
|
| | | public AjaxResult success(Object data)
|
| | | public R<?> success(Object data)
|
| | | {
|
| | | return AjaxResult.success(data);
|
| | | return R.ok(data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返回失败消息
|
| | | */
|
| | | public AjaxResult error()
|
| | | public R<?> error()
|
| | | {
|
| | | return AjaxResult.error();
|
| | | return R.fail();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返回失败消息
|
| | | */
|
| | | public AjaxResult error(String message)
|
| | | public R<?> error(String message)
|
| | | {
|
| | | return AjaxResult.error(message);
|
| | | return R.fail(message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 返回警告消息
|
| | | */
|
| | | public AjaxResult warn(String message)
|
| | | public R<?> warn(String message)
|
| | | {
|
| | | return AjaxResult.warn(message);
|
| | | return R.fail(HttpStatus.WARN, message);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 响应返回结果
|
| | | * |
| | | *
|
| | | * @param rows 影响行数
|
| | | * @return 操作结果
|
| | | */
|
| | | protected AjaxResult toAjax(int rows)
|
| | | protected R<?> toAjax(int rows)
|
| | | {
|
| | | return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
| | | return rows > 0 ? R.ok() : R.fail();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 响应返回结果
|
| | | * |
| | | *
|
| | | * @param result 结果
|
| | | * @return 操作结果
|
| | | */
|
| | | protected AjaxResult toAjax(boolean result)
|
| | | protected R<?> toAjax(boolean result)
|
| | | {
|
| | | return result ? success() : error();
|
| | | }
|
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.home.annotation.DefaultType; |
| | | import com.ruoyi.home.dto.*; |
| | | import com.ruoyi.home.service.HomeService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | @GetMapping("/todos") |
| | | @Log(title = "待办事项", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "待办事项") |
| | | public AjaxResult todos(ApproveProcess req) throws ParseException { |
| | | public R todos(ApproveProcess req) throws ParseException { |
| | | List<ApproveProcess> approveProcessList = homeService.todos(); |
| | | return AjaxResult.success(approveProcessList); |
| | | return R.ok(approveProcessList); |
| | | } |
| | | |
| | | @GetMapping("/approveAndDeviceTodos") |
| | | @Operation(summary = "审批协同,设备报修待办事项") |
| | | public AjaxResult approveAndDeviceTodos(){ |
| | | public R approveAndDeviceTodos(){ |
| | | Map<String, Object> map = homeService.approveAndDeviceTodos(); |
| | | return AjaxResult.success(map); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | @GetMapping("/noticesCount") |
| | | @Operation(summary = "未过期的公告数量") |
| | | public AjaxResult noticesCount(){ |
| | | public R noticesCount(){ |
| | | Long count = homeService.noticesCount(); |
| | | return AjaxResult.success(count); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | @GetMapping("/deptStaffDistribution") |
| | | @Operation(summary = "各部门人员分布") |
| | | public AjaxResult deptStaffDistribution() { |
| | | public R deptStaffDistribution() { |
| | | DeptStaffDistributionDto dto = homeService.deptStaffDistribution(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/summaryStatistics") |
| | | @Operation(summary = "员工-客户-供应商总数") |
| | | public AjaxResult summaryStatistics() { |
| | | public R summaryStatistics() { |
| | | HomeSummaryDto homeSummaryDto = homeService.summaryStatistics(); |
| | | return AjaxResult.success(homeSummaryDto); |
| | | return R.ok(homeSummaryDto); |
| | | } |
| | | |
| | | /********************************************************营销采购类**************************************************/ |
| | | @GetMapping("/supplierPurchaseRanking") |
| | | @Operation(summary = "供应商采购排名") |
| | | public AjaxResult supplierPurchaseRanking(@DefaultType Integer type) { |
| | | public R supplierPurchaseRanking(@DefaultType Integer type) { |
| | | List<SupplierPurchaseRankingDto> list = homeService.supplierPurchaseRanking(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/customerRevenueAnalysis") |
| | | @Operation(summary = "客户营收贡献数值分析") |
| | | public AjaxResult customerRevenueAnalysis(Long customerId, @DefaultType Integer type) { |
| | | public R customerRevenueAnalysis(Long customerId, @DefaultType Integer type) { |
| | | CustomerRevenueAnalysisDto dto = homeService.customerRevenueAnalysis(customerId, type); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/customerContributionRanking") |
| | | @Operation(summary = "客户金额贡献排名") |
| | | public AjaxResult customerContributionRanking(@DefaultType Integer type) { |
| | | public R customerContributionRanking(@DefaultType Integer type) { |
| | | List<CustomerContributionRankingDto> list = homeService.customerContributionRanking(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productSalesAnalysis") |
| | | @Operation(summary = "各产品销售金额分析") |
| | | public AjaxResult productSalesAnalysis() { |
| | | public R productSalesAnalysis() { |
| | | List<MapDto> list = homeService.productSalesAnalysis(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/rawMaterialPurchaseAmountRatio") |
| | | @Operation(summary = "原材料采购金额占比") |
| | | public AjaxResult rawMaterialPurchaseAmountRatio(){ |
| | | public R rawMaterialPurchaseAmountRatio(){ |
| | | List<MapDto> list = homeService.rawMaterialPurchaseAmountRatio(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/business") |
| | | @Log(title = "销售-采购-库存数据", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "销售-采购-库存数据") |
| | | public AjaxResult business(HomeBusinessDto req) { |
| | | public R business(HomeBusinessDto req) { |
| | | HomeBusinessDto homeBusinessDto = homeService.business(); |
| | | return AjaxResult.success(homeBusinessDto); |
| | | return R.ok(homeBusinessDto); |
| | | } |
| | | |
| | | @GetMapping("/analysisCustomerContractAmounts") |
| | | @Log(title = "客户合同金额分析", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "客户合同金额分析") |
| | | public AjaxResult analysisCustomerContractAmounts(AnalysisCustomerContractAmountsDto req) { |
| | | public R analysisCustomerContractAmounts(AnalysisCustomerContractAmountsDto req) { |
| | | AnalysisCustomerContractAmountsDto analysisCustomerContractAmounts = homeService.analysisCustomerContractAmounts(); |
| | | return AjaxResult.success(analysisCustomerContractAmounts); |
| | | return R.ok(analysisCustomerContractAmounts); |
| | | } |
| | | |
| | | /********************************************************生产类*****************************************************/ |
| | | @GetMapping("/inputOutputAnalysis") |
| | | @Operation(summary = "投入产出分析") |
| | | public AjaxResult inputOutputAnalysis(@DefaultType Integer type){ |
| | | public R inputOutputAnalysis(@DefaultType Integer type){ |
| | | List<InputOutputAnalysisDto> list = homeService.inputOutputAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/processOutputAnalysis") |
| | | @Operation(summary = "工序产出分析") |
| | | public AjaxResult processOutputAnalysis(@DefaultType Integer type){ |
| | | public R processOutputAnalysis(@DefaultType Integer type){ |
| | | List<MapDto> list = homeService.processOutputAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/workOrderEfficiencyAnalysis") |
| | | @Operation(summary = "工单执行效率分析") |
| | | public AjaxResult workOrderEfficiencyAnalysis(@DefaultType Integer type){ |
| | | public R workOrderEfficiencyAnalysis(@DefaultType Integer type){ |
| | | List<WorkOrderEfficiencyDto> list = homeService.workOrderEfficiencyAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productionAccountingAnalysis") |
| | | @Operation(summary = "生产核算分析") |
| | | public AjaxResult productionAccountingAnalysis(@DefaultType Integer type){ |
| | | public R productionAccountingAnalysis(@DefaultType Integer type){ |
| | | List<ProductionAccountingDto> list = homeService.productionAccountingAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/orderCount") |
| | | @Operation(summary = "订单数") |
| | | public AjaxResult orderCount(){ |
| | | return AjaxResult.success(homeService.orderCount()); |
| | | public R orderCount(){ |
| | | return R.ok(homeService.orderCount()); |
| | | } |
| | | |
| | | @GetMapping("/progressStatistics") |
| | | @Operation(summary = "各生产订单的完成进度统计") |
| | | public AjaxResult progressStatistics(){ |
| | | public R progressStatistics(){ |
| | | ProductionProgressDto productionProgressDto = homeService.productionProgress(); |
| | | return AjaxResult.success(productionProgressDto); |
| | | return R.ok(productionProgressDto); |
| | | } |
| | | |
| | | @GetMapping("/workInProcessTurnover") |
| | | @Operation(summary = "在制品周转情况") |
| | | public AjaxResult workInProcessTurnover(){ |
| | | public R workInProcessTurnover(){ |
| | | ProductionTurnoverDto productionTurnoverDto = homeService.workInProcessTurnover(); |
| | | return AjaxResult.success(productionTurnoverDto); |
| | | return R.ok(productionTurnoverDto); |
| | | } |
| | | |
| | | @GetMapping("/processDataProductionStatistics") |
| | | @Operation(summary = "工序数据生产统计数据") |
| | | public AjaxResult processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processIds) { |
| | | public R processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processIds) { |
| | | List<processDataProductionStatisticsDto> list = homeService.processDataProductionStatistics(type, processIds); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /********************************************************质量类*****************************************************/ |
| | | @GetMapping("/rawMaterialDetection") |
| | | @Operation(summary = "原材料检测") |
| | | public AjaxResult rawMaterialDetection(@DefaultType Integer type){ |
| | | return AjaxResult.success(homeService.rawMaterialDetection(type)); |
| | | public R rawMaterialDetection(@DefaultType Integer type){ |
| | | return R.ok(homeService.rawMaterialDetection(type)); |
| | | } |
| | | |
| | | @GetMapping("/processDetection") |
| | | @Operation(summary = "过程检测") |
| | | public AjaxResult processDetection(@DefaultType Integer type){ |
| | | return AjaxResult.success(homeService.processDetection(type)); |
| | | public R processDetection(@DefaultType Integer type){ |
| | | return R.ok(homeService.processDetection(type)); |
| | | } |
| | | |
| | | @GetMapping("/factoryDetection") |
| | | @Operation(summary = "成品出厂检测") |
| | | public AjaxResult factoryDetection(@DefaultType Integer type){ |
| | | return AjaxResult.success(homeService.factoryDetection(type)); |
| | | public R factoryDetection(@DefaultType Integer type){ |
| | | return R.ok(homeService.factoryDetection(type)); |
| | | } |
| | | |
| | | @GetMapping("/qualityInspectionCount") |
| | | @Operation(summary = "质量检验数量") |
| | | public AjaxResult qualityInspectionCount(){ |
| | | public R qualityInspectionCount(){ |
| | | QualityInspectionCountDto qualityInspectionCountDto = homeService.qualityInspectionCount(); |
| | | return AjaxResult.success(qualityInspectionCountDto); |
| | | return R.ok(qualityInspectionCountDto); |
| | | } |
| | | |
| | | @GetMapping("/nonComplianceWarning") |
| | | @Operation(summary = "不合格预警") |
| | | public AjaxResult nonComplianceWarning(){ |
| | | public R nonComplianceWarning(){ |
| | | NonComplianceWarningDto nonComplianceWarningDto = homeService.nonComplianceWarning(); |
| | | return AjaxResult.success(nonComplianceWarningDto); |
| | | return R.ok(nonComplianceWarningDto); |
| | | } |
| | | |
| | | @GetMapping("/completedInspectionCount") |
| | | @Operation(summary = "完成检验数") |
| | | public AjaxResult completedInspectionCount(){ |
| | | public R completedInspectionCount(){ |
| | | List<CompletedInspectionCountDto> list = homeService.completedInspectionCount(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/unqualifiedProductRanking") |
| | | @Operation(summary = "不合格产品排名") |
| | | public AjaxResult unqualifiedProductRanking(){ |
| | | public R unqualifiedProductRanking(){ |
| | | List<UnqualifiedProductRankDto> list = homeService.unqualifiedProductRanking(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/unqualifiedProductProcessingAnalysis") |
| | | @Operation(summary = "不合格检品处理分析") |
| | | public AjaxResult unqualifiedProductProcessingAnalysis(){ |
| | | public R unqualifiedProductProcessingAnalysis(){ |
| | | List<MapDto> list = homeService.unqualifiedProductProcessingAnalysis(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/qualityStatistics") |
| | | @Log(title = "质量分析", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "质量分析") |
| | | public AjaxResult qualityStatistics(QualityStatisticsDto req) { |
| | | public R qualityStatistics(QualityStatisticsDto req) { |
| | | QualityStatisticsDto qualityStatisticsDto = homeService.qualityStatistics(); |
| | | return AjaxResult.success(qualityStatisticsDto); |
| | | return R.ok(qualityStatisticsDto); |
| | | } |
| | | |
| | | @GetMapping("/qualityInspectionStatistics") |
| | | @Operation(summary = "质量统计") |
| | | public AjaxResult qualityInspectionStatistics(@DefaultType Integer type) { |
| | | public R qualityInspectionStatistics(@DefaultType Integer type) { |
| | | QualityStatisticsDto dto = homeService.qualityInspectionStatistics(type); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | /********************************************************财务类*****************************************************/ |
| | | @GetMapping("/incomeExpenseAnalysis") |
| | | @Operation(summary = "支收对比分析") |
| | | public AjaxResult incomeExpenseAnalysis(@DefaultType Integer type) { |
| | | public R incomeExpenseAnalysis(@DefaultType Integer type) { |
| | | List<Map<String, Object>> result = homeService.incomeExpenseAnalysis(type); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/profitTrendAnalysis") |
| | | @Operation(summary = "利润趋势分析") |
| | | public AjaxResult profitTrendAnalysis(){ |
| | | public R profitTrendAnalysis(){ |
| | | List<MapDto> list = homeService.profitTrendAnalysis(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/expenseCompositionAnalysis") |
| | | @Operation(summary = "构成分析") |
| | | public AjaxResult expenseCompositionAnalysis(@DefaultType Integer type) { |
| | | public R expenseCompositionAnalysis(@DefaultType Integer type) { |
| | | List<MapDto> list = homeService.expenseCompositionAnalysis(type); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/monthlyIncome") |
| | | @Operation(summary = "月度收入") |
| | | public AjaxResult monthlyIncome(){ |
| | | public R monthlyIncome(){ |
| | | MonthlyIncomeDto dto = homeService.monthlyIncome(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/monthlyExpenditure") |
| | | @Operation(summary = "月度支出") |
| | | public AjaxResult monthlyExpenditure(){ |
| | | public R monthlyExpenditure(){ |
| | | MonthlyExpenditureDto dto = homeService.monthlyExpenditure(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/statisticsReceivablePayable") |
| | | @Log(title = "应收应付统计", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "应收应付统计") |
| | | public AjaxResult statisticsReceivablePayable(StatisticsReceivablePayableDto req, @DefaultType Integer type ) { |
| | | public R statisticsReceivablePayable(StatisticsReceivablePayableDto req, @DefaultType Integer type ) { |
| | | StatisticsReceivablePayableDto statisticsReceivablePayable = homeService.statisticsReceivablePayable(type); |
| | | return AjaxResult.success(statisticsReceivablePayable); |
| | | return R.ok(statisticsReceivablePayable); |
| | | } |
| | | |
| | | /********************************************************仓储类*****************************************************/ |
| | | |
| | | @GetMapping("/productCategoryDistribution") |
| | | @Operation(summary = "产品大类分布") |
| | | public AjaxResult productCategoryDistribution() { |
| | | public R productCategoryDistribution() { |
| | | ProductCategoryDistributionDto dto = homeService.productCategoryDistribution(); |
| | | return AjaxResult.success(dto); |
| | | return R.ok(dto); |
| | | } |
| | | |
| | | @GetMapping("/salesPurchaseStorageProductCount") |
| | | @Operation(summary = "销售-采购-储存产品数") |
| | | public AjaxResult salesPurchaseStorageProductCount(){ |
| | | public R salesPurchaseStorageProductCount(){ |
| | | List<MapDto> list = homeService.salesPurchaseStorageProductCount(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/productInOutAnalysis") |
| | | @Operation(summary = "产品出入库分析") |
| | | public AjaxResult productInOutAnalysis(@DefaultType Integer type){ |
| | | public R productInOutAnalysis(@DefaultType Integer type){ |
| | | List<Map<String, Object>> result = homeService.productInOutAnalysis(type); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/productTurnoverDays") |
| | | @Operation(summary = "产品周转天数") |
| | | public AjaxResult productTurnoverDays(){ |
| | | public R productTurnoverDays(){ |
| | | List<MapDto> list = homeService.productTurnoverDays(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.lavorissue.dto.StatisticsLaborIssue; |
| | | import com.ruoyi.lavorissue.mapper.LavorIssueMapper; |
| | | import com.ruoyi.lavorissue.pojo.LaborIssue; |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "劳保发放-分页查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "劳保发放-分页查询") |
| | | public AjaxResult listPage(Page page, LaborIssue laborIssue){ |
| | | public R<?> listPage(Page page, LaborIssue laborIssue){ |
| | | IPage<LaborIssue> listPage = laborIssueService.listPage(page, laborIssue); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @GetMapping("/statisticsList") |
| | | @Log(title = "劳保发放-统计查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "劳保发放-统计查询") |
| | | public AjaxResult statisticsList(LaborIssue laborIssue){ |
| | | public R<?> statisticsList(LaborIssue laborIssue){ |
| | | List<Map<String, Object>> listPage = laborIssueService.statisticsList(laborIssue); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "劳保发放-添加", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "劳保发放-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody LaborIssue laborIssue){ |
| | | public R<?> add(@RequestBody LaborIssue laborIssue){ |
| | | String today = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | StartAndEndDateDto dateTime = DailyRedisCounter.getDateTime(); |
| | | Long approveId = lavorIssueMapper.selectCount(new LambdaQueryWrapper<LaborIssue>() |
| | |
| | | laborIssue.setOrderNo(String.format("%03d", l + 1)); |
| | | } |
| | | boolean save = laborIssueService.save(laborIssue); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "劳保发放-修改", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "劳保发放-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody LaborIssue laborIssue){ |
| | | public R<?> update(@RequestBody LaborIssue laborIssue){ |
| | | boolean update = laborIssueService.updateById(laborIssue); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "劳保发放-删除", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "劳保发放-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | boolean delete = laborIssueService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @GetMapping("/statistics") |
| | | @Operation(summary = "劳保发放-统计") |
| | | public AjaxResult statistics(StatisticsLaborIssue req) throws Exception { |
| | | public R<?> statistics(StatisticsLaborIssue req) throws Exception { |
| | | StatisticsLaborIssue statisticsLaborIssue = laborIssueService.statistics(req); |
| | | return AjaxResult.success(statisticsLaborIssue); |
| | | return R.ok(statisticsLaborIssue); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.dto.MeasuringInstrumentLedgerDto; |
| | | import com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "计量器具台账-分页查询") |
| | | @Log(title = "计量器具台账-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | public R<?> listPage(Page page, MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | IPage<MeasuringInstrumentLedger> listPage = measuringInstrumentLedgerService.listPage(page, measuringInstrumentLedger); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | |
| | |
| | | @Operation(summary = "计量器具台账-新增") |
| | | @Log(title = "计量器具台账-新增", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | public R<?> add(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) throws IOException { |
| | | boolean save = measuringInstrumentLedgerService.add(measuringInstrumentLedger); |
| | | if (save) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "计量器具台账-修改") |
| | | @Log(title = "计量器具台账-修改", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | public R<?> update(@RequestBody MeasuringInstrumentLedger measuringInstrumentLedger) { |
| | | SysUser sysUser = sysUserMapper.selectUserById(measuringInstrumentLedger.getUserId()); |
| | | if (sysUser == null) { |
| | | return AjaxResult.error("用户不存在"); |
| | | return R.fail("用户不存在"); |
| | | } |
| | | measuringInstrumentLedger.setUserName(sysUser.getUserName()); |
| | | boolean update = measuringInstrumentLedgerService.updateById(measuringInstrumentLedger); |
| | | if (update) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "计量器具台账-删除") |
| | | @Log(title = "计量器具台账-删除", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | for (Long id : ids) { |
| | | LambdaQueryWrapper<MeasuringInstrumentLedgerRecord> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(MeasuringInstrumentLedgerRecord::getMeasuringInstrumentLedgerId,id); |
| | | List<MeasuringInstrumentLedgerRecord> measuringInstrumentLedgerRecords = measuringInstrumentLedgerRecordMapper.selectList(queryWrapper); |
| | | if(!CollectionUtils.isEmpty(measuringInstrumentLedgerRecords)){ |
| | | return AjaxResult.error("请先删除选中计量器具台账下的所有检定记录"); |
| | | return R.fail("请先删除选中计量器具台账下的所有检定记录"); |
| | | } |
| | | } |
| | | boolean delete = measuringInstrumentLedgerService.removeBatchByIds(ids); |
| | | if (delete) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/verifying") |
| | | @Operation(summary = "计量器具台账-检定") |
| | | @Log(title = "计量器具台账-检定", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult verifying(@RequestBody MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException { |
| | | public R<?> verifying(@RequestBody MeasuringInstrumentLedgerDto measuringInstrumentLedger) throws IOException { |
| | | boolean update = measuringInstrumentLedgerService.verifying(measuringInstrumentLedger); |
| | | return update ? AjaxResult.success("检定成功") : AjaxResult.error("检定失败"); |
| | | return update ? R.ok(null, "检定成功") : R.fail("检定失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord; |
| | | import com.ruoyi.measuringinstrumentledger.service.MeasuringInstrumentLedgerRecordService; |
| | | import io.jsonwebtoken.lang.Collections; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "计量器具台账记录-分页查询") |
| | | @Log(title = "计量器具台账记录-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord){ |
| | | public R<?> listPage(Page page, MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord){ |
| | | IPage<MeasuringInstrumentLedgerRecord> listPage = measuringInstrumentLedgerRecordService.listPage(page, measuringInstrumentLedgerRecord); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "计量器具台账记录-修改") |
| | | @Log(title = "计量器具台账记录-修改", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) throws IOException { |
| | | public R<?> update(@RequestBody MeasuringInstrumentLedgerRecord measuringInstrumentLedgerRecord) throws IOException { |
| | | boolean update = measuringInstrumentLedgerRecordService.updateMeasuringInstrumentLedgerRecord(measuringInstrumentLedgerRecord); |
| | | if (update) { |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | return AjaxResult.error(); |
| | | return R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "计量器具台账记录-删除") |
| | | @Log(title = "计量器具台账记录-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(Collections.isEmpty(ids)) return AjaxResult.error("请选择要删除的数据"); |
| | | return AjaxResult.success(measuringInstrumentLedgerRecordService.removeBatchByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(Collections.isEmpty(ids)) return R.fail("请选择要删除的数据"); |
| | | return R.ok(measuringInstrumentLedgerRecordService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsDto; |
| | | import com.ruoyi.measuringinstrumentledger.pojo.SpareParts; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsService; |
| | |
| | | @RequestMapping("/spareParts") |
| | | @Tag(name = "备件分类接口") |
| | | @AllArgsConstructor |
| | | public class SparePartsController { |
| | | public class SparePartsController extends BaseController { |
| | | private SparePartsService sparePartsService; |
| | | @GetMapping("/getTree") |
| | | @Operation(summary = "备件分类-树结构") |
| | | public AjaxResult getTree(){ |
| | | public R<?> getTree(){ |
| | | List<SparePartsDto> tree = sparePartsService.getTree(); |
| | | return AjaxResult.success(tree); |
| | | return R.ok(tree); |
| | | } |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "备件分类-分页查询") |
| | | public AjaxResult listPage(Page page, SpareParts spareParts){ |
| | | public R<?> listPage(Page page, SpareParts spareParts){ |
| | | IPage<SparePartsDto> listPage = sparePartsService.listPage(page, spareParts); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | // @GetMapping("/list") |
| | | // @Operation(summary = "备件分类-查询所有") |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "备件分类-添加") |
| | | @Log(title = "备件分类-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.save(spareParts)); |
| | | public R<?> add(@RequestBody SpareParts spareParts){ |
| | | return R.ok(sparePartsService.save(spareParts)); |
| | | } |
| | | @PostMapping("/update") |
| | | @Operation(summary = "备件分类-更新") |
| | | @Log(title = "备件分类-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody SpareParts spareParts){ |
| | | return AjaxResult.success(sparePartsService.updateById(spareParts)); |
| | | public R<?> update(@RequestBody SpareParts spareParts){ |
| | | return R.ok(sparePartsService.updateById(spareParts)); |
| | | } |
| | | @DeleteMapping("/delete/{id}") |
| | | @Operation(summary = "备件分类-删除") |
| | | @Log(title = "备件分类-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@PathVariable Long id){ |
| | | return AjaxResult.success(sparePartsService.removeById(id)); |
| | | public R<?> delete(@PathVariable Long id){ |
| | | return R.ok(sparePartsService.removeById(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.measuringinstrumentledger.dto.SparePartsRequisitionRecordDto; |
| | | import com.ruoyi.measuringinstrumentledger.service.SparePartsRequisitionRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RequestMapping("/sparePartsRequisitionRecord") |
| | | @Tag(name = "备件领用记录接口") |
| | | @AllArgsConstructor |
| | | public class SparePartsRequisitionRecordController { |
| | | public class SparePartsRequisitionRecordController extends BaseController { |
| | | private SparePartsRequisitionRecordService sparePartsRequisitionRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "备件分类-分页查询") |
| | | public AjaxResult listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto){ |
| | | public R<?> listPage(Page page, SparePartsRequisitionRecordDto sparePartsRequisitionRecordDto){ |
| | | IPage<SparePartsRequisitionRecordDto> listPage = sparePartsRequisitionRecordService.listPage(page, sparePartsRequisitionRecordDto); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | import com.ruoyi.officesupplies.service.OfficeSuppliesService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "办公物资-分页查询") |
| | | public AjaxResult listPage(Page page, OfficeSupplies officeSupplies) { |
| | | public R<?> listPage(Page page, OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.listPage(page, officeSupplies); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "办公物资-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody OfficeSupplies officeSupplies) { |
| | | public R<?> add(@RequestBody OfficeSupplies officeSupplies) { |
| | | // 按照当前时间yyyyMMdd + 当天新增数量 + 1生成编号 |
| | | // 获取当天新增数量 |
| | | long count = officeSuppliesService.count(new LambdaQueryWrapper<OfficeSupplies>() |
| | |
| | | officeSupplies.setCode(code); |
| | | officeSupplies.setStatus(1); |
| | | officeSupplies.setApplyTime(new Date()); |
| | | return officeSuppliesService.save(officeSupplies) ? success() : error(); |
| | | return officeSuppliesService.save(officeSupplies) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "办公物资-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.updateById(officeSupplies) ? success() : error(); |
| | | public R<?> update(@RequestBody OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.updateById(officeSupplies) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "办公物资-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return officeSuppliesService.removeBatchByIds(ids) ? success() : error(); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return officeSuppliesService.removeBatchByIds(ids) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | |
| | | /** |
| | |
| | | * @param officeSupplies |
| | | * @return |
| | | */ |
| | | AjaxResult listPage(Page page, OfficeSupplies officeSupplies); |
| | | R<?> listPage(Page page, OfficeSupplies officeSupplies); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.officesupplies.mapper.OfficeSuppliesMapper; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | import com.ruoyi.officesupplies.service.OfficeSuppliesService; |
| | |
| | | private final OfficeSuppliesMapper officeSuppliesMapper; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, OfficeSupplies officeSupplies) { |
| | | public R<?> listPage(Page page, OfficeSupplies officeSupplies) { |
| | | IPage<OfficeSupplies> list = officeSuppliesMapper.listPage(page, officeSupplies); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.GasTankWarning; |
| | | import com.ruoyi.procurementrecord.service.GasTankWarningService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RestController |
| | | @RequestMapping("/gasTankWarning") |
| | | @AllArgsConstructor |
| | | public class GasTankWarningController { |
| | | public class GasTankWarningController extends BaseController { |
| | | private GasTankWarningService gasTankWarningService; |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, GasTankWarning gasTankWarning) { |
| | | return AjaxResult.success(gasTankWarningService.listPage(page, gasTankWarning)); |
| | | public R<?> listPage(Page page, GasTankWarning gasTankWarning) { |
| | | return R.ok(gasTankWarningService.listPage(page, gasTankWarning)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody GasTankWarning gasTankWarning) { |
| | | return AjaxResult.success(gasTankWarningService.save(gasTankWarning)); |
| | | public R<?> add(@RequestBody GasTankWarning gasTankWarning) { |
| | | return R.ok(gasTankWarningService.save(gasTankWarning)); |
| | | } |
| | | |
| | | @PostMapping("update") |
| | | public AjaxResult update(@RequestBody GasTankWarning gasTankWarning) { |
| | | return AjaxResult.success(gasTankWarningService.updateById(gasTankWarning)); |
| | | public R<?> update(@RequestBody GasTankWarning gasTankWarning) { |
| | | return R.ok(gasTankWarningService.updateById(gasTankWarning)); |
| | | } |
| | | |
| | | @DeleteMapping("delete") |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(gasTankWarningService.removeByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(gasTankWarningService.removeByIds(ids)); |
| | | } |
| | | |
| | | //导出 |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.InboundManagement; |
| | | import com.ruoyi.procurementrecord.service.InboundManagementService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "到货管理-查询") |
| | | public AjaxResult listPage(Page page, InboundManagement inboundManagement) { |
| | | public R<?> listPage(Page page, InboundManagement inboundManagement) { |
| | | IPage<InboundManagement> result = inboundManagementService.listPage(page, inboundManagement); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "到货管理-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody InboundManagement inboundManagement) { |
| | | public R<?> add(@RequestBody InboundManagement inboundManagement) { |
| | | inboundManagement.setArrivalTime(new Date()); |
| | | boolean result = inboundManagementService.save(inboundManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "到货管理-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody InboundManagement inboundManagement) { |
| | | public R<?> update(@RequestBody InboundManagement inboundManagement) { |
| | | boolean result = inboundManagementService.updateById(inboundManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "到货管理-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult del(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> del(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | boolean result = inboundManagementService.removeByIds(ids); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.procurementrecord.controller; |
| | | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementExceptionRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementExceptionRecord; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @PostMapping("/add") |
| | | @Transactional |
| | | public AjaxResult add(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return AjaxResult.success(procurementExceptionRecordMapper.insert(procurementExceptionRecord)); |
| | | public R<?> add(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return R.ok(procurementExceptionRecordMapper.insert(procurementExceptionRecord)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Transactional |
| | | public AjaxResult updatePro(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return AjaxResult.success(procurementExceptionRecordMapper.updateById(procurementExceptionRecord)); |
| | | public R<?> updatePro(@RequestBody ProcurementExceptionRecord procurementExceptionRecord) { |
| | | return R.ok(procurementExceptionRecordMapper.updateById(procurementExceptionRecord)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementPlan; |
| | | import com.ruoyi.procurementrecord.service.ProcurementPlanService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @RequestMapping("/listPage") |
| | | @Operation(summary = "采购计划-查询") |
| | | public AjaxResult listPage(Page page, ProcurementPlan procurementPlan){ |
| | | public R<?> listPage(Page page, ProcurementPlan procurementPlan){ |
| | | IPage<ProcurementPlan> result = procurementPlanService.listPage(page, procurementPlan); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "采购计划-添加") |
| | | public AjaxResult add(@RequestBody ProcurementPlan procurementPlan){ |
| | | public R<?> add(@RequestBody ProcurementPlan procurementPlan){ |
| | | boolean result = procurementPlanService.save(procurementPlan); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "采购计划-修改") |
| | | public AjaxResult update(@RequestBody ProcurementPlan procurementPlan){ |
| | | public R<?> update(@RequestBody ProcurementPlan procurementPlan){ |
| | | boolean result = procurementPlanService.updateById(procurementPlan); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "采购计划-删除") |
| | | public AjaxResult del(@RequestBody List<Long> ids){ |
| | | public R<?> del(@RequestBody List<Long> ids){ |
| | | boolean result = procurementPlanService.removeByIds(ids); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementPriceManagement; |
| | | import com.ruoyi.procurementrecord.service.ProcurementPriceManagementService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "采购价格管理-查询") |
| | | public AjaxResult listPage(Page page, ProcurementPriceManagement procurementPriceManagement){ |
| | | public R<?> listPage(Page page, ProcurementPriceManagement procurementPriceManagement){ |
| | | IPage<ProcurementPriceManagement> result = procurementPriceManagementService.listPage(page, procurementPriceManagement); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "采购价格管理-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | public R<?> add(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | boolean result = procurementPriceManagementService.save(procurementPriceManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "采购价格管理-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | public R<?> update(@RequestBody ProcurementPriceManagement procurementPriceManagement){ |
| | | boolean result = procurementPriceManagementService.updateById(procurementPriceManagement); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "采购价格管理-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if (ids == null || ids.isEmpty()) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | boolean result = procurementPriceManagementService.removeByIds(ids); |
| | | return result ? AjaxResult.success() : AjaxResult.error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | |
| | | */ |
| | | @GetMapping("/getProcurementAmount") |
| | | @Operation(summary = "通过销售产品id获取入库数量") |
| | | public AjaxResult getProcurementAmount(@RequestParam("salesProductId") Long salesProductId) { |
| | | return AjaxResult.success(procurementRecordService.getProcurementAmount(salesProductId)); |
| | | public R<?> getProcurementAmount(@RequestParam("salesProductId") Long salesProductId) { |
| | | return R.ok(procurementRecordService.getProcurementAmount(salesProductId)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/productlist") |
| | | @Log(title = "采购入库-入库管理-新增入库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult list(ProcurementDto procurementDto) { |
| | | public R<?> list(ProcurementDto procurementDto) { |
| | | List<ProcurementDto> result = procurementRecordService.listProcurementBySalesLedgerId(procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "采购入库-入库管理-新增入库", businessType = BusinessType.INSERT) |
| | | @Transactional |
| | | public AjaxResult add(@RequestBody ProcurementAddDto procurementDto) { |
| | | public R<?> add(@RequestBody ProcurementAddDto procurementDto) { |
| | | procurementDto.setType(1); |
| | | procurementDto.setTypeName("采购入库"); |
| | | return AjaxResult.success(procurementRecordService.add(procurementDto)); |
| | | return R.ok(procurementRecordService.add(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/addCustom") |
| | | @Log(title = "自定义入库-入库管理-新增入库", businessType = BusinessType.INSERT) |
| | | @Transactional |
| | | public AjaxResult addCustom(@RequestBody List<CustomStorage> customStorage) { |
| | | public R<?> addCustom(@RequestBody List<CustomStorage> customStorage) { |
| | | return procurementRecordService.addCustom(customStorage); |
| | | } |
| | | |
| | | @PostMapping("/updateCustom") |
| | | @Log(title = "自定义入库-入库管理-修改入库", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updateCustom(@RequestBody CustomStorage customStorage) { |
| | | public R<?> updateCustom(@RequestBody CustomStorage customStorage) { |
| | | return procurementRecordService.updateCustom(customStorage); |
| | | } |
| | | |
| | | @Delete("/delteCustom") |
| | | @Log(title = "自定义入库-入库管理-删除入库", businessType = BusinessType.DELETE) |
| | | @Transactional |
| | | public AjaxResult deleteCustom(@RequestBody List<Long> ids) { |
| | | public R<?> deleteCustom(@RequestBody List<Long> ids) { |
| | | return procurementRecordService.deleteCustom(ids); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "采购入库-入库管理-修改入库", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updatePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.updatePro(procurementDto)); |
| | | public R<?> updatePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.updatePro(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/updateManagement") |
| | | @Log(title = "成品入库-库存台账-修改", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updateManagement(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.updateManagement(procurementDto)); |
| | | public R<?> updateManagement(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.updateManagement(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/updateManagementByCustom") |
| | | @Log(title = "自定义入库-库存台账-修改", businessType = BusinessType.UPDATE) |
| | | @Transactional |
| | | public AjaxResult updateManagementByCustom(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.updateManagementByCustom(procurementDto)); |
| | | public R<?> updateManagementByCustom(@RequestBody ProcurementManagementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.updateManagementByCustom(procurementDto)); |
| | | } |
| | | |
| | | @PostMapping("/del") |
| | | @Log(title = "采购入库-入库管理-删除入库", businessType = BusinessType.DELETE) |
| | | @Transactional |
| | | public AjaxResult deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.deletePro(procurementDto)); |
| | | public R<?> deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordService.deletePro(procurementDto)); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "采购入库-入库管理-入库查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "入库查询") |
| | | public AjaxResult listPage(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPage(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPage(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listReport") |
| | | @Operation(summary = "查询库存图表数据") |
| | | public AjaxResult listReport() { |
| | | return AjaxResult.success(procurementRecordService.getReportList()); |
| | | public R<?> listReport() { |
| | | return R.ok(procurementRecordService.getReportList()); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProduction") |
| | | @Log(title = "生产入库-入库管理-入库查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "入库查询") |
| | | public AjaxResult listPageByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPageByProduction(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProductProduction") |
| | | @Log(title = "生产入库-入库管理-生产入库查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "入库查询") |
| | | public AjaxResult listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageByProductProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDto> result = procurementRecordService.listPageByProductProduction(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByCustom") |
| | | @Log(title = "自定义入库-入库管理-入库查询", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "入库查询") |
| | | public AjaxResult listPageByCustom(Page page, CustomStorage customStorage) { |
| | | public R<?> listPageByCustom(Page page, CustomStorage customStorage) { |
| | | IPage<CustomStorage> result = procurementRecordService.listPageByCustom(page, customStorage); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageCopy") |
| | | @Log(title = "采购入库-库存管理-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageCopy(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageCopy(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopy(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageCopyByProduction") |
| | | @Log(title = "生产入库-库存管理-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageCopyByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageCopyByProduction(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageCopyByCustom") |
| | | @Log(title = "自定义入库-库存管理-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageCopyByCustom(Page page, CustomStorage customStorage) { |
| | | public R<?> listPageCopyByCustom(Page page, CustomStorage customStorage) { |
| | | IPage<CustomStorage> result = procurementRecordService.listPageCopyByCustom(page, customStorage); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/getReportList") |
| | | @Log(title = "库存报表查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult getReportList(Page page, ProcurementPageDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordService.getReportList(page, procurementDto)); |
| | | public R<?> getReportList(Page page, ProcurementPageDto procurementDto) { |
| | | return R.ok(procurementRecordService.getReportList(page, procurementDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/listPageProductionStock") |
| | | @Log(title = "库存管理-成品库存", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageProductionStock(Page page, ProcurementPageDto procurementDto) { |
| | | public R<?> listPageProductionStock(Page page, ProcurementPageDto procurementDto) { |
| | | IPage<ProductModel> result = procurementRecordService.listPageProductionStock(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutAdd; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementRecordOutPageDto; |
| | | import com.ruoyi.procurementrecord.bean.dto.ProcurementUpdateDto; |
| | |
| | | |
| | | @PostMapping("/stockout") |
| | | @Log(title = "采购出库-出库管理-出库", businessType = BusinessType.INSERT) |
| | | public AjaxResult stockout(@RequestBody ProcurementRecordOutAdd procurementRecordOutAdd) { |
| | | return AjaxResult.success(procurementRecordOutService.stockout(procurementRecordOutAdd)); |
| | | public R<?> stockout(@RequestBody ProcurementRecordOutAdd procurementRecordOutAdd) { |
| | | return R.ok(procurementRecordOutService.stockout(procurementRecordOutAdd)); |
| | | } |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "采购出库-出库台账-出库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPage(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPage(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByProduct") |
| | | @Log(title = "生产出库-出库台账-出库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPageByProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageByProduct(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageBySemiProduct") |
| | | @Log(title = "生产出库-出库台账-出库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPageBySemiProduct(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageBySemiProduct(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @GetMapping("/listPageByCustom") |
| | | @Log(title = "自定义出库-出库台账-出库查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | public R<?> listPageByCustom(Page page, ProcurementRecordOutPageDto procurementDto) { |
| | | IPage<ProcurementRecordOutPageDto> result = procurementRecordOutService.listPageByCustom(page, procurementDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/del") |
| | | @Log(title = "采购出库-出库台账-删除出库", businessType = BusinessType.DELETE) |
| | | public AjaxResult deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return AjaxResult.success(procurementRecordOutService.deletePro(procurementDto)); |
| | | public R<?> deletePro(@RequestBody ProcurementUpdateDto procurementDto) { |
| | | return R.ok(procurementRecordOutService.deletePro(procurementDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.ReturnManagementDto; |
| | | import com.ruoyi.procurementrecord.bean.vo.ShippingInfoVo; |
| | | import com.ruoyi.procurementrecord.pojo.ReturnSaleProduct; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "销售退货-查询") |
| | | public AjaxResult listPage(Page page, ReturnManagementDto returnManagement) { |
| | | public R<?> listPage(Page page, ReturnManagementDto returnManagement) { |
| | | IPage<ReturnManagementDto> result = returnManagementService.listPage(page, returnManagement); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "销售退货-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.addReturnManagementDto(returnManagementDto) ? success() : error(); |
| | | public R<?> add(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.addReturnManagementDto(returnManagementDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "销售退货-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.updateReturnManagementDto(returnManagementDto) ? success() : error(); |
| | | public R<?> update(@RequestBody ReturnManagementDto returnManagementDto) { |
| | | return returnManagementService.updateReturnManagementDto(returnManagementDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | @Operation(summary = "销售退货-处理退货单") |
| | | @GetMapping("/handle") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult handle(Long returnManagementId) { |
| | | return returnManagementService.handle(returnManagementId) ? success() : error(); |
| | | public R<?> handle(Long returnManagementId) { |
| | | return returnManagementService.handle(returnManagementId) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/del") |
| | | @Operation(summary = "销售退货-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult del(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return error("请选择至少一条数据"); |
| | | public R<?> del(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | returnSaleProductService.remove(new QueryWrapper<ReturnSaleProduct>() |
| | | .lambda() |
| | | .in(ReturnSaleProduct::getReturnManagementId, ids)); |
| | | boolean result = returnManagementService.removeByIds(ids); |
| | | return result ? success() : error(); |
| | | return result ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @GetMapping("/getById") |
| | | @Operation(summary = "销售退货-根据id查询") |
| | | public AjaxResult getById(Long returnManagementId) { |
| | | public R<?> getById(Long returnManagementId) { |
| | | ReturnManagementDto returnManagementDto = returnManagementService.getReturnManagementDtoById(returnManagementId); |
| | | return success(returnManagementDto); |
| | | return R.ok(returnManagementDto); |
| | | } |
| | | |
| | | @GetMapping("/getByShippingId") |
| | | @Operation(summary = "销售退货-根据发货单查询销售订单以及出库的产品信息") |
| | | public AjaxResult getByShippingId(Long shippingId) { |
| | | public R<?> getByShippingId(Long shippingId) { |
| | | ShippingInfoVo shippingInfoVo = returnManagementService.getReturnManagementDtoByShippingIdId(shippingId); |
| | | return success(shippingInfoVo); |
| | | return R.ok(shippingInfoVo); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.pojo.CustomStorage; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | |
| | | |
| | | IPage<ProcurementPageDto> listPageByProduction(Page page, ProcurementPageDto procurementDto); |
| | | |
| | | AjaxResult addCustom(List<CustomStorage> customStorage); |
| | | R<?> addCustom(List<CustomStorage> customStorage); |
| | | |
| | | IPage<CustomStorage> listPageByCustom(Page page, CustomStorage customStorage); |
| | | |
| | |
| | | |
| | | IPage<CustomStorage> listPageCopyByCustom(Page page, CustomStorage customStorage); |
| | | |
| | | AjaxResult updateCustom(CustomStorage customStorage); |
| | | R<?> updateCustom(CustomStorage customStorage); |
| | | |
| | | AjaxResult deleteCustom(List<Long> ids); |
| | | R<?> deleteCustom(List<Long> ids); |
| | | |
| | | int updateManagementByCustom(ProcurementManagementUpdateDto procurementDto); |
| | | |
| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.bean.dto.*; |
| | | import com.ruoyi.procurementrecord.mapper.CustomStorageMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | |
| | | private final CustomStorageMapper customStorageMapper; |
| | | |
| | | @Override |
| | | public AjaxResult addCustom(List<CustomStorage> customStorage) { |
| | | public R<?> addCustom(List<CustomStorage> customStorage) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if(CollectionUtils.isEmpty(customStorage)){ |
| | | return AjaxResult.error("数据不能为空"); |
| | | return R.fail("数据不能为空"); |
| | | } |
| | | customStorage.forEach(item -> { |
| | | // 查询采购入库数量 |
| | |
| | | item.setCode(OrderUtils.countTodayByCreateTime(customStorageMapper, "", "code")); |
| | | customStorageMapper.insert(item); |
| | | }); |
| | | return AjaxResult.success("自定义入库成功"); |
| | | return R.ok(null, "自定义入库成功"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateCustom(CustomStorage customStorage) { |
| | | return AjaxResult.success(customStorageMapper.updateById(customStorage)); |
| | | public R<?> updateCustom(CustomStorage customStorage) { |
| | | return R.ok(customStorageMapper.updateById(customStorage)); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult deleteCustom(List<Long> ids) { |
| | | return AjaxResult.success(customStorageMapper.deleteBatchIds(ids)); |
| | | public R<?> deleteCustom(List<Long> ids) { |
| | | return R.ok(customStorageMapper.deleteBatchIds(ids)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.ruoyi.project.common;
|
| | |
|
| | | import com.google.code.kaptcha.Producer;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.sign.Base64;
|
| | | import com.ruoyi.common.utils.uuid.IdUtils;
|
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import jakarta.annotation.Resource;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.util.FastByteArrayOutputStream;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | import javax.imageio.ImageIO;
|
| | | import java.awt.image.BufferedImage;
|
| | | import java.io.IOException;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | /**
|
| | | * 验证码操作处理
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequiredArgsConstructor
|
| | | public class CaptchaController
|
| | | {
|
| | | @Resource(name = "captchaProducer")
|
| | | private Producer captchaProducer;
|
| | |
|
| | | @Resource(name = "captchaProducerMath")
|
| | | private Producer captchaProducerMath;
|
| | |
|
| | | private final RedisCache redisCache;
|
| | | |
| | | // 验证码类型
|
| | | @Value("${ruoyi.captchaType}")
|
| | | private String captchaType;
|
| | | |
| | | private final ISysConfigService configService;
|
| | |
|
| | | /**
|
| | | * 生成验证码
|
| | | */
|
| | | @GetMapping("/captchaImage")
|
| | | public AjaxResult getCode(HttpServletResponse response) throws IOException
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | boolean captchaEnabled = configService.selectCaptchaEnabled();
|
| | | ajax.put("captchaEnabled", captchaEnabled);
|
| | | if (!captchaEnabled)
|
| | | {
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | // 保存验证码信息
|
| | | String uuid = IdUtils.simpleUUID();
|
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
|
| | |
|
| | | String capStr = null, code = null;
|
| | | BufferedImage image = null;
|
| | |
|
| | | // 生成验证码
|
| | | if ("math".equals(captchaType))
|
| | | {
|
| | | String capText = captchaProducerMath.createText();
|
| | | capStr = capText.substring(0, capText.lastIndexOf("@"));
|
| | | code = capText.substring(capText.lastIndexOf("@") + 1);
|
| | | image = captchaProducerMath.createImage(capStr);
|
| | | }
|
| | | else if ("char".equals(captchaType))
|
| | | {
|
| | | capStr = code = captchaProducer.createText();
|
| | | image = captchaProducer.createImage(capStr);
|
| | | }
|
| | |
|
| | | redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
| | | // 转换流信息写出
|
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
| | | try
|
| | | {
|
| | | ImageIO.write(image, "jpg", os);
|
| | | }
|
| | | catch (IOException e)
|
| | | {
|
| | | return AjaxResult.error(e.getMessage());
|
| | | }
|
| | |
|
| | | ajax.put("uuid", uuid);
|
| | | ajax.put("img", Base64.encode(os.toByteArray()));
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.common; |
| | | |
| | | import com.google.code.kaptcha.Producer; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.sign.Base64; |
| | | import com.ruoyi.common.utils.uuid.IdUtils; |
| | | import com.ruoyi.framework.redis.RedisCache; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.service.ISysConfigService; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.util.FastByteArrayOutputStream; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 验证码操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | public class CaptchaController |
| | | { |
| | | @Resource(name = "captchaProducer") |
| | | private Producer captchaProducer; |
| | | |
| | | @Resource(name = "captchaProducerMath") |
| | | private Producer captchaProducerMath; |
| | | |
| | | private final RedisCache redisCache; |
| | | |
| | | // 验证码类型 |
| | | @Value("${ruoyi.captchaType}") |
| | | private String captchaType; |
| | | |
| | | private final ISysConfigService configService; |
| | | |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | | @GetMapping("/captchaImage") |
| | | public R<?> getCode(HttpServletResponse response) throws IOException |
| | | { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | boolean captchaEnabled = configService.selectCaptchaEnabled(); |
| | | map.put("captchaEnabled", captchaEnabled); |
| | | if (!captchaEnabled) |
| | | { |
| | | return R.ok(map); |
| | | } |
| | | |
| | | // 保存验证码信息 |
| | | String uuid = IdUtils.simpleUUID(); |
| | | String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; |
| | | |
| | | String capStr = null, code = null; |
| | | BufferedImage image = null; |
| | | |
| | | // 生成验证码 |
| | | if ("math".equals(captchaType)) |
| | | { |
| | | String capText = captchaProducerMath.createText(); |
| | | capStr = capText.substring(0, capText.lastIndexOf("@")); |
| | | code = capText.substring(capText.lastIndexOf("@") + 1); |
| | | image = captchaProducerMath.createImage(capStr); |
| | | } |
| | | else if ("char".equals(captchaType)) |
| | | { |
| | | capStr = code = captchaProducer.createText(); |
| | | image = captchaProducer.createImage(capStr); |
| | | } |
| | | |
| | | redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); |
| | | // 转换流信息写出 |
| | | FastByteArrayOutputStream os = new FastByteArrayOutputStream(); |
| | | try |
| | | { |
| | | ImageIO.write(image, "jpg", os); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | |
| | | map.put("uuid", uuid); |
| | | map.put("img", Base64.encode(os.toByteArray())); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.monitor.domain.SysCache;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.data.redis.core.RedisCallback;
|
| | | import org.springframework.data.redis.core.RedisTemplate;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.*;
|
| | |
|
| | | /**
|
| | | * 缓存监控
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/cache")
|
| | | @AllArgsConstructor
|
| | | public class CacheController
|
| | | {
|
| | | private RedisTemplate<String, String> redisTemplate;
|
| | |
|
| | | private final static List<SysCache> caches = new ArrayList<SysCache>();
|
| | | {
|
| | | caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息"));
|
| | | caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息"));
|
| | | caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典"));
|
| | | caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码"));
|
| | | caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
|
| | | caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
|
| | | caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping()
|
| | | public AjaxResult getInfo() throws Exception
|
| | | {
|
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
|
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
|
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
|
| | |
|
| | | Map<String, Object> result = new HashMap<>(3);
|
| | | result.put("info", info);
|
| | | result.put("dbSize", dbSize);
|
| | |
|
| | | List<Map<String, String>> pieList = new ArrayList<>();
|
| | | commandStats.stringPropertyNames().forEach(key -> {
|
| | | Map<String, String> data = new HashMap<>(2);
|
| | | String property = commandStats.getProperty(key);
|
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_"));
|
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
|
| | | pieList.add(data);
|
| | | });
|
| | | result.put("commandStats", pieList);
|
| | | return AjaxResult.success(result);
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping("/getNames")
|
| | | public AjaxResult cache()
|
| | | {
|
| | | return AjaxResult.success(caches);
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping("/getKeys/{cacheName}")
|
| | | public AjaxResult getCacheKeys(@PathVariable String cacheName)
|
| | | {
|
| | | Set<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
| | | return AjaxResult.success(new TreeSet<>(cacheKeys));
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}")
|
| | | public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
|
| | | {
|
| | | String cacheValue = redisTemplate.opsForValue().get(cacheKey);
|
| | | SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
|
| | | return AjaxResult.success(sysCache);
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @DeleteMapping("/clearCacheName/{cacheName}")
|
| | | public AjaxResult clearCacheName(@PathVariable String cacheName)
|
| | | {
|
| | | Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*");
|
| | | redisTemplate.delete(cacheKeys);
|
| | | return AjaxResult.success();
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @DeleteMapping("/clearCacheKey/{cacheKey}")
|
| | | public AjaxResult clearCacheKey(@PathVariable String cacheKey)
|
| | | {
|
| | | redisTemplate.delete(cacheKey);
|
| | | return AjaxResult.success();
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
|
| | | @DeleteMapping("/clearCacheAll")
|
| | | public AjaxResult clearCacheAll()
|
| | | {
|
| | | Collection<String> cacheKeys = redisTemplate.keys("*");
|
| | | redisTemplate.delete(cacheKeys);
|
| | | return AjaxResult.success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.monitor.domain.SysCache; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.data.redis.core.RedisCallback; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 缓存监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/cache") |
| | | @AllArgsConstructor |
| | | public class CacheController extends BaseController |
| | | { |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | |
| | | private final static List<SysCache> caches = new ArrayList<SysCache>(); |
| | | { |
| | | caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); |
| | | caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息")); |
| | | caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典")); |
| | | caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); |
| | | caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); |
| | | caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); |
| | | caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping() |
| | | public R<?> getInfo() throws Exception |
| | | { |
| | | Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); |
| | | Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); |
| | | Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); |
| | | |
| | | Map<String, Object> result = new HashMap<>(3); |
| | | result.put("info", info); |
| | | result.put("dbSize", dbSize); |
| | | |
| | | List<Map<String, String>> pieList = new ArrayList<>(); |
| | | commandStats.stringPropertyNames().forEach(key -> { |
| | | Map<String, String> data = new HashMap<>(2); |
| | | String property = commandStats.getProperty(key); |
| | | data.put("name", StringUtils.removeStart(key, "cmdstat_")); |
| | | data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); |
| | | pieList.add(data); |
| | | }); |
| | | result.put("commandStats", pieList); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getNames") |
| | | public R<?> cache() |
| | | { |
| | | return R.ok(caches); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getKeys/{cacheName}") |
| | | public R<?> getCacheKeys(@PathVariable String cacheName) |
| | | { |
| | | Set<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | return R.ok(new TreeSet<>(cacheKeys)); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @GetMapping("/getValue/{cacheName}/{cacheKey}") |
| | | public R<?> getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) |
| | | { |
| | | String cacheValue = redisTemplate.opsForValue().get(cacheKey); |
| | | SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); |
| | | return R.ok(sysCache); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheName/{cacheName}") |
| | | public R<?> clearCacheName(@PathVariable String cacheName) |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys(cacheName + "*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheKey/{cacheKey}") |
| | | public R<?> clearCacheKey(@PathVariable String cacheKey) |
| | | { |
| | | redisTemplate.delete(cacheKey); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:cache:list')") |
| | | @DeleteMapping("/clearCacheAll") |
| | | public R<?> clearCacheAll() |
| | | { |
| | | Collection<String> cacheKeys = redisTemplate.keys("*"); |
| | | redisTemplate.delete(cacheKeys); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.domain.Server;
|
| | |
|
| | | /**
|
| | | * 服务器监控
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/server")
|
| | | public class ServerController
|
| | | {
|
| | | @PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
| | | @GetMapping()
|
| | | public AjaxResult getInfo() throws Exception
|
| | | {
|
| | | Server server = new Server();
|
| | | server.copyTo();
|
| | | return AjaxResult.success(server);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.domain.Server; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * 服务器监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/server") |
| | | public class ServerController extends BaseController |
| | | { |
| | | @PreAuthorize("@ss.hasPermi('monitor:server:list')") |
| | | @GetMapping() |
| | | public R<?> getInfo() throws Exception |
| | | { |
| | | Server server = new Server(); |
| | | server.copyTo(); |
| | | return R.ok(server); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.quartz.SchedulerException;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | 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 com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.exception.job.TaskException;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.job.CronUtils;
|
| | | import com.ruoyi.common.utils.job.ScheduleUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysJob;
|
| | | import com.ruoyi.project.monitor.service.ISysJobService;
|
| | |
|
| | | /**
|
| | | * 调度任务信息操作处理
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/job")
|
| | | @AllArgsConstructor
|
| | | public class SysJobController extends BaseController
|
| | | {
|
| | | private ISysJobService jobService;
|
| | |
|
| | | /**
|
| | | * 查询定时任务列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysJob sysJob)
|
| | | {
|
| | | startPage();
|
| | | List<SysJob> list = jobService.selectJobList(sysJob);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 导出定时任务列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJob sysJob)
|
| | | {
|
| | | List<SysJob> list = jobService.selectJobList(sysJob);
|
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
| | | util.exportExcel(response, list, "定时任务");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取定时任务详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
| | | @GetMapping(value = "/{jobId}")
|
| | | public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
|
| | | {
|
| | | return success(jobService.selectJobById(jobId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增定时任务
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:add')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException
|
| | | {
|
| | | if (!CronUtils.isValid(job.getCronExpression()))
|
| | | {
|
| | | return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
| | | }
|
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
|
| | | {
|
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
|
| | | {
|
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
|
| | | {
|
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
|
| | | {
|
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
| | | }
|
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
|
| | | {
|
| | | return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
|
| | | }
|
| | | job.setCreateBy(getUsername());
|
| | | return toAjax(jobService.insertJob(job));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改定时任务
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:edit')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException
|
| | | {
|
| | | if (!CronUtils.isValid(job.getCronExpression()))
|
| | | {
|
| | | return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
| | | }
|
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI))
|
| | | {
|
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS }))
|
| | | {
|
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS }))
|
| | | {
|
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
|
| | | }
|
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR))
|
| | | {
|
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
| | | }
|
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
|
| | | {
|
| | | return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
|
| | | }
|
| | | job.setUpdateBy(getUsername());
|
| | | return toAjax(jobService.updateJob(job));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 定时任务状态修改
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/changeStatus")
|
| | | public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException
|
| | | {
|
| | | SysJob newJob = jobService.selectJobById(job.getJobId());
|
| | | newJob.setStatus(job.getStatus());
|
| | | return toAjax(jobService.changeStatus(newJob));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 定时任务立即执行一次
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/run")
|
| | | public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
|
| | | {
|
| | | boolean result = jobService.run(job);
|
| | | return result ? success() : error("任务不存在或已过期!");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除定时任务
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{jobIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException
|
| | | {
|
| | | jobService.deleteJobByIds(jobIds);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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 com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.exception.job.TaskException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.job.CronUtils; |
| | | import com.ruoyi.common.utils.job.ScheduleUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysJob; |
| | | import com.ruoyi.project.monitor.service.ISysJobService; |
| | | |
| | | /** |
| | | * 调度任务信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/job") |
| | | @AllArgsConstructor |
| | | public class SysJobController extends BaseController |
| | | { |
| | | private ISysJobService jobService; |
| | | |
| | | /** |
| | | * 查询定时任务列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysJob sysJob) |
| | | { |
| | | startPage(); |
| | | List<SysJob> list = jobService.selectJobList(sysJob); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导出定时任务列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "定时任务", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysJob sysJob) |
| | | { |
| | | List<SysJob> list = jobService.selectJobList(sysJob); |
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class); |
| | | util.exportExcel(response, list, "定时任务"); |
| | | } |
| | | |
| | | /** |
| | | * 获取定时任务详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | @GetMapping(value = "/{jobId}") |
| | | public R<?> getInfo(@PathVariable("jobId") Long jobId) |
| | | { |
| | | return R.ok(jobService.selectJobById(jobId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增定时任务 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:add')") |
| | | @Log(title = "定时任务", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@RequestBody SysJob job) throws SchedulerException, TaskException |
| | | { |
| | | if (!CronUtils.isValid(job.getCronExpression())) |
| | | { |
| | | return R.fail("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确"); |
| | | } |
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) |
| | | { |
| | | return R.fail("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) |
| | | { |
| | | return R.fail("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) |
| | | { |
| | | return R.fail("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) |
| | | { |
| | | return R.fail("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规"); |
| | | } |
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) |
| | | { |
| | | return R.fail("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内"); |
| | | } |
| | | job.setCreateBy(getUsername()); |
| | | jobService.insertJob(job); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改定时任务 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:edit')") |
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@RequestBody SysJob job) throws SchedulerException, TaskException |
| | | { |
| | | if (!CronUtils.isValid(job.getCronExpression())) |
| | | { |
| | | return R.fail("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确"); |
| | | } |
| | | else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) |
| | | { |
| | | return R.fail("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS })) |
| | | { |
| | | return R.fail("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) |
| | | { |
| | | return R.fail("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用"); |
| | | } |
| | | else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) |
| | | { |
| | | return R.fail("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规"); |
| | | } |
| | | else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) |
| | | { |
| | | return R.fail("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内"); |
| | | } |
| | | job.setUpdateBy(getUsername()); |
| | | jobService.updateJob(job); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务状态修改 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<?> changeStatus(@RequestBody SysJob job) throws SchedulerException |
| | | { |
| | | SysJob newJob = jobService.selectJobById(job.getJobId()); |
| | | newJob.setStatus(job.getStatus()); |
| | | jobService.changeStatus(newJob); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 定时任务立即执行一次 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')") |
| | | @Log(title = "定时任务", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/run") |
| | | public R<?> run(@RequestBody SysJob job) throws SchedulerException |
| | | { |
| | | boolean result = jobService.run(job); |
| | | return result ? R.ok() : R.fail("任务不存在或已过期!"); |
| | | } |
| | | |
| | | /** |
| | | * 删除定时任务 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "定时任务", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobIds}") |
| | | public R<?> remove(@PathVariable Long[] jobIds) throws SchedulerException |
| | | { |
| | | jobService.deleteJobByIds(jobIds); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | 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.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysJobLog;
|
| | | import com.ruoyi.project.monitor.service.ISysJobLogService;
|
| | |
|
| | | /**
|
| | | * 调度日志操作处理
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/jobLog")
|
| | | @AllArgsConstructor
|
| | | public class SysJobLogController extends BaseController
|
| | | {
|
| | | private ISysJobLogService jobLogService;
|
| | |
|
| | | /**
|
| | | * 查询定时任务调度日志列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysJobLog sysJobLog)
|
| | | {
|
| | | startPage();
|
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 导出定时任务调度日志列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJobLog sysJobLog)
|
| | | {
|
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
| | | ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
| | | util.exportExcel(response, list, "调度日志");
|
| | | }
|
| | | |
| | | /**
|
| | | * 根据调度编号获取详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
| | | @GetMapping(value = "/{jobLogId}")
|
| | | public AjaxResult getInfo(@PathVariable Long jobLogId)
|
| | | {
|
| | | return success(jobLogService.selectJobLogById(jobLogId));
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 删除定时任务调度日志
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
| | | @Log(title = "定时任务调度日志", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{jobLogIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] jobLogIds)
|
| | | {
|
| | | return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空定时任务调度日志
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
| | | @Log(title = "调度日志", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/clean")
|
| | | public AjaxResult clean()
|
| | | {
|
| | | jobLogService.cleanJobLog();
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysJobLog; |
| | | import com.ruoyi.project.monitor.service.ISysJobLogService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | |
| | | /** |
| | | * 调度日志操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/jobLog") |
| | | @AllArgsConstructor |
| | | public class SysJobLogController extends BaseController |
| | | { |
| | | private ISysJobLogService jobLogService; |
| | | |
| | | /** |
| | | * 查询定时任务调度日志列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysJobLog sysJobLog) |
| | | { |
| | | startPage(); |
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导出定时任务调度日志列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')") |
| | | @Log(title = "任务调度日志", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysJobLog sysJobLog) |
| | | { |
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog); |
| | | ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class); |
| | | util.exportExcel(response, list, "调度日志"); |
| | | } |
| | | |
| | | /** |
| | | * 根据调度编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:query')") |
| | | @GetMapping(value = "/{jobLogId}") |
| | | public R<?> getInfo(@PathVariable Long jobLogId) |
| | | { |
| | | return R.ok(jobLogService.selectJobLogById(jobLogId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除定时任务调度日志 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "定时任务调度日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{jobLogIds}") |
| | | public R<?> remove(@PathVariable Long[] jobLogIds) |
| | | { |
| | | jobLogService.deleteJobLogByIds(jobLogIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 清空定时任务调度日志 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:job:remove')") |
| | | @Log(title = "调度日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public R<?> clean() |
| | | { |
| | | jobLogService.cleanJobLog(); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.security.service.SysPasswordService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysLogininfor;
|
| | | import com.ruoyi.project.monitor.service.ISysLogininforService;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 系统访问记录
|
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/logininfor")
|
| | | @AllArgsConstructor
|
| | | public class SysLogininforController extends BaseController {
|
| | | private ISysLogininforService logininforService;
|
| | | private SysPasswordService passwordService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysLogininfor logininfor) {
|
| | | startPage();
|
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysLogininfor logininfor) {
|
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
| | | ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
| | | util.exportExcel(response, list, "登录日志");
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
| | | @Log(title = "登录日志", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{infoIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] infoIds) {
|
| | | return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
| | | @Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/clean")
|
| | | public AjaxResult clean() {
|
| | | logininforService.cleanLogininfor();
|
| | | return success();
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')")
|
| | | @Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
| | | @GetMapping("/unlock/{userName}")
|
| | | public AjaxResult unlock(@PathVariable("userName") String userName) {
|
| | | passwordService.clearLoginRecordCache(userName);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.security.service.SysPasswordService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysLogininfor; |
| | | import com.ruoyi.project.monitor.service.ISysLogininforService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 系统访问记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/logininfor") |
| | | @AllArgsConstructor |
| | | public class SysLogininforController extends BaseController { |
| | | private ISysLogininforService logininforService; |
| | | private SysPasswordService passwordService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysLogininfor logininfor) { |
| | | startPage(); |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "登录日志", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysLogininfor logininfor) { |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); |
| | | util.exportExcel(response, list, "登录日志"); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "登录日志", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{infoIds}") |
| | | public R<?> remove(@PathVariable Long[] infoIds) { |
| | | logininforService.deleteLogininforByIds(infoIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") |
| | | @Log(title = "登录日志", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/clean") |
| | | public R<?> clean() { |
| | | logininforService.cleanLogininfor(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") |
| | | @Log(title = "账户解锁", businessType = BusinessType.OTHER) |
| | | @GetMapping("/unlock/{userName}") |
| | | public R<?> unlock(@PathVariable("userName") String userName) { |
| | | passwordService.clearLoginRecordCache(userName); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | 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.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysOperLog;
|
| | | import com.ruoyi.project.monitor.service.ISysOperLogService;
|
| | |
|
| | | /**
|
| | | * 操作日志记录
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/operlog")
|
| | | @AllArgsConstructor
|
| | | public class SysOperlogController extends BaseController
|
| | | {
|
| | | private ISysOperLogService operLogService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysOperLog operLog)
|
| | | {
|
| | | startPage();
|
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysOperLog operLog)
|
| | | {
|
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
| | | util.exportExcel(response, list, "操作日志");
|
| | | }
|
| | |
|
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
| | | @DeleteMapping("/{operIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] operIds)
|
| | | {
|
| | | return toAjax(operLogService.deleteOperLogByIds(operIds));
|
| | | }
|
| | |
|
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
| | | @DeleteMapping("/clean")
|
| | | public AjaxResult clean()
|
| | | {
|
| | | operLogService.cleanOperLog();
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysOperLog; |
| | | import com.ruoyi.project.monitor.service.ISysOperLogService; |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/operlog") |
| | | @AllArgsConstructor |
| | | public class SysOperlogController extends BaseController |
| | | { |
| | | private ISysOperLogService operLogService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysOperLog operLog) |
| | | { |
| | | startPage(); |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysOperLog operLog) |
| | | { |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); |
| | | util.exportExcel(response, list, "操作日志"); |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/{operIds}") |
| | | public R<?> remove(@PathVariable Long[] operIds) |
| | | { |
| | | operLogService.deleteOperLogByIds(operIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Log(title = "操作日志", businessType = BusinessType.CLEAN) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") |
| | | @DeleteMapping("/clean") |
| | | public R<?> clean() |
| | | { |
| | | operLogService.cleanOperLog(); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.monitor.controller;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collection;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | 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.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.constant.CacheConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.redis.RedisCache;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.monitor.domain.SysUserOnline;
|
| | | import com.ruoyi.project.system.service.ISysUserOnlineService;
|
| | |
|
| | | /**
|
| | | * 在线用户监控
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/monitor/online")
|
| | | @AllArgsConstructor
|
| | | public class SysUserOnlineController extends BaseController
|
| | | {
|
| | | private ISysUserOnlineService userOnlineService;
|
| | | private RedisCache redisCache;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(String ipaddr, String userName)
|
| | | {
|
| | | Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
| | | for (String key : keys)
|
| | | {
|
| | | LoginUser user = redisCache.getCacheObject(key);
|
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(ipaddr))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
| | | {
|
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
| | | }
|
| | | else
|
| | | {
|
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
| | | }
|
| | | }
|
| | | Collections.reverse(userOnlineList);
|
| | | userOnlineList.removeAll(Collections.singleton(null));
|
| | | return getDataTable(userOnlineList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 强退用户
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
| | | @Log(title = "在线用户", businessType = BusinessType.FORCE)
|
| | | @DeleteMapping("/{tokenId}")
|
| | | public AjaxResult forceLogout(@PathVariable String tokenId)
|
| | | {
|
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.monitor.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | 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.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.redis.RedisCache; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.monitor.domain.SysUserOnline; |
| | | import com.ruoyi.project.system.service.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * 在线用户监控 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/monitor/online") |
| | | @AllArgsConstructor |
| | | public class SysUserOnlineController extends BaseController |
| | | { |
| | | private ISysUserOnlineService userOnlineService; |
| | | private RedisCache redisCache; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(String ipaddr, String userName) |
| | | { |
| | | Collection<String> keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); |
| | | List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>(); |
| | | for (String key : keys) |
| | | { |
| | | LoginUser user = redisCache.getCacheObject(key); |
| | | if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(ipaddr)) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); |
| | | } |
| | | else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) |
| | | { |
| | | userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); |
| | | } |
| | | else |
| | | { |
| | | userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); |
| | | } |
| | | } |
| | | Collections.reverse(userOnlineList); |
| | | userOnlineList.removeAll(Collections.singleton(null)); |
| | | return getDataTable(userOnlineList); |
| | | } |
| | | |
| | | /** |
| | | * 强退用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") |
| | | @Log(title = "在线用户", businessType = BusinessType.FORCE) |
| | | @DeleteMapping("/{tokenId}") |
| | | public R<?> forceLogout(@PathVariable String tokenId) |
| | | { |
| | | redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysConfig;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 参数配置 信息操作处理
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/config")
|
| | | @AllArgsConstructor
|
| | | public class SysConfigController extends BaseController
|
| | | {
|
| | | private ISysConfigService configService;
|
| | |
|
| | | /**
|
| | | * 获取参数配置列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysConfig config)
|
| | | {
|
| | | startPage();
|
| | | List<SysConfig> list = configService.selectConfigList(config);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:config:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysConfig config)
|
| | | {
|
| | | List<SysConfig> list = configService.selectConfigList(config);
|
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
| | | util.exportExcel(response, list, "参数数据");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据参数编号获取详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:query')")
|
| | | @GetMapping(value = "/{configId}")
|
| | | public AjaxResult getInfo(@PathVariable Long configId)
|
| | | {
|
| | | return success(configService.selectConfigById(configId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据参数键名查询参数值
|
| | | */
|
| | | @GetMapping(value = "/configKey/{configKey}")
|
| | | public AjaxResult getConfigKey(@PathVariable String configKey)
|
| | | {
|
| | | return success(configService.selectConfigByKey(configKey));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增参数配置
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:add')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysConfig config)
|
| | | {
|
| | | if (!configService.checkConfigKeyUnique(config))
|
| | | {
|
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
| | | }
|
| | | config.setCreateBy(getUsername());
|
| | | return toAjax(configService.insertConfig(config));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改参数配置
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
| | | {
|
| | | if (!configService.checkConfigKeyUnique(config))
|
| | | {
|
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
| | | }
|
| | | config.setUpdateBy(getUsername());
|
| | | return toAjax(configService.updateConfig(config));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除参数配置
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{configIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] configIds)
|
| | | {
|
| | | configService.deleteConfigByIds(configIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 刷新参数缓存
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | configService.resetConfigCache();
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysConfig; |
| | | import com.ruoyi.project.system.service.ISysConfigService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | @AllArgsConstructor |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 获取参数配置列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:config:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) |
| | | { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "参数数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:query')") |
| | | @GetMapping(value = "/{configId}") |
| | | public R<?> getInfo(@PathVariable Long configId) |
| | | { |
| | | return R.ok(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public R<?> getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return R.ok(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:add')") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(getUsername()); |
| | | configService.insertConfig(config); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:edit')") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(getUsername()); |
| | | configService.updateConfig(config); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public R<?> remove(@PathVariable Long[] configIds) |
| | | { |
| | | configService.deleteConfigByIds(configIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:config:remove')") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public R<?> refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | 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 com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.service.ISysDeptService;
|
| | |
|
| | | /**
|
| | | * 部门信息
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/dept")
|
| | | @AllArgsConstructor
|
| | | public class SysDeptController extends BaseController
|
| | | {
|
| | | private ISysDeptService deptService;
|
| | |
|
| | | /**
|
| | | * 获取部门列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
| | | @GetMapping("/list")
|
| | | public AjaxResult list(SysDept dept)
|
| | | {
|
| | | List<SysDept> depts = deptService.selectDeptList(dept);
|
| | | return success(depts);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询部门列表(排除节点)
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')")
|
| | | @GetMapping("/list/exclude/{deptId}")
|
| | | public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
| | | {
|
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
| | | return success(depts);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据部门编号获取详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')")
|
| | | @GetMapping(value = "/{deptId}")
|
| | | public AjaxResult getInfo(@PathVariable Long deptId)
|
| | | {
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | return success(deptService.selectDeptById(deptId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增部门
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:add')")
|
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDept dept)
|
| | | {
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
| | | }
|
| | | dept.setCreateBy(getUsername());
|
| | | return toAjax(deptService.insertDept(dept));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改部门
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
| | | {
|
| | | Long deptId = dept.getDeptId();
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | if (!deptService.checkDeptNameUnique(dept))
|
| | | {
|
| | | return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
| | | }
|
| | | else if (dept.getParentId().equals(deptId))
|
| | | {
|
| | | return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
| | | }
|
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
|
| | | {
|
| | | return error("该部门包含未停用的子部门!");
|
| | | }
|
| | | dept.setUpdateBy(getUsername());
|
| | | return toAjax(deptService.updateDept(dept));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除部门
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{deptId}")
|
| | | public AjaxResult remove(@PathVariable Long deptId)
|
| | | {
|
| | | if (deptService.hasChildByDeptId(deptId))
|
| | | {
|
| | | return warn("存在下级部门,不允许删除");
|
| | | }
|
| | | if (deptService.checkDeptExistUser(deptId))
|
| | | {
|
| | | return warn("部门存在用户,不允许删除");
|
| | | }
|
| | | deptService.checkDeptDataScope(deptId);
|
| | | return toAjax(deptService.deleteDeptById(deptId));
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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 com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.service.ISysDeptService; |
| | | |
| | | /** |
| | | * 部门信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | @AllArgsConstructor |
| | | public class SysDeptController extends BaseController |
| | | { |
| | | private ISysDeptService deptService; |
| | | |
| | | /** |
| | | * 获取部门列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list") |
| | | public R<?> list(SysDept dept) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return R.ok(depts); |
| | | } |
| | | |
| | | /** |
| | | * 查询部门列表(排除节点) |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | public R<?> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | List<SysDept> depts = deptService.selectDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return R.ok(depts); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:query')") |
| | | @GetMapping(value = "/{deptId}") |
| | | public R<?> getInfo(@PathVariable Long deptId) |
| | | { |
| | | deptService.checkDeptDataScope(deptId); |
| | | return R.ok(deptService.selectDeptById(deptId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增部门 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:add')") |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysDept dept) |
| | | { |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | dept.setCreateBy(getUsername()); |
| | | deptService.insertDept(dept); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改部门 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:edit')") |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysDept dept) |
| | | { |
| | | Long deptId = dept.getDeptId(); |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) |
| | | { |
| | | return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } |
| | | else if (dept.getParentId().equals(deptId)) |
| | | { |
| | | return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } |
| | | else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) |
| | | { |
| | | return R.fail("该部门包含未停用的子部门!"); |
| | | } |
| | | dept.setUpdateBy(getUsername()); |
| | | deptService.updateDept(dept); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除部门 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dept:remove')") |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deptId}") |
| | | public R<?> remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "部门存在用户,不允许删除"); |
| | | } |
| | | deptService.checkDeptDataScope(deptId); |
| | | deptService.deleteDeptById(deptId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | 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 com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDictData;
|
| | | import com.ruoyi.project.system.service.ISysDictDataService;
|
| | | import com.ruoyi.project.system.service.ISysDictTypeService;
|
| | |
|
| | | /**
|
| | | * 数据字典信息
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/dict/data")
|
| | | @AllArgsConstructor
|
| | | public class SysDictDataController extends BaseController
|
| | | {
|
| | | private ISysDictDataService dictDataService;
|
| | | private ISysDictTypeService dictTypeService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysDictData dictData)
|
| | | {
|
| | | startPage();
|
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictData dictData)
|
| | | {
|
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
| | | util.exportExcel(response, list, "字典数据");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询字典数据详细
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')")
|
| | | @GetMapping(value = "/{dictCode}")
|
| | | public AjaxResult getInfo(@PathVariable Long dictCode)
|
| | | {
|
| | | return success(dictDataService.selectDictDataById(dictCode));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据字典类型查询字典数据信息
|
| | | */
|
| | | @GetMapping(value = "/type/{dictType}")
|
| | | public AjaxResult dictType(@PathVariable String dictType)
|
| | | {
|
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
| | | if (StringUtils.isNull(data))
|
| | | {
|
| | | data = new ArrayList<SysDictData>();
|
| | | }
|
| | | return success(data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
| | | @Log(title = "字典数据", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
| | | {
|
| | | dict.setCreateBy(getUsername());
|
| | | return toAjax(dictDataService.insertDictData(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改保存字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
| | | @Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
| | | {
|
| | | dict.setUpdateBy(getUsername());
|
| | | return toAjax(dictDataService.updateDictData(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{dictCodes}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictCodes)
|
| | | {
|
| | | dictDataService.deleteDictDataByIds(dictCodes);
|
| | | return success();
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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 com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | | import com.ruoyi.project.system.service.ISysDictDataService; |
| | | import com.ruoyi.project.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/data") |
| | | @AllArgsConstructor |
| | | public class SysDictDataController extends BaseController |
| | | { |
| | | private ISysDictDataService dictDataService; |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | { |
| | | startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "字典数据", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysDictData dictData) |
| | | { |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); |
| | | util.exportExcel(response, list, "字典数据"); |
| | | } |
| | | |
| | | /** |
| | | * 查询字典数据详细 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictCode}") |
| | | public R<?> getInfo(@PathVariable Long dictCode) |
| | | { |
| | | return R.ok(dictDataService.selectDictDataById(dictCode)); |
| | | } |
| | | |
| | | /** |
| | | * 根据字典类型查询字典数据信息 |
| | | */ |
| | | @GetMapping(value = "/type/{dictType}") |
| | | public R<?> dictType(@PathVariable String dictType) |
| | | { |
| | | List<SysDictData> data = dictTypeService.selectDictDataByType(dictType); |
| | | if (StringUtils.isNull(data)) |
| | | { |
| | | data = new ArrayList<SysDictData>(); |
| | | } |
| | | return R.ok(data); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "字典数据", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setCreateBy(getUsername()); |
| | | dictDataService.insertDictData(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "字典数据", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysDictData dict) |
| | | { |
| | | dict.setUpdateBy(getUsername()); |
| | | dictDataService.updateDictData(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictCodes}") |
| | | public R<?> remove(@PathVariable Long[] dictCodes) |
| | | { |
| | | dictDataService.deleteDictDataByIds(dictCodes); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | 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 com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDictType;
|
| | | import com.ruoyi.project.system.service.ISysDictTypeService;
|
| | |
|
| | | /**
|
| | | * 数据字典信息
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/dict/type")
|
| | | @AllArgsConstructor
|
| | | public class SysDictTypeController extends BaseController
|
| | | {
|
| | | private ISysDictTypeService dictTypeService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysDictType dictType)
|
| | | {
|
| | | startPage();
|
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictType dictType)
|
| | | {
|
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
| | | util.exportExcel(response, list, "字典类型");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询字典类型详细
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')")
|
| | | @GetMapping(value = "/{dictId}")
|
| | | public AjaxResult getInfo(@PathVariable Long dictId)
|
| | | {
|
| | | return success(dictTypeService.selectDictTypeById(dictId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
| | | {
|
| | | if (!dictTypeService.checkDictTypeUnique(dict))
|
| | | {
|
| | | return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | }
|
| | | dict.setCreateBy(getUsername());
|
| | | return toAjax(dictTypeService.insertDictType(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
| | | {
|
| | | if (!dictTypeService.checkDictTypeUnique(dict))
|
| | | {
|
| | | return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | }
|
| | | dict.setUpdateBy(getUsername());
|
| | | return toAjax(dictTypeService.updateDictType(dict));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{dictIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictIds)
|
| | | {
|
| | | dictTypeService.deleteDictTypeByIds(dictIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 刷新字典缓存
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | dictTypeService.resetDictCache();
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取字典选择框列表
|
| | | */
|
| | | @GetMapping("/optionselect")
|
| | | public AjaxResult optionselect()
|
| | | {
|
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
| | | return success(dictTypes);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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 com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDictType; |
| | | import com.ruoyi.project.system.service.ISysDictTypeService; |
| | | |
| | | /** |
| | | * 数据字典信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/dict/type") |
| | | @AllArgsConstructor |
| | | public class SysDictTypeController extends BaseController |
| | | { |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictType dictType) |
| | | { |
| | | startPage(); |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysDictType dictType) |
| | | { |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); |
| | | util.exportExcel(response, list, "字典类型"); |
| | | } |
| | | |
| | | /** |
| | | * 查询字典类型详细 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')") |
| | | @GetMapping(value = "/{dictId}") |
| | | public R<?> getInfo(@PathVariable Long dictId) |
| | | { |
| | | return R.ok(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')") |
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setCreateBy(getUsername()); |
| | | dictTypeService.insertDictType(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')") |
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysDictType dict) |
| | | { |
| | | if (!dictTypeService.checkDictTypeUnique(dict)) |
| | | { |
| | | return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | dict.setUpdateBy(getUsername()); |
| | | dictTypeService.updateDictType(dict); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除字典类型 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public R<?> remove(@PathVariable Long[] dictIds) |
| | | { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新字典缓存 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')") |
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public R<?> refreshCache() |
| | | { |
| | | dictTypeService.resetDictCache(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取字典选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public R<?> optionselect() |
| | | { |
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |
| | | return R.ok(dictTypes); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.constant.Constants;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.framework.security.LoginBody;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.security.service.SysLoginService;
|
| | | import com.ruoyi.framework.security.service.SysPermissionService;
|
| | | import com.ruoyi.framework.security.service.TokenService;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.domain.SysMenu;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
|
| | | import com.ruoyi.project.system.mapper.SysDeptMapper;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import com.ruoyi.project.system.service.ISysUserDeptService;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.util.ObjectUtils;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * 登录验证
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @AllArgsConstructor
|
| | | public class SysLoginController
|
| | | {
|
| | | private SysLoginService loginService;
|
| | | private ISysMenuService menuService;
|
| | | private SysPermissionService permissionService;
|
| | | private TokenService tokenService;
|
| | | private ISysUserDeptService userDeptService;
|
| | | private ISysUserService userService;
|
| | | private SysDeptMapper sysDeptMapper;
|
| | |
|
| | | /**
|
| | | * 登录方法
|
| | | * |
| | | * @param loginBody 登录信息
|
| | | * @return 结果
|
| | | */
|
| | | @PostMapping("/login")
|
| | | public AjaxResult login(@RequestBody LoginBody loginBody)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | // 生成令牌
|
| | | String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
| | | loginBody.getUuid());
|
| | | ajax.put(Constants.TOKEN, token);
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户信息
|
| | | * |
| | | * @return 用户信息
|
| | | */
|
| | | @GetMapping("/getInfo")
|
| | | public AjaxResult getInfo()
|
| | | {
|
| | | LoginUser loginUser = SecurityUtils.getLoginUser();
|
| | | SysUser user = loginUser.getUser();
|
| | | // 获取当前登录公司
|
| | | Long tenantId = loginUser.getTenantId();
|
| | | if(null != tenantId){
|
| | | user.setTenantId(tenantId);
|
| | | SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue());
|
| | | if(!ObjectUtils.isEmpty(sysDept)){
|
| | | user.setCurrentFactoryName(sysDept.getDeptName());
|
| | | }
|
| | | }
|
| | | // 角色集合
|
| | | Set<String> roles = permissionService.getRolePermission(user);
|
| | | // 权限集合
|
| | | Set<String> permissions = permissionService.getMenuPermission(user);
|
| | | if (!loginUser.getPermissions().equals(permissions))
|
| | | {
|
| | | loginUser.setPermissions(permissions);
|
| | | tokenService.refreshToken(loginUser);
|
| | | }
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("user", user);
|
| | | ajax.put("aiEnabled", loginUser.getAiEnabled());
|
| | | ajax.put("roles", roles);
|
| | | ajax.put("permissions", permissions);
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取路由信息
|
| | | * |
| | | * @return 路由信息
|
| | | */
|
| | | @GetMapping("getRouters")
|
| | | public AjaxResult getRouters()
|
| | | {
|
| | | Long userId = SecurityUtils.getUserId();
|
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
| | | return AjaxResult.success(menuService.buildMenus(menus));
|
| | | }
|
| | |
|
| | | @PostMapping("/loginCheck")
|
| | | public AjaxResult loginCheck(@RequestBody LoginBody loginBody)
|
| | | {
|
| | | try {
|
| | | Long userId = loginService.loginCheck(loginBody.getUsername(), loginBody.getPassword());
|
| | | return AjaxResult.success(userId);
|
| | | }catch (Exception e) {
|
| | | return AjaxResult.error(e.getMessage());
|
| | | }
|
| | | }
|
| | |
|
| | | @GetMapping("/userLoginFacotryList")
|
| | | public AjaxResult userLoginFacotryList(SysUserDeptVo sysUserDeptVo){
|
| | | List<SysUserDeptVo> sysUserDeptVoList = userDeptService.userLoginFacotryList(sysUserDeptVo);
|
| | | Map<Long, SysUserDeptVo> map = sysUserDeptVoList.stream()
|
| | | .collect(Collectors.toMap(
|
| | | SysUserDeptVo::getDeptId,
|
| | | item -> item,
|
| | | (existing, replacement) -> existing // 如果重复,保留第一个
|
| | | ));
|
| | | List<SysUserDeptVo> uniqueList = new ArrayList<>(map.values());
|
| | | return AjaxResult.success(uniqueList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 选择公司登录
|
| | | *
|
| | | * @param loginBody 登录信息
|
| | | * @return 结果
|
| | | */
|
| | | @PostMapping("/loginCheckFactory")
|
| | | public AjaxResult loginCheckFactory(@RequestBody LoginBody loginBody)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | // 生成令牌
|
| | | String token = loginService.loginCheckFactory(loginBody.getUsername(), loginBody.getPassword(),loginBody.getFactoryId());
|
| | | ajax.put(Constants.TOKEN, token);
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.security.LoginBody; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.security.service.SysLoginService; |
| | | import com.ruoyi.framework.security.service.SysPermissionService; |
| | | import com.ruoyi.framework.security.service.TokenService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysMenu; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.service.ISysMenuService; |
| | | import com.ruoyi.project.system.service.ISysUserDeptService; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 登录验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class SysLoginController extends BaseController |
| | | { |
| | | private SysLoginService loginService; |
| | | private ISysMenuService menuService; |
| | | private SysPermissionService permissionService; |
| | | private TokenService tokenService; |
| | | private ISysUserDeptService userDeptService; |
| | | private ISysUserService userService; |
| | | private SysDeptMapper sysDeptMapper; |
| | | |
| | | /** |
| | | * 登录方法 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @PostMapping("/login") |
| | | public R<?> login(@RequestBody LoginBody loginBody) |
| | | { |
| | | // 生成令牌 |
| | | String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), |
| | | loginBody.getUuid()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put(Constants.TOKEN, token); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @return 用户信息 |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public R<?> getInfo() |
| | | { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | // 获取当前登录公司 |
| | | Long tenantId = loginUser.getTenantId(); |
| | | if(null != tenantId){ |
| | | user.setTenantId(tenantId); |
| | | SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue()); |
| | | if(!ObjectUtils.isEmpty(sysDept)){ |
| | | user.setCurrentFactoryName(sysDept.getDeptName()); |
| | | } |
| | | } |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | if (!loginUser.getPermissions().equals(permissions)) |
| | | { |
| | | loginUser.setPermissions(permissions); |
| | | tokenService.refreshToken(loginUser); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("user", user); |
| | | map.put("aiEnabled", loginUser.getAiEnabled()); |
| | | map.put("roles", roles); |
| | | map.put("permissions", permissions); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 获取路由信息 |
| | | * |
| | | * @return 路由信息 |
| | | */ |
| | | @GetMapping("getRouters") |
| | | public R<?> getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return R.ok(menuService.buildMenus(menus)); |
| | | } |
| | | |
| | | @PostMapping("/loginCheck") |
| | | public R<?> loginCheck(@RequestBody LoginBody loginBody) |
| | | { |
| | | try { |
| | | Long userId = loginService.loginCheck(loginBody.getUsername(), loginBody.getPassword()); |
| | | return R.ok(userId); |
| | | }catch (Exception e) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @GetMapping("/userLoginFacotryList") |
| | | public R<?> userLoginFacotryList(SysUserDeptVo sysUserDeptVo){ |
| | | List<SysUserDeptVo> sysUserDeptVoList = userDeptService.userLoginFacotryList(sysUserDeptVo); |
| | | Map<Long, SysUserDeptVo> map = sysUserDeptVoList.stream() |
| | | .collect(Collectors.toMap( |
| | | SysUserDeptVo::getDeptId, |
| | | item -> item, |
| | | (existing, replacement) -> existing // 如果重复,保留第一个 |
| | | )); |
| | | List<SysUserDeptVo> uniqueList = new ArrayList<>(map.values()); |
| | | return R.ok(uniqueList); |
| | | } |
| | | |
| | | /** |
| | | * 选择公司登录 |
| | | * |
| | | * @param loginBody 登录信息 |
| | | * @return 结果 |
| | | */ |
| | | @PostMapping("/loginCheckFactory") |
| | | public R<?> loginCheckFactory(@RequestBody LoginBody loginBody) |
| | | { |
| | | // 生成令牌 |
| | | String token = loginService.loginCheckFactory(loginBody.getUsername(), loginBody.getPassword(),loginBody.getFactoryId()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put(Constants.TOKEN, token); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.domain.SysMenu;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 菜单信息
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/menu")
|
| | | @AllArgsConstructor
|
| | | public class SysMenuController extends BaseController
|
| | | {
|
| | | private ISysMenuService menuService;
|
| | |
|
| | | /**
|
| | | * 获取菜单列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:list')")
|
| | | @GetMapping("/list")
|
| | | public AjaxResult list(SysMenu menu)
|
| | | {
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
| | | return success(menus);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据菜单编号获取详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:query')")
|
| | | @GetMapping(value = "/{menuId}")
|
| | | public AjaxResult getInfo(@PathVariable Long menuId)
|
| | | {
|
| | | return success(menuService.selectMenuById(menuId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取菜单下拉树列表
|
| | | */
|
| | | @GetMapping("/treeselect")
|
| | | public AjaxResult treeselect(SysMenu menu)
|
| | | {
|
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
|
| | | return success(menuService.buildMenuTreeSelect(menus));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 加载对应角色菜单列表树
|
| | | */
|
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
| | | {
|
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId());
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
| | | ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增菜单
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:add')")
|
| | | @Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
| | | {
|
| | | if (!menuService.checkMenuNameUnique(menu))
|
| | | {
|
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
| | | }
|
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
| | | {
|
| | | return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
| | | }
|
| | | menu.setCreateBy(getUsername());
|
| | | return toAjax(menuService.insertMenu(menu));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改菜单
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
| | | @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
| | | {
|
| | | if (!menuService.checkMenuNameUnique(menu))
|
| | | {
|
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
| | | }
|
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
|
| | | {
|
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
| | | }
|
| | | else if (menu.getMenuId().equals(menu.getParentId()))
|
| | | {
|
| | | return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
| | | }
|
| | | menu.setUpdateBy(getUsername());
|
| | | return toAjax(menuService.updateMenu(menu));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除菜单
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
| | | @Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{menuId}")
|
| | | public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
| | | {
|
| | | if (menuService.hasChildByMenuId(menuId))
|
| | | {
|
| | | return warn("存在子菜单,不允许删除");
|
| | | }
|
| | | if (menuService.checkMenuExistRole(menuId))
|
| | | {
|
| | | return warn("菜单已分配,不允许删除");
|
| | | }
|
| | | return toAjax(menuService.deleteMenuById(menuId));
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysMenu; |
| | | import com.ruoyi.project.system.service.ISysMenuService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 菜单信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/menu") |
| | | @AllArgsConstructor |
| | | public class SysMenuController extends BaseController |
| | | { |
| | | private ISysMenuService menuService; |
| | | |
| | | /** |
| | | * 获取菜单列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:list')") |
| | | @GetMapping("/list") |
| | | public R<?> list(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return R.ok(menus); |
| | | } |
| | | |
| | | /** |
| | | * 根据菜单编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:query')") |
| | | @GetMapping(value = "/{menuId}") |
| | | public R<?> getInfo(@PathVariable Long menuId) |
| | | { |
| | | return R.ok(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取菜单下拉树列表 |
| | | */ |
| | | @GetMapping("/treeselect") |
| | | public R<?> treeselect(SysMenu menu) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, getUserId()); |
| | | return R.ok(menuService.buildMenuTreeSelect(menus)); |
| | | } |
| | | |
| | | /** |
| | | * 加载对应角色菜单列表树 |
| | | */ |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public R<?> roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | List<SysMenu> menus = menuService.selectMenuList(getUserId()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | | map.put("menus", menuService.buildMenuTreeSelect(menus)); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 新增菜单 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:add')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return R.fail("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return R.fail("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | menu.setCreateBy(getUsername()); |
| | | menuService.insertMenu(menu); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改菜单 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:edit')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysMenu menu) |
| | | { |
| | | if (!menuService.checkMenuNameUnique(menu)) |
| | | { |
| | | return R.fail("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); |
| | | } |
| | | else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) |
| | | { |
| | | return R.fail("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); |
| | | } |
| | | else if (menu.getMenuId().equals(menu.getParentId())) |
| | | { |
| | | return R.fail("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); |
| | | } |
| | | menu.setUpdateBy(getUsername()); |
| | | menuService.updateMenu(menu); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除菜单 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:menu:remove')") |
| | | @Log(title = "菜单管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{menuId}") |
| | | public R<?> remove(@PathVariable("menuId") Long menuId) |
| | | { |
| | | if (menuService.hasChildByMenuId(menuId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "存在子菜单,不允许删除"); |
| | | } |
| | | if (menuService.checkMenuExistRole(menuId)) |
| | | { |
| | | return R.fail(HttpStatus.WARN, "菜单已分配,不允许删除"); |
| | | } |
| | | menuService.deleteMenuById(menuId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.metadata.IPage;
|
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | | import com.ruoyi.framework.web.domain.R;
|
| | | import io.swagger.v3.oas.annotations.Operation;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysNotice;
|
| | | import com.ruoyi.project.system.service.ISysNoticeService;
|
| | |
|
| | | /**
|
| | | * 公告 信息操作处理
|
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/notice")
|
| | | @AllArgsConstructor
|
| | | public class SysNoticeController extends BaseController {
|
| | | private ISysNoticeService noticeService;
|
| | |
|
| | | /**
|
| | | * 获取通知公告列表
|
| | | */
|
| | | @GetMapping("/list")
|
| | | public R<IPage<SysNotice>> list(SysNotice notice, Page page) {
|
| | | IPage<SysNotice> list = noticeService.selectNoticeList(notice, page);
|
| | | return R.ok(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取未读数量
|
| | | */
|
| | | @GetMapping("/getCount")
|
| | | public R getCount(Long consigneeId) {
|
| | | return R.ok(noticeService.getCount(consigneeId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据通知公告编号获取详细信息
|
| | | */
|
| | | @GetMapping(value = "/{noticeId}")
|
| | | public AjaxResult getInfo(@PathVariable Long noticeId) {
|
| | | return success(noticeService.selectNoticeById(noticeId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增通知公告
|
| | | */
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysNotice notice) {
|
| | | return toAjax(noticeService.insertNotice(notice));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改通知公告
|
| | | */
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
|
| | | return toAjax(noticeService.updateNotice(notice));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除通知公告
|
| | | */
|
| | | @DeleteMapping("/{noticeIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] noticeIds) {
|
| | | return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 一键已读
|
| | | */
|
| | | @PostMapping("/readAll")
|
| | | public AjaxResult readAll() {
|
| | | return toAjax(noticeService.readAll());
|
| | | }
|
| | |
|
| | | @PostMapping("appReadNotice")
|
| | | @Operation(summary = "移动端根据消息ID进行已读")
|
| | | public AjaxResult appReadNotice(@RequestParam("noticeId") Long noticeId) {
|
| | | boolean result = noticeService.appReadNotice(noticeId);
|
| | | return toAjax(result);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysNotice; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | |
| | | /** |
| | | * 公告 信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/notice") |
| | | @AllArgsConstructor |
| | | public class SysNoticeController extends BaseController { |
| | | private ISysNoticeService noticeService; |
| | | |
| | | /** |
| | | * 获取通知公告列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public R<IPage<SysNotice>> list(SysNotice notice, Page page) { |
| | | IPage<SysNotice> list = noticeService.selectNoticeList(notice, page); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取未读数量 |
| | | */ |
| | | @GetMapping("/getCount") |
| | | public R getCount(Long consigneeId) { |
| | | return R.ok(noticeService.getCount(consigneeId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据通知公告编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{noticeId}") |
| | | public R<?> getInfo(@PathVariable Long noticeId) { |
| | | return R.ok(noticeService.selectNoticeById(noticeId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增通知公告 |
| | | */ |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysNotice notice) { |
| | | noticeService.insertNotice(notice); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改通知公告 |
| | | */ |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysNotice notice) { |
| | | noticeService.updateNotice(notice); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除通知公告 |
| | | */ |
| | | @DeleteMapping("/{noticeIds}") |
| | | public R<?> remove(@PathVariable Long[] noticeIds) { |
| | | noticeService.deleteNoticeByIds(noticeIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 一键已读 |
| | | */ |
| | | @PostMapping("/readAll") |
| | | public R<?> readAll() { |
| | | noticeService.readAll(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("appReadNotice") |
| | | @Operation(summary = "移动端根据消息ID进行已读") |
| | | public R<?> appReadNotice(@RequestParam("noticeId") Long noticeId) { |
| | | noticeService.appReadNotice(noticeId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | 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 com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysPost;
|
| | | import com.ruoyi.project.system.service.ISysPostService;
|
| | |
|
| | | /**
|
| | | * 岗位信息操作处理
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/post")
|
| | | @AllArgsConstructor
|
| | | public class SysPostController extends BaseController
|
| | | {
|
| | | private ISysPostService postService;
|
| | |
|
| | | /**
|
| | | * 获取岗位列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysPost post)
|
| | | {
|
| | | startPage();
|
| | | List<SysPost> list = postService.selectPostList(post);
|
| | | return getDataTable(list);
|
| | | }
|
| | | /**
|
| | | * 导出岗位列表
|
| | | */
|
| | | |
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:post:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysPost post)
|
| | | {
|
| | | List<SysPost> list = postService.selectPostList(post);
|
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
| | | util.exportExcel(response, list, "岗位数据");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据岗位编号获取详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:query')")
|
| | | @GetMapping(value = "/{postId}")
|
| | | public AjaxResult getInfo(@PathVariable Long postId)
|
| | | {
|
| | | return success(postService.selectPostById(postId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增岗位
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:add')")
|
| | | @Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysPost post)
|
| | | {
|
| | | if (!postService.checkPostNameUnique(post))
|
| | | {
|
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
| | | }
|
| | | else if (!postService.checkPostCodeUnique(post))
|
| | | {
|
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
| | | }
|
| | | post.setCreateBy(getUsername());
|
| | | return toAjax(postService.insertPost(post));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改岗位
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:edit')")
|
| | | @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysPost post)
|
| | | {
|
| | | if (!postService.checkPostNameUnique(post))
|
| | | {
|
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
| | | }
|
| | | else if (!postService.checkPostCodeUnique(post))
|
| | | {
|
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
| | | }
|
| | | post.setUpdateBy(getUsername());
|
| | | return toAjax(postService.updatePost(post));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除岗位
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')")
|
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{postIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] postIds)
|
| | | {
|
| | | return toAjax(postService.deletePostByIds(postIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取岗位选择框列表
|
| | | */
|
| | | @GetMapping("/optionselect")
|
| | | public AjaxResult optionselect()
|
| | | {
|
| | | List<SysPost> posts = postService.selectPostAll();
|
| | | return success(posts);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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 com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysPost; |
| | | import com.ruoyi.project.system.service.ISysPostService; |
| | | |
| | | /** |
| | | * 岗位信息操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/post") |
| | | @AllArgsConstructor |
| | | public class SysPostController extends BaseController |
| | | { |
| | | private ISysPostService postService; |
| | | |
| | | /** |
| | | * 获取岗位列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | return getDataTable(list); |
| | | } |
| | | /** |
| | | * 导出岗位列表 |
| | | */ |
| | | |
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysPost post) |
| | | { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); |
| | | util.exportExcel(response, list, "岗位数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据岗位编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public R<?> getInfo(@PathVariable Long postId) |
| | | { |
| | | return R.ok(postService.selectPostById(postId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增岗位 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:add')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | | postService.insertPost(post); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改岗位 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:edit')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (!postService.checkPostNameUnique(post)) |
| | | { |
| | | return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (!postService.checkPostCodeUnique(post)) |
| | | { |
| | | return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | | postService.updatePost(post); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除岗位 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public R<?> remove(@PathVariable Long[] postIds) |
| | | { |
| | | postService.deletePostByIds(postIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取岗位选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public R<?> optionselect() |
| | | { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return R.ok(posts); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.file.FileUploadUtils;
|
| | | import com.ruoyi.common.utils.file.MimeTypeUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.config.RuoYiConfig;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.security.service.TokenService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | |
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * 个人信息 业务处理
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/user/profile")
|
| | | @AllArgsConstructor
|
| | | public class SysProfileController extends BaseController
|
| | | {
|
| | | private ISysUserService userService;
|
| | | private TokenService tokenService;
|
| | |
|
| | | /**
|
| | | * 个人信息
|
| | | */
|
| | | @GetMapping
|
| | | public AjaxResult profile()
|
| | | {
|
| | | LoginUser loginUser = getLoginUser();
|
| | | SysUser user = loginUser.getUser();
|
| | | AjaxResult ajax = AjaxResult.success(user);
|
| | | ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
| | | ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改用户
|
| | | */
|
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult updateProfile(@RequestBody SysUser user)
|
| | | {
|
| | | LoginUser loginUser = getLoginUser();
|
| | | SysUser currentUser = loginUser.getUser();
|
| | | currentUser.setNickName(user.getNickName());
|
| | | currentUser.setEmail(user.getEmail());
|
| | | currentUser.setPhonenumber(user.getPhonenumber());
|
| | | currentUser.setSex(user.getSex());
|
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser))
|
| | | {
|
| | | return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
|
| | | }
|
| | | if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
| | | {
|
| | | return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
|
| | | }
|
| | | if (userService.updateUserProfile(currentUser) > 0)
|
| | | {
|
| | | // 更新缓存用户信息
|
| | | tokenService.setLoginUser(loginUser);
|
| | | return success();
|
| | | }
|
| | | return error("修改个人信息异常,请联系管理员");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 重置密码
|
| | | */
|
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/updatePwd")
|
| | | public AjaxResult updatePwd(@RequestBody Map<String, String> params)
|
| | | {
|
| | | String oldPassword = params.get("oldPassword");
|
| | | String newPassword = params.get("newPassword");
|
| | | LoginUser loginUser = getLoginUser();
|
| | | String userName = loginUser.getUsername();
|
| | | String password = loginUser.getPassword();
|
| | | if (!SecurityUtils.matchesPassword(oldPassword, password))
|
| | | {
|
| | | return error("修改密码失败,旧密码错误");
|
| | | }
|
| | | if (SecurityUtils.matchesPassword(newPassword, password))
|
| | | {
|
| | | return error("新密码不能与旧密码相同");
|
| | | }
|
| | | newPassword = SecurityUtils.encryptPassword(newPassword);
|
| | | if (userService.resetUserPwd(userName, newPassword) > 0)
|
| | | {
|
| | | // 更新缓存用户密码
|
| | | loginUser.getUser().setPassword(newPassword);
|
| | | tokenService.setLoginUser(loginUser);
|
| | | return success();
|
| | | }
|
| | | return error("修改密码异常,请联系管理员");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 头像上传
|
| | | */
|
| | | @Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
| | | @PostMapping("/avatar")
|
| | | public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception
|
| | | {
|
| | | if (!file.isEmpty())
|
| | | {
|
| | | LoginUser loginUser = getLoginUser();
|
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION);
|
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("imgUrl", avatar);
|
| | | // 更新缓存用户头像
|
| | | loginUser.getUser().setAvatar(avatar);
|
| | | tokenService.setLoginUser(loginUser);
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | return error("上传图片异常,请联系管理员");
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.file.FileUploadUtils; |
| | | import com.ruoyi.common.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.config.RuoYiConfig; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.security.service.TokenService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 个人信息 业务处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user/profile") |
| | | @AllArgsConstructor |
| | | public class SysProfileController extends BaseController |
| | | { |
| | | private ISysUserService userService; |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 个人信息 |
| | | */ |
| | | @GetMapping |
| | | public R<?> profile() |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser user = loginUser.getUser(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", user); |
| | | map.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); |
| | | map.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> updateProfile(@RequestBody SysUser user) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | SysUser currentUser = loginUser.getUser(); |
| | | currentUser.setNickName(user.getNickName()); |
| | | currentUser.setEmail(user.getEmail()); |
| | | currentUser.setPhonenumber(user.getPhonenumber()); |
| | | currentUser.setSex(user.getSex()); |
| | | if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) |
| | | { |
| | | return R.fail("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在"); |
| | | } |
| | | if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) |
| | | { |
| | | return R.fail("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在"); |
| | | } |
| | | if (userService.updateUserProfile(currentUser) > 0) |
| | | { |
| | | // 更新缓存用户信息 |
| | | tokenService.setLoginUser(loginUser); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("修改个人信息异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @Log(title = "个人信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public R<?> updatePwd(@RequestBody Map<String, String> params) |
| | | { |
| | | String oldPassword = params.get("oldPassword"); |
| | | String newPassword = params.get("newPassword"); |
| | | LoginUser loginUser = getLoginUser(); |
| | | String userName = loginUser.getUsername(); |
| | | String password = loginUser.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) |
| | | { |
| | | return R.fail("修改密码失败,旧密码错误"); |
| | | } |
| | | if (SecurityUtils.matchesPassword(newPassword, password)) |
| | | { |
| | | return R.fail("新密码不能与旧密码相同"); |
| | | } |
| | | newPassword = SecurityUtils.encryptPassword(newPassword); |
| | | if (userService.resetUserPwd(userName, newPassword) > 0) |
| | | { |
| | | // 更新缓存用户密码 |
| | | loginUser.getUser().setPassword(newPassword); |
| | | tokenService.setLoginUser(loginUser); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("修改密码异常,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 头像上传 |
| | | */ |
| | | @Log(title = "用户头像", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/avatar") |
| | | public R<?> avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception |
| | | { |
| | | if (!file.isEmpty()) |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); |
| | | if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) |
| | | { |
| | | // 更新缓存用户头像 |
| | | loginUser.getUser().setAvatar(avatar); |
| | | tokenService.setLoginUser(loginUser); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("imgUrl", avatar); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | | return R.fail("上传图片异常,请联系管理员"); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.security.RegisterBody;
|
| | | import com.ruoyi.framework.security.service.SysRegisterService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | /**
|
| | | * 注册验证
|
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @AllArgsConstructor
|
| | | public class SysRegisterController extends BaseController {
|
| | | private SysRegisterService registerService;
|
| | | private ISysConfigService configService;
|
| | |
|
| | | @PostMapping("/register")
|
| | | public AjaxResult register(@RequestBody RegisterBody user) {
|
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
| | | return error("当前系统没有开启注册功能!");
|
| | | }
|
| | | String msg = registerService.register(user);
|
| | | return StringUtils.isEmpty(msg) ? success() : error(msg);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.security.RegisterBody; |
| | | import com.ruoyi.framework.security.service.SysRegisterService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.service.ISysConfigService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * 注册验证 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | public class SysRegisterController extends BaseController { |
| | | private SysRegisterService registerService; |
| | | private ISysConfigService configService; |
| | | |
| | | @PostMapping("/register") |
| | | public R<?> register(@RequestBody RegisterBody user) { |
| | | if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { |
| | | return R.fail("当前系统没有开启注册功能!"); |
| | | } |
| | | String msg = registerService.register(user); |
| | | return StringUtils.isEmpty(msg) ? R.ok() : R.fail(msg); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | 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 com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.security.LoginUser;
|
| | | import com.ruoyi.framework.security.service.SysPermissionService;
|
| | | import com.ruoyi.framework.security.service.TokenService;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.domain.SysRole;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.domain.SysUserRole;
|
| | | import com.ruoyi.project.system.service.ISysDeptService;
|
| | | import com.ruoyi.project.system.service.ISysRoleService;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | |
|
| | | /**
|
| | | * 角色信息
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/role")
|
| | | @AllArgsConstructor
|
| | | public class SysRoleController extends BaseController
|
| | | {
|
| | | private ISysRoleService roleService;
|
| | | private TokenService tokenService;
|
| | | private SysPermissionService permissionService;
|
| | | private ISysUserService userService;
|
| | | private ISysDeptService deptService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysRole role)
|
| | | {
|
| | | startPage();
|
| | | List<SysRole> list = roleService.selectRoleList(role);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:role:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysRole role)
|
| | | {
|
| | | List<SysRole> list = roleService.selectRoleList(role);
|
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
| | | util.exportExcel(response, list, "角色数据");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据角色编号获取详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:query')")
|
| | | @GetMapping(value = "/{roleId}")
|
| | | public AjaxResult getInfo(@PathVariable Long roleId)
|
| | | {
|
| | | roleService.checkRoleDataScope(roleId);
|
| | | return success(roleService.selectRoleById(roleId));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增角色
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:add')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysRole role)
|
| | | {
|
| | | if (!roleService.checkRoleNameUnique(role))
|
| | | {
|
| | | return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
| | | }
|
| | | else if (!roleService.checkRoleKeyUnique(role))
|
| | | {
|
| | | return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
| | | }
|
| | | role.setCreateBy(getUsername());
|
| | | return toAjax(roleService.insertRole(role));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改保存角色
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysRole role)
|
| | | {
|
| | | roleService.checkRoleAllowed(role);
|
| | | roleService.checkRoleDataScope(role.getRoleId());
|
| | | if (!roleService.checkRoleNameUnique(role))
|
| | | {
|
| | | return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
| | | }
|
| | | else if (!roleService.checkRoleKeyUnique(role))
|
| | | {
|
| | | return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
| | | }
|
| | | role.setUpdateBy(getUsername());
|
| | | |
| | | if (roleService.updateRole(role) > 0)
|
| | | {
|
| | | // 更新缓存用户权限
|
| | | LoginUser loginUser = getLoginUser();
|
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
| | | {
|
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
| | | tokenService.setLoginUser(loginUser);
|
| | | }
|
| | | return success();
|
| | | }
|
| | | return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改保存数据权限
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/dataScope")
|
| | | public AjaxResult dataScope(@RequestBody SysRole role)
|
| | | {
|
| | | roleService.checkRoleAllowed(role);
|
| | | roleService.checkRoleDataScope(role.getRoleId());
|
| | | return toAjax(roleService.authDataScope(role));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 状态修改
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/changeStatus")
|
| | | public AjaxResult changeStatus(@RequestBody SysRole role)
|
| | | {
|
| | | roleService.checkRoleAllowed(role);
|
| | | roleService.checkRoleDataScope(role.getRoleId());
|
| | | role.setUpdateBy(getUsername());
|
| | | return toAjax(roleService.updateRoleStatus(role));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除角色
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{roleIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] roleIds)
|
| | | {
|
| | | return toAjax(roleService.deleteRoleByIds(roleIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取角色选择框列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:query')")
|
| | | @GetMapping("/optionselect")
|
| | | public AjaxResult optionselect()
|
| | | {
|
| | | return success(roleService.selectRoleAll());
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询已分配用户角色列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/authUser/allocatedList")
|
| | | public TableDataInfo allocatedList(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectAllocatedList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询未分配用户角色列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/authUser/unallocatedList")
|
| | | public TableDataInfo unallocatedList(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectUnallocatedList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 取消授权用户
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/cancel")
|
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
| | | {
|
| | | return toAjax(roleService.deleteAuthUser(userRole));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 批量取消授权用户
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/cancelAll")
|
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
| | | {
|
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 批量选择用户授权
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/selectAll")
|
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
| | | {
|
| | | roleService.checkRoleDataScope(roleId);
|
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取对应角色部门树列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:query')")
|
| | | @GetMapping(value = "/deptTree/{roleId}")
|
| | | public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
| | | ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
| | | return ajax;
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.*; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | 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 com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.security.service.SysPermissionService; |
| | | import com.ruoyi.framework.security.service.TokenService; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysRole; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.domain.SysUserRole; |
| | | |
| | | /** |
| | | * 角色信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | @AllArgsConstructor |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | private ISysRoleService roleService; |
| | | private TokenService tokenService; |
| | | private SysPermissionService permissionService; |
| | | private ISysUserService userService; |
| | | private ISysDeptService deptService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysRole role) |
| | | { |
| | | startPage(); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:role:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysRole role) |
| | | { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | util.exportExcel(response, list, "角色数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据角色编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/{roleId}") |
| | | public R<?> getInfo(@PathVariable Long roleId) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return R.ok(roleService.selectRoleById(roleId)); |
| | | } |
| | | |
| | | /** |
| | | * 新增角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:add')") |
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysRole role) |
| | | { |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return R.fail("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return R.fail("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setCreateBy(getUsername()); |
| | | roleService.insertRole(role); |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改保存角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | if (!roleService.checkRoleNameUnique(role)) |
| | | { |
| | | return R.fail("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (!roleService.checkRoleKeyUnique(role)) |
| | | { |
| | | return R.fail("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setUpdateBy(getUsername()); |
| | | |
| | | if (roleService.updateRole(role) > 0) |
| | | { |
| | | // 更新缓存用户权限 |
| | | LoginUser loginUser = getLoginUser(); |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) |
| | | { |
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); |
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | | tokenService.setLoginUser(loginUser); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | return R.fail("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存数据权限 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public R<?> dataScope(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | roleService.authDataScope(role); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<?> changeStatus(@RequestBody SysRole role) |
| | | { |
| | | roleService.checkRoleAllowed(role); |
| | | roleService.checkRoleDataScope(role.getRoleId()); |
| | | role.setUpdateBy(getUsername()); |
| | | roleService.updateRoleStatus(role); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')") |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | public R<?> remove(@PathVariable Long[] roleIds) |
| | | { |
| | | roleService.deleteRoleByIds(roleIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取角色选择框列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping("/optionselect") |
| | | public R<?> optionselect() |
| | | { |
| | | return R.ok(roleService.selectRoleAll()); |
| | | } |
| | | |
| | | /** |
| | | * 查询已分配用户角色列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectAllocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询未分配用户角色列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public R<?> cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | roleService.deleteAuthUser(userRole); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public R<?> cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.deleteAuthUsers(roleId, userIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择用户授权 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public R<?> selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | roleService.checkRoleDataScope(roleId); |
| | | roleService.insertAuthUsers(roleId, userIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取对应角色部门树列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/deptTree/{roleId}") |
| | | public R<?> deptTree(@PathVariable("roleId") Long roleId) |
| | | { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); |
| | | map.put("depts", deptService.selectDeptTreeList(new SysDept())); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.project.system.domain.GetuiConfig; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUserClient; |
| | | import com.ruoyi.project.system.service.SysUserClientService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | */ |
| | | @PostMapping("/addOrUpdateClientId") |
| | | @Operation(summary = "添加/更新用户cid") |
| | | public AjaxResult addOrUpdateClientId(@RequestBody SysUserClient sysUserClient) { |
| | | public R<?> addOrUpdateClientId(@RequestBody SysUserClient sysUserClient) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | sysUserClient.setUserId(userId); |
| | | boolean result = sysUserClientService.addOrUpdateClientId(sysUserClient); |
| | | return result ? success() : error("设备绑定失败"); |
| | | return result ? R.ok() : R.fail("设备绑定失败"); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | |
|
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
|
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import com.ruoyi.project.system.service.*;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | 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 com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.system.domain.SysDept;
|
| | | import com.ruoyi.project.system.domain.SysRole;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | |
|
| | | /**
|
| | | * 用户信息
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/system/user")
|
| | | @AllArgsConstructor
|
| | | public class SysUserController extends BaseController
|
| | | {
|
| | | private ISysUserService userService;
|
| | | private ISysRoleService roleService;
|
| | | private ISysDeptService deptService;
|
| | | private ISysPostService postService;
|
| | | private ISysUserDeptService userDeptService;
|
| | |
|
| | | /**
|
| | | * 获取用户列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectUserList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:list')")
|
| | | @GetMapping("/listAll")
|
| | | public AjaxResult listAll(SysUser user)
|
| | | {
|
| | | List<SysUser> list = userService.selectUserList(user);
|
| | | return AjaxResult.success(list);
|
| | | }
|
| | |
|
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:user:export')")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysUser user)
|
| | | {
|
| | | List<SysUser> list = userService.selectUserList(user);
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | util.exportExcel(response, list, "用户数据");
|
| | | }
|
| | |
|
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:user:import')")
|
| | | @PostMapping("/importData")
|
| | | public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
| | | {
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | List<SysUser> userList = util.importExcel(file.getInputStream());
|
| | | String operName = getUsername();
|
| | | String message = userService.importUser(userList, updateSupport, operName);
|
| | | return success(message);
|
| | | }
|
| | |
|
| | | @PostMapping("/importTemplate")
|
| | | public void importTemplate(HttpServletResponse response)
|
| | | {
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | util.importTemplateExcel(response, "用户数据");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据用户编号获取详细信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:query')")
|
| | | @GetMapping(value = { "/", "/{userId}" })
|
| | | public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | if (StringUtils.isNotNull(userId))
|
| | | {
|
| | | userService.checkUserDataScope(userId);
|
| | | SysUser sysUser = userService.selectUserById(userId);
|
| | | ajax.put(AjaxResult.DATA_TAG, sysUser);
|
| | | ajax.put("postIds", postService.selectPostListByUserId(userId));
|
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
|
| | | }
|
| | | List<SysRole> roles = roleService.selectRoleAll();
|
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
| | | ajax.put("posts", postService.selectPostAll());
|
| | | SysUserDeptVo sysUserDeptVo = new SysUserDeptVo();
|
| | | sysUserDeptVo.setUserId(userId);
|
| | | List<SysUserDeptVo> sysUserDeptVos = userDeptService.userLoginFacotryList(sysUserDeptVo);
|
| | | ajax.put("deptIds",sysUserDeptVos.stream().map(SysUserDeptVo::getDeptId).collect(Collectors.toList()));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增用户
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:add')")
|
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysUser user)
|
| | | {
|
| | | roleService.checkRoleDataScope(user.getRoleIds());
|
| | | if (!userService.checkUserNameUnique(user))
|
| | | {
|
| | | return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | {
|
| | | return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | {
|
| | | return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
| | | }
|
| | | user.setCreateBy(getUsername());
|
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
| | | user.setTenantId(user.getDeptId());
|
| | | return toAjax(userService.insertUser(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改用户
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')")
|
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysUser user)
|
| | | {
|
| | | userService.checkUserAllowed(user);
|
| | | userService.checkUserDataScope(user.getUserId());
|
| | | roleService.checkRoleDataScope(user.getRoleIds());
|
| | | if (!userService.checkUserNameUnique(user))
|
| | | {
|
| | | return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
| | | {
|
| | | return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
| | | }
|
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
| | | {
|
| | | return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
| | | }
|
| | | user.setUpdateBy(getUsername());
|
| | | userService.bindUserDept(user);
|
| | | return toAjax(userService.updateUser(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除用户
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')")
|
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{userIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] userIds)
|
| | | {
|
| | | if (ArrayUtils.contains(userIds, getUserId()))
|
| | | {
|
| | | return error("当前用户不能删除");
|
| | | }
|
| | | return toAjax(userService.deleteUserByIds(userIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 重置密码
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
|
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/resetPwd")
|
| | | public AjaxResult resetPwd(@RequestBody SysUser user)
|
| | | {
|
| | | userService.checkUserAllowed(user);
|
| | | userService.checkUserDataScope(user.getUserId());
|
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
| | | user.setUpdateBy(getUsername());
|
| | | return toAjax(userService.resetPwd(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 状态修改
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')")
|
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
| | | @PutMapping("/changeStatus")
|
| | | public AjaxResult changeStatus(@RequestBody SysUser user)
|
| | | {
|
| | | userService.checkUserAllowed(user);
|
| | | userService.checkUserDataScope(user.getUserId());
|
| | | user.setUpdateBy(getUsername());
|
| | | return toAjax(userService.updateUserStatus(user));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据用户编号获取授权角色
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:query')")
|
| | | @GetMapping("/authRole/{userId}")
|
| | | public AjaxResult authRole(@PathVariable("userId") Long userId)
|
| | | {
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | SysUser user = userService.selectUserById(userId);
|
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
| | | ajax.put("user", user);
|
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
| | | return ajax;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 用户授权角色
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')")
|
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authRole")
|
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
| | | {
|
| | | userService.checkUserDataScope(userId);
|
| | | roleService.checkRoleDataScope(roleIds);
|
| | | userService.insertUserAuth(userId, roleIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取部门树列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:user:list')")
|
| | | @GetMapping("/deptTree")
|
| | | public AjaxResult deptTree(SysDept dept)
|
| | | {
|
| | | return success(deptService.selectDeptTreeList(dept));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 不分页用户查询
|
| | | * @param user
|
| | | * @return
|
| | | */
|
| | | @GetMapping("/userListNoPage")
|
| | | public AjaxResult userListNoPage(SysUser user){
|
| | | List<SysUser> sysUserList = userService.userListNoPage(user);
|
| | | return AjaxResult.success(sysUserList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询当前用户公司下所有用户
|
| | | * @param user
|
| | | * @return
|
| | | */
|
| | | @GetMapping("/userListNoPageByTenantId")
|
| | | public AjaxResult userListNoPageByTenantId(SysUser user){
|
| | | //获取登录用户信息
|
| | | SysUser loginUser = SecurityUtils.getLoginUser().getUser();
|
| | | user.setTenantId(loginUser.getTenantId());
|
| | | List<SysUser> sysUserList = userService.userListNoPage(user);
|
| | | return AjaxResult.success(sysUserList);
|
| | | }
|
| | | }
|
| | | package com.ruoyi.project.system.controller; |
| | | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysRole; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo; |
| | | import com.ruoyi.project.system.service.*; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 用户信息 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/user") |
| | | @AllArgsConstructor |
| | | public class SysUserController extends BaseController |
| | | { |
| | | private ISysUserService userService; |
| | | private ISysRoleService roleService; |
| | | private ISysDeptService deptService; |
| | | private ISysPostService postService; |
| | | private ISysUserDeptService userDeptService; |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/listAll") |
| | | public R<?> listAll(SysUser user) |
| | | { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysUser user) |
| | | { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.exportExcel(response, list, "用户数据"); |
| | | } |
| | | |
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:import')") |
| | | @PostMapping("/importData") |
| | | public R<?> importData(MultipartFile file, boolean updateSupport) throws Exception |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | List<SysUser> userList = util.importExcel(file.getInputStream()); |
| | | String operName = getUsername(); |
| | | String message = userService.importUser(userList, updateSupport, operName); |
| | | return R.ok(null, message); |
| | | } |
| | | |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) |
| | | { |
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); |
| | | util.importTemplateExcel(response, "用户数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping(value = { "/", "/{userId}" }) |
| | | public R<?> getInfo(@PathVariable(value = "userId", required = false) Long userId) |
| | | { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if (StringUtils.isNotNull(userId)) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | map.put("data", sysUser); |
| | | map.put("postIds", postService.selectPostListByUserId(userId)); |
| | | map.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | | } |
| | | List<SysRole> roles = roleService.selectRoleAll(); |
| | | map.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | map.put("posts", postService.selectPostAll()); |
| | | SysUserDeptVo sysUserDeptVo = new SysUserDeptVo(); |
| | | sysUserDeptVo.setUserId(userId); |
| | | List<SysUserDeptVo> sysUserDeptVos = userDeptService.userLoginFacotryList(sysUserDeptVo); |
| | | map.put("deptIds",sysUserDeptVos.stream().map(SysUserDeptVo::getDeptId).collect(Collectors.toList())); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:add')") |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public R<?> add(@Validated @RequestBody SysUser user) |
| | | { |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return R.fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return R.fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setTenantId(user.getDeptId()); |
| | | return R.ok(userService.insertUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> edit(@Validated @RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | roleService.checkRoleDataScope(user.getRoleIds()); |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | | return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) |
| | | { |
| | | return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); |
| | | } |
| | | else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) |
| | | { |
| | | return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); |
| | | } |
| | | user.setUpdateBy(getUsername()); |
| | | userService.bindUserDept(user); |
| | | return R.ok(userService.updateUser(user)); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:remove')") |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | public R<?> remove(@PathVariable Long[] userIds) |
| | | { |
| | | if (ArrayUtils.contains(userIds, getUserId())) |
| | | { |
| | | return R.fail("当前用户不能删除"); |
| | | } |
| | | return R.ok(userService.deleteUserByIds(userIds)) ; |
| | | } |
| | | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | public R<?> resetPwd(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | user.setUpdateBy(getUsername()); |
| | | return R.ok(userService.resetPwd(user)); |
| | | } |
| | | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public R<?> changeStatus(@RequestBody SysUser user) |
| | | { |
| | | userService.checkUserAllowed(user); |
| | | userService.checkUserDataScope(user.getUserId()); |
| | | user.setUpdateBy(getUsername()); |
| | | return R.ok(userService.updateUserStatus(user)) ; |
| | | } |
| | | |
| | | /** |
| | | * 根据用户编号获取授权角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:query')") |
| | | @GetMapping("/authRole/{userId}") |
| | | public R<?> authRole(@PathVariable("userId") Long userId) |
| | | { |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("user", user); |
| | | map.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 用户授权角色 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:edit')") |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | | public R<?> insertAuthRole(Long userId, Long[] roleIds) |
| | | { |
| | | userService.checkUserDataScope(userId); |
| | | roleService.checkRoleDataScope(roleIds); |
| | | userService.insertUserAuth(userId, roleIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/deptTree") |
| | | public R<?> deptTree(SysDept dept) |
| | | { |
| | | return R.ok(deptService.selectDeptTreeList(dept)); |
| | | } |
| | | |
| | | /** |
| | | * 不分页用户查询 |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @GetMapping("/userListNoPage") |
| | | public R<?> userListNoPage(SysUser user){ |
| | | List<SysUser> sysUserList = userService.userListNoPage(user); |
| | | return R.ok(sysUserList); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前用户公司下所有用户 |
| | | * @param user |
| | | * @return |
| | | */ |
| | | @GetMapping("/userListNoPageByTenantId") |
| | | public R<?> userListNoPageByTenantId(SysUser user){ |
| | | //获取登录用户信息 |
| | | SysUser loginUser = SecurityUtils.getLoginUser().getUser(); |
| | | user.setTenantId(loginUser.getTenantId()); |
| | | List<SysUser> sysUserList = userService.userListNoPage(user); |
| | | return R.ok(sysUserList); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.project.tool.gen.controller;
|
| | |
|
| | | import com.alibaba.druid.DbType;
|
| | | import com.alibaba.druid.sql.SQLUtils;
|
| | | import com.alibaba.druid.sql.ast.SQLStatement;
|
| | | import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement;
|
| | | import com.ruoyi.common.core.text.Convert;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.sql.SqlUtil;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
| | | import com.ruoyi.framework.config.GenConfig;
|
| | | import com.ruoyi.framework.web.controller.BaseController;
|
| | | import com.ruoyi.framework.web.domain.AjaxResult;
|
| | | import com.ruoyi.framework.web.page.TableDataInfo;
|
| | | import com.ruoyi.project.tool.gen.domain.GenTable;
|
| | | import com.ruoyi.project.tool.gen.domain.GenTableColumn;
|
| | | import com.ruoyi.project.tool.gen.service.IGenTableColumnService;
|
| | | import com.ruoyi.project.tool.gen.service.IGenTableService;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import lombok.AllArgsConstructor;
|
| | | import org.apache.commons.io.IOUtils;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.*;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * 代码生成 操作处理
|
| | | * |
| | | * @author ruoyi
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping("/tool/gen")
|
| | | @AllArgsConstructor
|
| | | public class GenController extends BaseController
|
| | | {
|
| | | private IGenTableService genTableService;
|
| | | private IGenTableColumnService genTableColumnService;
|
| | |
|
| | | /**
|
| | | * 查询代码生成列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo genList(GenTable genTable)
|
| | | {
|
| | | startPage();
|
| | | List<GenTable> list = genTableService.selectGenTableList(genTable);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取代码生成信息
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:query')")
|
| | | @GetMapping(value = "/{talbleId}")
|
| | | public AjaxResult getInfo(@PathVariable Long talbleId)
|
| | | {
|
| | | GenTable table = genTableService.selectGenTableById(talbleId);
|
| | | List<GenTable> tables = genTableService.selectGenTableAll();
|
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | | map.put("info", table);
|
| | | map.put("rows", list);
|
| | | map.put("tables", tables);
|
| | | return success(map);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询数据库列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
| | | @GetMapping("/db/list")
|
| | | public TableDataInfo dataList(GenTable genTable)
|
| | | {
|
| | | startPage();
|
| | | List<GenTable> list = genTableService.selectDbTableList(genTable);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询数据表字段列表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')")
|
| | | @GetMapping(value = "/column/{tableId}")
|
| | | public TableDataInfo columnList(Long tableId)
|
| | | {
|
| | | TableDataInfo dataInfo = new TableDataInfo();
|
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
|
| | | dataInfo.setRows(list);
|
| | | dataInfo.setTotal(list.size());
|
| | | return dataInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 导入表结构(保存)
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:import')")
|
| | | @Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
| | | @PostMapping("/importTable")
|
| | | public AjaxResult importTableSave(String tables)
|
| | | {
|
| | | String[] tableNames = Convert.toStrArray(tables);
|
| | | // 查询表信息
|
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
| | | genTableService.importGenTable(tableList, SecurityUtils.getUsername());
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 创建表结构(保存)
|
| | | */
|
| | | @PreAuthorize("@ss.hasRole('admin')")
|
| | | @Log(title = "创建表", businessType = BusinessType.OTHER)
|
| | | @PostMapping("/createTable")
|
| | | public AjaxResult createTableSave(String sql)
|
| | | {
|
| | | try
|
| | | {
|
| | | SqlUtil.filterKeyword(sql);
|
| | | List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql);
|
| | | List<String> tableNames = new ArrayList<>();
|
| | | for (SQLStatement sqlStatement : sqlStatements)
|
| | | {
|
| | | if (sqlStatement instanceof MySqlCreateTableStatement)
|
| | | {
|
| | | MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement;
|
| | | if (genTableService.createTable(createTableStatement.toString()))
|
| | | {
|
| | | String tableName = createTableStatement.getTableName().replaceAll("`", "");
|
| | | tableNames.add(tableName);
|
| | | }
|
| | | }
|
| | | }
|
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()]));
|
| | | String operName = SecurityUtils.getUsername();
|
| | | genTableService.importGenTable(tableList, operName);
|
| | | return AjaxResult.success();
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | logger.error(e.getMessage(), e);
|
| | | return AjaxResult.error("创建表结构异常");
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改保存代码生成业务
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
| | | @Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
|
| | | {
|
| | | genTableService.validateEdit(genTable);
|
| | | genTableService.updateGenTable(genTable);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除代码生成
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:remove')")
|
| | | @Log(title = "代码生成", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{tableIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] tableIds)
|
| | | {
|
| | | genTableService.deleteGenTableByIds(tableIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 预览代码
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:preview')")
|
| | | @GetMapping("/preview/{tableId}")
|
| | | public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException
|
| | | {
|
| | | Map<String, String> dataMap = genTableService.previewCode(tableId);
|
| | | return success(dataMap);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 生成代码(下载方式)
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
| | | @GetMapping("/download/{tableName}")
|
| | | public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
|
| | | {
|
| | | byte[] data = genTableService.downloadCode(tableName);
|
| | | genCode(response, data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 生成代码(自定义路径)
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
| | | @GetMapping("/genCode/{tableName}")
|
| | | public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
| | | {
|
| | | if (!GenConfig.isAllowOverwrite())
|
| | | {
|
| | | return AjaxResult.error("【系统预设】不允许生成文件覆盖到本地");
|
| | | }
|
| | | genTableService.generatorCode(tableName);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 同步数据库
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')")
|
| | | @Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
| | | @GetMapping("/synchDb/{tableName}")
|
| | | public AjaxResult synchDb(@PathVariable("tableName") String tableName)
|
| | | {
|
| | | genTableService.synchDb(tableName);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 批量生成代码
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')")
|
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
| | | @GetMapping("/batchGenCode")
|
| | | public void batchGenCode(HttpServletResponse response, String tables) throws IOException
|
| | | {
|
| | | String[] tableNames = Convert.toStrArray(tables);
|
| | | byte[] data = genTableService.downloadCode(tableNames);
|
| | | genCode(response, data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 生成zip文件
|
| | | */
|
| | | private void genCode(HttpServletResponse response, byte[] data) throws IOException
|
| | | {
|
| | | response.reset();
|
| | | response.addHeader("Access-Control-Allow-Origin", "*");
|
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
| | | response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\"");
|
| | | response.addHeader("Content-Length", "" + data.length);
|
| | | response.setContentType("application/octet-stream; charset=UTF-8");
|
| | | IOUtils.write(data, response.getOutputStream());
|
| | | }
|
| | | package com.ruoyi.project.tool.gen.controller; |
| | | |
| | | import com.alibaba.druid.DbType; |
| | | import com.alibaba.druid.sql.SQLUtils; |
| | | import com.alibaba.druid.sql.ast.SQLStatement; |
| | | import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.sql.SqlUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.config.GenConfig; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.project.tool.gen.domain.GenTable; |
| | | import com.ruoyi.project.tool.gen.domain.GenTableColumn; |
| | | import com.ruoyi.project.tool.gen.service.IGenTableColumnService; |
| | | import com.ruoyi.project.tool.gen.service.IGenTableService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 代码生成 操作处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/tool/gen") |
| | | @AllArgsConstructor |
| | | public class GenController extends BaseController |
| | | { |
| | | private IGenTableService genTableService; |
| | | private IGenTableColumnService genTableColumnService; |
| | | |
| | | /** |
| | | * 查询代码生成列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo genList(GenTable genTable) |
| | | { |
| | | startPage(); |
| | | List<GenTable> list = genTableService.selectGenTableList(genTable); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 获取代码生成信息 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:query')") |
| | | @GetMapping(value = "/{talbleId}") |
| | | public R<?> getInfo(@PathVariable Long talbleId) |
| | | { |
| | | GenTable table = genTableService.selectGenTableById(talbleId); |
| | | List<GenTable> tables = genTableService.selectGenTableAll(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId); |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("info", table); |
| | | map.put("rows", list); |
| | | map.put("tables", tables); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 查询数据库列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping("/db/list") |
| | | public TableDataInfo dataList(GenTable genTable) |
| | | { |
| | | startPage(); |
| | | List<GenTable> list = genTableService.selectDbTableList(genTable); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询数据表字段列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:list')") |
| | | @GetMapping(value = "/column/{tableId}") |
| | | public TableDataInfo columnList(Long tableId) |
| | | { |
| | | TableDataInfo dataInfo = new TableDataInfo(); |
| | | List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId); |
| | | dataInfo.setRows(list); |
| | | dataInfo.setTotal(list.size()); |
| | | return dataInfo; |
| | | } |
| | | |
| | | /** |
| | | * 导入表结构(保存) |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:import')") |
| | | @Log(title = "代码生成", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importTable") |
| | | public R<?> importTableSave(String tables) |
| | | { |
| | | String[] tableNames = Convert.toStrArray(tables); |
| | | // 查询表信息 |
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames); |
| | | genTableService.importGenTable(tableList, SecurityUtils.getUsername()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 创建表结构(保存) |
| | | */ |
| | | @PreAuthorize("@ss.hasRole('admin')") |
| | | @Log(title = "创建表", businessType = BusinessType.OTHER) |
| | | @PostMapping("/createTable") |
| | | public R<?> createTableSave(String sql) |
| | | { |
| | | try |
| | | { |
| | | SqlUtil.filterKeyword(sql); |
| | | List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.mysql); |
| | | List<String> tableNames = new ArrayList<>(); |
| | | for (SQLStatement sqlStatement : sqlStatements) |
| | | { |
| | | if (sqlStatement instanceof MySqlCreateTableStatement) |
| | | { |
| | | MySqlCreateTableStatement createTableStatement = (MySqlCreateTableStatement) sqlStatement; |
| | | if (genTableService.createTable(createTableStatement.toString())) |
| | | { |
| | | String tableName = createTableStatement.getTableName().replaceAll("`", ""); |
| | | tableNames.add(tableName); |
| | | } |
| | | } |
| | | } |
| | | List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()])); |
| | | String operName = SecurityUtils.getUsername(); |
| | | genTableService.importGenTable(tableList, operName); |
| | | return R.ok(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(e.getMessage(), e); |
| | | return R.fail("创建表结构异常"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改保存代码生成业务 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')") |
| | | @Log(title = "代码生成", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public R<?> editSave(@Validated @RequestBody GenTable genTable) |
| | | { |
| | | genTableService.validateEdit(genTable); |
| | | genTableService.updateGenTable(genTable); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 删除代码生成 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:remove')") |
| | | @Log(title = "代码生成", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{tableIds}") |
| | | public R<?> remove(@PathVariable Long[] tableIds) |
| | | { |
| | | genTableService.deleteGenTableByIds(tableIds); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 预览代码 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:preview')") |
| | | @GetMapping("/preview/{tableId}") |
| | | public R<?> preview(@PathVariable("tableId") Long tableId) throws IOException |
| | | { |
| | | Map<String, String> dataMap = genTableService.previewCode(tableId); |
| | | return R.ok(dataMap); |
| | | } |
| | | |
| | | /** |
| | | * 生成代码(下载方式) |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/download/{tableName}") |
| | | public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException |
| | | { |
| | | byte[] data = genTableService.downloadCode(tableName); |
| | | genCode(response, data); |
| | | } |
| | | |
| | | /** |
| | | * 生成代码(自定义路径) |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/genCode/{tableName}") |
| | | public R<?> genCode(@PathVariable("tableName") String tableName) |
| | | { |
| | | if (!GenConfig.isAllowOverwrite()) |
| | | { |
| | | return R.fail("【系统预设】不允许生成文件覆盖到本地"); |
| | | } |
| | | genTableService.generatorCode(tableName); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 同步数据库 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:edit')") |
| | | @Log(title = "代码生成", businessType = BusinessType.UPDATE) |
| | | @GetMapping("/synchDb/{tableName}") |
| | | public R<?> synchDb(@PathVariable("tableName") String tableName) |
| | | { |
| | | genTableService.synchDb(tableName); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 批量生成代码 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('tool:gen:code')") |
| | | @Log(title = "代码生成", businessType = BusinessType.GENCODE) |
| | | @GetMapping("/batchGenCode") |
| | | public void batchGenCode(HttpServletResponse response, String tables) throws IOException |
| | | { |
| | | String[] tableNames = Convert.toStrArray(tables); |
| | | byte[] data = genTableService.downloadCode(tableNames); |
| | | genCode(response, data); |
| | | } |
| | | |
| | | /** |
| | | * 生成zip文件 |
| | | */ |
| | | private void genCode(HttpServletResponse response, byte[] data) throws IOException |
| | | { |
| | | response.reset(); |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
| | | response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); |
| | | response.addHeader("Content-Length", "" + data.length); |
| | | response.setContentType("application/octet-stream; charset=UTF-8"); |
| | | IOUtils.write(data, response.getOutputStream()); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.projectManagement.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.projectManagement.dto.InfoStageDto; |
| | | import com.ruoyi.projectManagement.dto.UpdateStateInfo; |
| | | import com.ruoyi.projectManagement.service.InfoService; |
| | |
| | | @RequestMapping("/projectManagement/info") |
| | | @Tag(name = "项目管理信息表(项目管理类型)") |
| | | @RequiredArgsConstructor |
| | | public class InfoController { |
| | | public class InfoController extends BaseController { |
| | | |
| | | private final InfoService infoService; |
| | | private final InfoStageHandleService infoStageHandleService; |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "保存") |
| | | public AjaxResult save(@RequestBody @Valid SaveInfoVo saveInfoVo) { |
| | | public R<?> save(@RequestBody @Valid SaveInfoVo saveInfoVo) { |
| | | infoService.save(saveInfoVo); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/updateStatus") |
| | | @Operation(summary = "修改状态") |
| | | public AjaxResult updateStatus(@RequestBody @Valid UpdateStateInfo updateStateInfo){ |
| | | public R<?> updateStatus(@RequestBody @Valid UpdateStateInfo updateStateInfo){ |
| | | infoService.updateStatus(updateStateInfo); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | public R<?> delete(@PathVariable Long id) { |
| | | infoService.deleteInfo(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/listPage") |
| | | @Operation(summary = "分页列表") |
| | | public AjaxResult listPage(@RequestBody @Valid SearchInfoVo vo) { |
| | | return AjaxResult.success(infoService.searchListInfo(vo)); |
| | | public R<?> listPage(@RequestBody @Valid SearchInfoVo vo) { |
| | | return R.ok(infoService.searchListInfo(vo)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/{id}") |
| | | @Operation(summary = "详情") |
| | | public AjaxResult getInfoById(@PathVariable Long id) { |
| | | return AjaxResult.success(infoService.getInfoById(id)); |
| | | public R<?> getInfoById(@PathVariable Long id) { |
| | | return R.ok(infoService.getInfoById(id)); |
| | | } |
| | | |
| | | @PostMapping("/saveStage") |
| | | @Operation(summary = "保存阶段") |
| | | public AjaxResult saveStage(@RequestBody @Valid SaveInfoStageVo dto) { |
| | | public R<?> saveStage(@RequestBody @Valid SaveInfoStageVo dto) { |
| | | infoStageHandleService.save(dto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/listStage/{id}") |
| | | @Operation(summary = "列表阶段") |
| | | public AjaxResult listStage(@PathVariable Long id) { |
| | | return AjaxResult.success(infoStageHandleService.getListVoByInfoId(id)); |
| | | public R<?> listStage(@PathVariable Long id) { |
| | | return R.ok(infoStageHandleService.getListVoByInfoId(id)); |
| | | } |
| | | |
| | | @PostMapping("/deleteStage/{id}") |
| | | @Operation(summary = "删除阶段") |
| | | public AjaxResult deleteStage(@PathVariable Long id) { |
| | | public R<?> deleteStage(@PathVariable Long id) { |
| | | infoStageHandleService.deleteById(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.projectManagement.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.projectManagement.service.PlanService; |
| | | import com.ruoyi.projectManagement.vo.SavePlanNodeVo; |
| | | import com.ruoyi.projectManagement.vo.SavePlanVo; |
| | |
| | | @RequestMapping("/projectManagement/plan") |
| | | @Tag(name = "项目管理计划表(项目管理类型)") |
| | | @RequiredArgsConstructor |
| | | public class PlanController { |
| | | public class PlanController extends BaseController { |
| | | |
| | | private final PlanService planService; |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "保存") |
| | | public AjaxResult save(@RequestBody @Valid SavePlanVo savePlanVo) { |
| | | public R<?> save(@RequestBody @Valid SavePlanVo savePlanVo) { |
| | | planService.savePlan(savePlanVo); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/delete/{id}") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | public R<?> delete(@PathVariable Long id) { |
| | | planService.deletePlan(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/listPage") |
| | | @Operation(summary = "分页列表") |
| | | public AjaxResult listPage(@RequestBody SearchPlanVo searchPlanVo) { |
| | | return AjaxResult.success(planService.searchPlan(searchPlanVo)); |
| | | public R<?> listPage(@RequestBody SearchPlanVo searchPlanVo) { |
| | | return R.ok(planService.searchPlan(searchPlanVo)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.projectManagement.dto.RoleDto; |
| | | import com.ruoyi.projectManagement.mapper.RolesMapper; |
| | | import com.ruoyi.projectManagement.pojo.Roles; |
| | |
| | | @AllArgsConstructor |
| | | @RequestMapping("/projectManagement/roles") |
| | | @Tag(name = "") |
| | | public class RolesController { |
| | | public class RolesController extends BaseController { |
| | | |
| | | private RolesService rolesservice; |
| | | private RolesMapper rolesMapper; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询所有") |
| | | public AjaxResult listPage(Page<Roles> page, Roles roles) { |
| | | return AjaxResult.success(rolesservice.listPage(page, roles)); |
| | | public R<?> listPage(Page<Roles> page, Roles roles) { |
| | | return R.ok(rolesservice.listPage(page, roles)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增") |
| | | public AjaxResult add(@RequestBody RoleDto roleDto) { |
| | | public R<?> add(@RequestBody RoleDto roleDto) { |
| | | if (roleDto.getIsDefaultNo()) { |
| | | roleDto.setNo(OrderUtils.countTodayByCreateTime(rolesMapper, "XMJS","no")); |
| | | } |
| | | return AjaxResult.success(rolesservice.save(roleDto)); |
| | | return R.ok(rolesservice.save(roleDto)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改") |
| | | public AjaxResult update(@RequestBody Roles roles) { |
| | | return AjaxResult.success(rolesservice.updateById(roles)); |
| | | public R<?> update(@RequestBody Roles roles) { |
| | | return R.ok(rolesservice.updateById(roles)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除") |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(rolesservice.removeBatchByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(rolesservice.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @PostMapping("/listSimpleRole") |
| | | public AjaxResult listSimpleRole() { |
| | | return AjaxResult.success(rolesservice.listSimpleRole()); |
| | | public R<?> listSimpleRole() { |
| | | return R.ok(rolesservice.listSimpleRole()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.InvoicePurchaseReportDto; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | |
| | | @Tag(name = "采购报表") |
| | | @RequestMapping("/purchase/report") |
| | | @AllArgsConstructor |
| | | public class AccountingReportController { |
| | | public class AccountingReportController extends BaseController { |
| | | |
| | | private IInvoicePurchaseService invoicePurchaseService; |
| | | |
| | | @GetMapping("/list") |
| | | @Log(title = "采购报表-项目利润", businessType = BusinessType.OTHER) |
| | | public AjaxResult list(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto) { |
| | | public R<?> list(Page page, InvoicePurchaseReportDto invoicePurchaseReportDto) { |
| | | IPage<InvoicePurchaseReportDto> result =invoicePurchaseService.listPurchaseReport(page, invoicePurchaseReportDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @Log(title = "采购报表-项目利润导出", businessType = BusinessType.EXPORT) |
| | |
| | | |
| | | @Log(title = "采购报表-增值税比对", businessType = BusinessType.OTHER) |
| | | @GetMapping("/listVat") |
| | | public AjaxResult listVat(Page page,String month) { |
| | | public R<?> listVat(Page page,String month) { |
| | | IPage<VatDto> result = invoicePurchaseService.listVat(page, month); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @Log(title = "采购报表-增值税比对", businessType = BusinessType.EXPORT) |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.InvoicePurchaseDto; |
| | | import com.ruoyi.purchase.pojo.InvoicePurchase; |
| | |
| | | */ |
| | | @Log(title = "发票信息", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrUpdateInvoice") |
| | | public AjaxResult addOrUpdateInvoice(@RequestBody InvoicePurchaseDto invoicePurchaseDto) throws IOException { |
| | | return toAjax(invoicePurchaseService.addOrUpdateInvoice(invoicePurchaseDto)); |
| | | public R<?> addOrUpdateInvoice(@RequestBody InvoicePurchaseDto invoicePurchaseDto) throws IOException { |
| | | invoicePurchaseService.addOrUpdateInvoice(invoicePurchaseDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "发票信息", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delInvoice") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(invoicePurchaseService.delInvoice(ids)); |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | invoicePurchaseService.delInvoice(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PaymentHistoryRecordVo; |
| | | import com.ruoyi.purchase.dto.PaymentLedgerDto; |
| | |
| | | * 获取付款登记详细信息 |
| | | */ |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(paymentRegistrationService.selectPaymentRegistrationById(id)); |
| | | public R<?> getInfo(@PathVariable("id") Long id) { |
| | | return R.ok(paymentRegistrationService.selectPaymentRegistrationById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "付款登记", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody List<PaymentRegistration> paymentRegistration) { |
| | | return toAjax(paymentRegistrationService.insertPaymentRegistration(paymentRegistration)); |
| | | public R<?> add(@RequestBody List<PaymentRegistration> paymentRegistration) { |
| | | paymentRegistrationService.insertPaymentRegistration(paymentRegistration); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "付款登记", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult edit(@RequestBody PaymentRegistration paymentRegistration) { |
| | | return toAjax(paymentRegistrationService.updatePaymentRegistration(paymentRegistration)); |
| | | public R<?> edit(@RequestBody PaymentRegistration paymentRegistration) { |
| | | paymentRegistrationService.updatePaymentRegistration(paymentRegistration); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "付款登记", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/del") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(paymentRegistrationService.deletePaymentRegistrationByIds(ids)); |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | paymentRegistrationService.deletePaymentRegistrationByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "付款登记", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody Long[] ids) { |
| | | return toAjax(paymentRegistrationService.delete(ids)); |
| | | public R<?> delete(@RequestBody Long[] ids) { |
| | | paymentRegistrationService.delete(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取付款登记详细信息 |
| | | */ |
| | | @GetMapping(value = "/byPurchaseId/{id}") |
| | | public AjaxResult getPurchaseInfo(@PathVariable("id") Long id) { |
| | | return success(paymentRegistrationService.selectPaymentRegistrationByPurchaseId(id)); |
| | | public R<?> getPurchaseInfo(@PathVariable("id") Long id) { |
| | | return R.ok(paymentRegistrationService.selectPaymentRegistrationByPurchaseId(id)); |
| | | } |
| | | |
| | | /** |
| | | * 获取付款登记详细信息 |
| | | */ |
| | | @GetMapping(value = "/paymentLedgerList") |
| | | public AjaxResult paymentLedgerList(PaymentLedgerDto paymentLedgerDto, Page page, |
| | | public R<?> paymentLedgerList(PaymentLedgerDto paymentLedgerDto, Page page, |
| | | Integer detailPageNum, |
| | | Integer detailPageSize) { |
| | | IPage<Map<String, Object>> mapIPage = paymentRegistrationService.selectPaymentLedgerList(paymentLedgerDto, page, detailPageNum, detailPageSize); |
| | | return success(mapIPage); |
| | | return R.ok(mapIPage); |
| | | } |
| | | |
| | | /** |
| | | * 供应商往来分页接口 |
| | | */ |
| | | @GetMapping("/supplierNameListPage") |
| | | public AjaxResult supplierNameListPage(PaymentLedgerDto paymentLedgerDto, Page page){ |
| | | return success(paymentRegistrationService.supplierNameListPage(page,paymentLedgerDto)); |
| | | public R<?> supplierNameListPage(PaymentLedgerDto paymentLedgerDto, Page page){ |
| | | return R.ok(paymentRegistrationService.supplierNameListPage(page,paymentLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 供应商往来分页接口 |
| | | */ |
| | | @GetMapping("/supplierNameListPageDetails") |
| | | public AjaxResult supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto){ |
| | | return success(paymentRegistrationService.supplierNameListPageDetails(paymentLedgerDto)); |
| | | public R<?> supplierNameListPageDetails(PaymentLedgerDto paymentLedgerDto){ |
| | | return R.ok(paymentRegistrationService.supplierNameListPageDetails(paymentLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 获取本月应付信息 |
| | | */ |
| | | @GetMapping(value = "/paymentMonthList") |
| | | public AjaxResult paymentMonthList() { |
| | | return success(paymentRegistrationService.paymentMonthList()); |
| | | public R<?> paymentMonthList() { |
| | | return R.ok(paymentRegistrationService.paymentMonthList()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getPaymentRecordList/{supplierId}") |
| | | public AjaxResult getPaymentRecordList(@PathVariable Long supplierId) { |
| | | public R<?> getPaymentRecordList(@PathVariable Long supplierId) { |
| | | List<PaymentHistoryRecordVo> paymentRecordList = paymentRegistrationService.getPaymentRecordList(supplierId); |
| | | return success(paymentRecordList); |
| | | return R.ok(paymentRecordList); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto; |
| | | import com.ruoyi.purchase.service.impl.ProcurementBusinessSummaryServiceImpl; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | private ProcurementBusinessSummaryServiceImpl procurementBusinessSummaryService; |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, ProcurementBusinessSummaryDto procurementBusinessSummaryDto) { |
| | | return AjaxResult.success(procurementBusinessSummaryService.listPage(page, procurementBusinessSummaryDto)); |
| | | public R<?> listPage(Page page, ProcurementBusinessSummaryDto procurementBusinessSummaryDto) { |
| | | return R.ok(procurementBusinessSummaryService.listPage(page, procurementBusinessSummaryDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper; |
| | |
| | | @Log(title = "导入采购台账", businessType = BusinessType.INSERT) |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入采购台账") |
| | | public AjaxResult importData(@RequestParam("file") |
| | | public R<?> importData(@RequestParam("file") |
| | | @ApiParam(value = "Excel文件", required = true) |
| | | MultipartFile file) { |
| | | return purchaseLedgerService.importData(file); |
| | |
| | | */ |
| | | @Log(title = "采购台账", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditPurchase") |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception { |
| | | return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto)); |
| | | public R<?> addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception { |
| | | purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "/查询采购模板") |
| | | @GetMapping("/getPurchaseTemplateList") |
| | | public AjaxResult getPurchaseTemplateList() { |
| | | public R<?> getPurchaseTemplateList() { |
| | | List<PurchaseLedgerTemplate> purchaseLedgers = purchaseLedgerTemplateMapper.selectList(null); |
| | | purchaseLedgers.forEach(purchaseLedgerDto1 -> { |
| | | LambdaQueryWrapper<SalesLedgerProductTemplate> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | purchaseLedgerDto1.setProductList(list); |
| | | } |
| | | }); |
| | | return AjaxResult.success(purchaseLedgers); |
| | | return R.ok(purchaseLedgers); |
| | | } |
| | | /** |
| | | * 修改采购台账审批状态 |
| | | */ |
| | | @PostMapping("/updateApprovalStatus") |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){ |
| | | return toAjax(purchaseLedgerService.updateById(purchaseLedger)); |
| | | public R<?> addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){ |
| | | purchaseLedgerService.updateById(purchaseLedger); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 查询采购台账和产品父子列表 |
| | |
| | | */ |
| | | @Log(title = "采购台账", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delPurchase") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(purchaseLedgerService.deletePurchaseLedgerByIds(ids)); |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | purchaseLedgerService.deletePurchaseLedgerByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 根据销售合同查询产品信息 |
| | | */ |
| | | @GetMapping("/getProductBySalesNo") |
| | | public AjaxResult getProductBySalesNo(Long id) { |
| | | return AjaxResult.success(purchaseLedgerService.getProductBySalesNo(id)); |
| | | public R<?> getProductBySalesNo(Long id) { |
| | | return R.ok(purchaseLedgerService.getProductBySalesNo(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 根据id查询采购合同号 |
| | | */ |
| | | @GetMapping("/getPurchaseNoById") |
| | | public AjaxResult getPurchaseNoById(Long id) { |
| | | return AjaxResult.success(purchaseLedgerService.getPurchaseNoById(id)); |
| | | public R<?> getPurchaseNoById(Long id) { |
| | | return R.ok(purchaseLedgerService.getPurchaseNoById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 根据采购合同号查询产品 |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public AjaxResult getInfo(PurchaseLedgerDto purchaseLedgerDto) { |
| | | return AjaxResult.success(purchaseLedgerService.getInfo(purchaseLedgerDto)); |
| | | public R<?> getInfo(PurchaseLedgerDto purchaseLedgerDto) { |
| | | return R.ok(purchaseLedgerService.getInfo(purchaseLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 查询采购台账列表 |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | return AjaxResult.success(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger)); |
| | | public R<?> listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | return R.ok(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger)); |
| | | } |
| | | |
| | | @Operation(summary = "生成采购序列号") |
| | | @GetMapping("/createPurchaseNo") |
| | | @Log(title = "生成采购序列号", businessType = BusinessType.OTHER) |
| | | public AjaxResult createPurchaseNo() { |
| | | return AjaxResult.success("生成成功",purchaseLedgerService.getPurchaseNo()); |
| | | public R<?> createPurchaseNo() { |
| | | return R.ok(purchaseLedgerService.getPurchaseNo(), "生成成功"); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper; |
| | | import com.ruoyi.purchase.mapper.SalesLedgerProductTemplateMapper; |
| | |
| | | @RequestMapping("/purchaseLedgerTemplate") |
| | | @Tag(name = "采购台账模板") |
| | | @AllArgsConstructor |
| | | public class PurchaseLedgerTemplateController { |
| | | public class PurchaseLedgerTemplateController extends BaseController { |
| | | |
| | | private PurchaseLedgerTemplateMapper purchaseLedgerTemplateMapper; |
| | | private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; |
| | |
| | | @PostMapping("/add") |
| | | @Log(title = "添加采购台账模板", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "添加采购台账模板") |
| | | public AjaxResult add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | public R<?> add(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 采购模板 |
| | | if(StringUtils.isNotEmpty(purchaseLedgerDto.getTemplateName())){ |
| | | // 模板名称不能重复,有重复就不需要新增了 |
| | |
| | | }); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "采购台账模板", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "删除采购台账模板") |
| | | public AjaxResult delete(@RequestBody List<Long> id) { |
| | | if(CollectionUtils.isEmpty(id)) return AjaxResult.error("请选择要删除的采购台账模板"); |
| | | public R<?> delete(@RequestBody List<Long> id) { |
| | | if(CollectionUtils.isEmpty(id)) return R.fail("请选择要删除的采购台账模板"); |
| | | int result = purchaseLedgerTemplateMapper.deleteBatchIds(id); |
| | | salesLedgerProductTemplateMapper.delete(new LambdaQueryWrapper<SalesLedgerProductTemplate>() |
| | | .in(SalesLedgerProductTemplate::getSalesLedgerId, id)); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "修改采购台账模板", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "修改采购台账模板") |
| | | public AjaxResult update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | public R<?> update(@RequestBody PurchaseLedgerDto purchaseLedgerDto) { |
| | | // 模板名称不能重复,有重复就不需要新增了 |
| | | PurchaseLedgerTemplate purchaseLedgerTemplate = purchaseLedgerTemplateMapper |
| | | .selectOne(new LambdaQueryWrapper<PurchaseLedgerTemplate>() |
| | |
| | | salesLedgerProductTemplateMapper.insert(salesLedgerProductTemplate); |
| | | }); |
| | | } |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseReturnOrderDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseReturnOrdersMapper; |
| | | import com.ruoyi.purchase.service.PurchaseReturnOrdersService; |
| | |
| | | @RequestMapping("/purchaseReturnOrders") |
| | | @Tag(name = "采购退货单") |
| | | @AllArgsConstructor |
| | | public class PurchaseReturnOrdersController { |
| | | public class PurchaseReturnOrdersController extends BaseController { |
| | | private PurchaseReturnOrdersService purchaseReturnOrdersService; |
| | | private PurchaseReturnOrdersMapper purchaseReturnOrdersMapper; |
| | | |
| | | |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) { |
| | | return AjaxResult.success(purchaseReturnOrdersService.listPage(page, purchaseReturnOrderDto)); |
| | | public R<?> listPage(Page page, PurchaseReturnOrderDto purchaseReturnOrderDto) { |
| | | return R.ok(purchaseReturnOrdersService.listPage(page, purchaseReturnOrderDto)); |
| | | } |
| | | |
| | | // 新增 |
| | | @Log(title = "采购退货单", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody PurchaseReturnOrderDto purchaseReturnOrderDto) throws Exception { |
| | | public R<?> add(@RequestBody PurchaseReturnOrderDto purchaseReturnOrderDto) throws Exception { |
| | | if (purchaseReturnOrderDto.getIsDefaultNo()) { |
| | | purchaseReturnOrderDto.setNo(OrderUtils.countTodayByCreateTime(purchaseReturnOrdersMapper, "CGTL", "no")); |
| | | } |
| | | return AjaxResult.success(purchaseReturnOrdersService.add(purchaseReturnOrderDto)); |
| | | return R.ok(purchaseReturnOrdersService.add(purchaseReturnOrderDto)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/selectById/{id}") |
| | | public AjaxResult selectById(@PathVariable Long id) { |
| | | return AjaxResult.success(purchaseReturnOrdersService.getPurchaseReturnOrderDtoById(id)); |
| | | public R<?> selectById(@PathVariable Long id) { |
| | | return R.ok(purchaseReturnOrdersService.getPurchaseReturnOrderDtoById(id)); |
| | | } |
| | | |
| | | @PostMapping("/deleteById/{id}") |
| | | public AjaxResult deleteById(@PathVariable Long id) { |
| | | public R<?> deleteById(@PathVariable Long id) { |
| | | purchaseReturnOrdersService.deleteById(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/getByPurchaseLedgerId") |
| | | @Operation(summary = "采购退货-根据采购订单id查询采购订单对应的入库产品信息") |
| | | public AjaxResult getByPurchaseLedgerId(Long purchaseLedgerId) { |
| | | public R<?> getByPurchaseLedgerId(Long purchaseLedgerId) { |
| | | List<PurchaseStockInProductVo> purchaseStockInProductVos = purchaseReturnOrdersService.getByPurchaseLedgerId(purchaseLedgerId); |
| | | return AjaxResult.success(purchaseStockInProductVos); |
| | | return R.ok(purchaseStockInProductVos); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PaymentRegistrationDto; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | |
| | | |
| | | @Operation(summary = "根据id查询付款流水") |
| | | @GetMapping("/getPaymentRegistrationById") |
| | | public AjaxResult getPaymentRegistrationById(Long id) { |
| | | public R<?> getPaymentRegistrationById(Long id) { |
| | | PaymentRegistration byId = paymentRegistrationService.getById(id); |
| | | return AjaxResult.success(byId); |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | @Operation(summary = "修改付款流水") |
| | | @PutMapping("/updatePaymentRegistration") |
| | | @Log(title = "修改付款流水", businessType = BusinessType.UPDATE) |
| | | public AjaxResult updatePaymentRegistration(@RequestBody PaymentRegistration paymentRegistratio) { |
| | | return AjaxResult.success(paymentRegistrationService.updatePaymentRegistration(paymentRegistratio)); |
| | | public R<?> updatePaymentRegistration(@RequestBody PaymentRegistration paymentRegistratio) { |
| | | return R.ok(paymentRegistrationService.updatePaymentRegistration(paymentRegistratio)); |
| | | } |
| | | |
| | | @Operation(summary = "删除付款流水") |
| | | @DeleteMapping("/delPaymentRegistration") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delPaymentRegistration(@RequestBody List<Long> id) { |
| | | return toAjax(paymentRegistrationService.delPaymentRegistration(id)); |
| | | public R<?> delPaymentRegistration(@RequestBody List<Long> id) { |
| | | paymentRegistrationService.delPaymentRegistration(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "来票登记", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrUpdateRegistration") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult addOrUpdateRegistration(@RequestBody List<TicketRegistrationDto> ticketRegistrationDto) throws IOException { |
| | | if(CollectionUtils.isEmpty(ticketRegistrationDto)) return AjaxResult.error("请选择要保存的记录"); |
| | | public R<?> addOrUpdateRegistration(@RequestBody List<TicketRegistrationDto> ticketRegistrationDto) throws IOException { |
| | | if(CollectionUtils.isEmpty(ticketRegistrationDto)) return R.fail("请选择要保存的记录"); |
| | | for (TicketRegistrationDto ticketRegistrationDto1 : ticketRegistrationDto) { |
| | | ticketRegistrationService.addOrUpdateRegistration(ticketRegistrationDto1); |
| | | } |
| | | return toAjax(1); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/getProductRecordById") |
| | | public AjaxResult getProductRecordById(@RequestBody ProductRecordDto productRecordDto) { |
| | | public R<?> getProductRecordById(@RequestBody ProductRecordDto productRecordDto) { |
| | | if (productRecordDto.getId() == null) { |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | return AjaxResult.success(productRecordService.getProductRecordById(productRecordDto)); |
| | | return R.ok(productRecordService.getProductRecordById(productRecordDto)); |
| | | } |
| | | |
| | | @Schema(description = "修改来票登记") |
| | | @PostMapping("/updateRegistration") |
| | | public AjaxResult updateRegistration(@RequestBody ProductRecordDto productRecordDto) { |
| | | public R<?> updateRegistration(@RequestBody ProductRecordDto productRecordDto) { |
| | | |
| | | return productRecordService.updateRecord(productRecordDto); |
| | | } |
| | |
| | | @Log(title = "删除来票登记(来票台账)", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delRegistration") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delRegistration(@RequestBody Long[] ids) { |
| | | return toAjax(ticketRegistrationService.delRegistration(ids)); |
| | | public R<?> delRegistration(@RequestBody Long[] ids) { |
| | | ticketRegistrationService.delRegistration(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 分页查询产品信息开票记录列表 |
| | | */ |
| | | @GetMapping("/productRecordPage") |
| | | public AjaxResult productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto) { |
| | | public R<?> productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto) { |
| | | |
| | | IPage<ProductRecordDto> list = productRecordService.productRecordPage(page,ticketRegistrationDto); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询发票号 |
| | | */ |
| | | @GetMapping("/getTicketNo") |
| | | public AjaxResult getTicketNo(TicketRegistrationDto ticketRegistrationDto) { |
| | | return AjaxResult.success(ticketRegistrationService.getTicketNo(ticketRegistrationDto)); |
| | | public R<?> getTicketNo(TicketRegistrationDto ticketRegistrationDto) { |
| | | return R.ok(ticketRegistrationService.getTicketNo(ticketRegistrationDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @Schema(description = "根据id查询来漂登记") |
| | | @GetMapping("/getPuargeById") |
| | | public AjaxResult getPuargeById(Long id) { |
| | | return AjaxResult.success(ticketRegistrationService.getPuargeById( id)); |
| | | public R<?> getPuargeById(Long id) { |
| | | return R.ok(ticketRegistrationService.getPuargeById( id)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.pojo.ProductRecord; |
| | |
| | | |
| | | IPage<ProductRecordDto> productRecordPage(Page page, TicketRegistrationDto ticketRegistrationDto); |
| | | |
| | | AjaxResult updateRecord(ProductRecordDto productRecordDto); |
| | | R<?> updateRecord(ProductRecordDto productRecordDto); |
| | | |
| | | ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.sales.pojo.InvoiceRegistrationProduct; |
| | |
| | | |
| | | String getPurchaseNo(); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R<?> importData(MultipartFile file); |
| | | |
| | | PurchaseLedgerDto getPurchaseByCode(PurchaseLedgerDto purchaseLedgerDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.purchase.dto.ProductRecordDto; |
| | | import com.ruoyi.purchase.dto.TicketRegistrationDto; |
| | | import com.ruoyi.purchase.mapper.ProductRecordMapper; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateRecord(ProductRecordDto productRecordDto) { |
| | | public R<?> updateRecord(ProductRecordDto productRecordDto) { |
| | | ProductRecord productRecord = productRecordMapper.selectById(productRecordDto.getId()); |
| | | if (productRecord == null) return AjaxResult.error("记录不存在"); |
| | | if (productRecord == null) return R.fail("记录不存在"); |
| | | |
| | | // 更新产品台账 |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId()); |
| | |
| | | productRecord.setFutureTicketsAmount(productRecord.getFutureTickets().multiply(productRecord.getTaxInclusiveUnitPrice())); |
| | | productRecordMapper.updateById(productRecord); |
| | | |
| | | return AjaxResult.success("修改成功"); |
| | | return R.ok(null, "修改成功"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R<?> importData(MultipartFile file) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | ExcelUtil<PurchaseLedgerImportDto> salesLedgerImportDtoExcelUtil = new ExcelUtil<>(PurchaseLedgerImportDto.class); |
| | | Map<String, List<PurchaseLedgerImportDto>> stringListMap = salesLedgerImportDtoExcelUtil.importExcelMultiSheet(Arrays.asList("采购台账数据", "采购产品数据"), inputStream, 0); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return AjaxResult.error("采购表格为空!"); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return R.fail("采购表格为空!"); |
| | | // 业务层合并 |
| | | List<PurchaseLedgerImportDto> salesLedgerImportDtoList = stringListMap.get("采购台账数据"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return AjaxResult.error("采购台账数据为空!"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return R.fail("采购台账数据为空!"); |
| | | List<PurchaseLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("采购产品数据"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return AjaxResult.error("采购产品数据为空!"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return R.fail("采购产品数据为空!"); |
| | | // 供应商数据 |
| | | List<SupplierManage> customers = supplierManageMapper.selectList(new LambdaQueryWrapper<SupplierManage>().in(SupplierManage::getSupplierName, |
| | | salesLedgerImportDtoList.stream().map(PurchaseLedgerImportDto::getSupplierName).collect(Collectors.toList()))); |
| | |
| | | addApproveByPurchase(loginUser,salesLedger); |
| | | } |
| | | |
| | | return AjaxResult.success("导入成功"); |
| | | return R.ok(null, "导入成功"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return AjaxResult.success("导入失败"); |
| | | return R.ok(null, "导入失败"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.dto.QualityInspectDto; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return AjaxResult.success(qualityInspectService.add(qualityInspectDto)); |
| | | public R<?> add(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return R.ok(qualityInspectService.add(qualityInspectDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityInspect(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityInspect(@RequestBody List<Integer> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //如果已经提交就不允许删除 |
| | | List<QualityInspect> qualityInspects = qualityInspectService.listByIds(ids); |
| | |
| | | qualityInspectFileService.remove(Wrappers.<QualityInspectFile>lambdaQuery() |
| | | .in(QualityInspectFile::getInspectId, ids)); |
| | | //删除检验单 |
| | | return AjaxResult.success(qualityInspectService.removeBatchByIds(ids)); |
| | | return R.ok(qualityInspectService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult QualityInspectDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(qualityInspectService.getDetailById(id)); |
| | | public R<?> QualityInspectDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(qualityInspectService.getDetailById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return AjaxResult.success(qualityInspectService.updateQualityInspect(qualityInspectDto)); |
| | | public R<?> update(@RequestBody QualityInspectDto qualityInspectDto) { |
| | | return R.ok(qualityInspectService.updateQualityInspect(qualityInspectDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityInspectListPage(Page page, QualityInspectDto qualityInspect) { |
| | | return AjaxResult.success(qualityInspectService.qualityInspectListPage(page, qualityInspect)); |
| | | public R<?> qualityInspectListPage(Page page, QualityInspectDto qualityInspect) { |
| | | return R.ok(qualityInspectService.qualityInspectListPage(page, qualityInspect)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/submit") |
| | | public AjaxResult submit(@RequestBody QualityInspect qualityInspect) { |
| | | return AjaxResult.success(qualityInspectService.submit(qualityInspect)); |
| | | public R<?> submit(@RequestBody QualityInspect qualityInspect) { |
| | | return R.ok(qualityInspectService.submit(qualityInspect)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityInspectFile qualityInspectFile) { |
| | | return AjaxResult.success(qualityInspectFileService.save(qualityInspectFile)); |
| | | public R<?> add(@RequestBody QualityInspectFile qualityInspectFile) { |
| | | return R.ok(qualityInspectFileService.save(qualityInspectFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验附件 |
| | | return AjaxResult.success(qualityInspectFileService.removeBatchByIds(ids)); |
| | | return R.ok(qualityInspectFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityInspectFileListPage(Page page, QualityInspectFile qualityInspectFile) { |
| | | return AjaxResult.success(qualityInspectFileService.qualityInspectFileListPage(page, qualityInspectFile)); |
| | | public R<?> qualityInspectFileListPage(Page page, QualityInspectFile qualityInspectFile) { |
| | | return R.ok(qualityInspectFileService.qualityInspectFileListPage(page, qualityInspectFile)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import com.ruoyi.quality.pojo.QualityInspectFile; |
| | | import com.ruoyi.quality.pojo.QualityInspectParam; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{inspectId}") |
| | | public AjaxResult QualityInspectParamDetail(@PathVariable("inspectId") Integer inspectId) { |
| | | return AjaxResult.success(qualityInspectParamService.qualityInspectParamDetail(inspectId)); |
| | | public R<?> QualityInspectParamDetail(@PathVariable("inspectId") Integer inspectId) { |
| | | return R.ok(qualityInspectParamService.qualityInspectParamDetail(inspectId)); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody List<QualityInspectParam> qualityInspectParams) { |
| | | return AjaxResult.success(qualityInspectParamService.updateBatchById(qualityInspectParams)); |
| | | public R<?> update(@RequestBody List<QualityInspectParam> qualityInspectParams) { |
| | | return R.ok(qualityInspectParamService.updateBatchById(qualityInspectParams)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(qualityInspectParamService.removeBatchByIds(ids)); |
| | | return R.ok(qualityInspectParamService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.service.QualityReportService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | */ |
| | | @Operation(summary = "获取检验统计数据") |
| | | @GetMapping("/getInspectStatistics") |
| | | public AjaxResult getInspectStatistics() { |
| | | return AjaxResult.success(qualityReportService.getInspectStatistics()); |
| | | public R<?> getInspectStatistics() { |
| | | return R.ok(qualityReportService.getInspectStatistics()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "获取合格率统计数据") |
| | | @GetMapping("/getPassRateStatistics") |
| | | public AjaxResult getPassRateStatistics() { |
| | | return AjaxResult.success(qualityReportService.getPassRateStatistics()); |
| | | public R<?> getPassRateStatistics() { |
| | | return R.ok(qualityReportService.getPassRateStatistics()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "获取月度合格率统计数据") |
| | | @GetMapping("/getMonthlyPassRateStatistics") |
| | | public AjaxResult getMonthlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getMonthlyPassRateStatistics(year)); |
| | | public R<?> getMonthlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return R.ok(qualityReportService.getMonthlyPassRateStatistics(year)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "获取年度总合格率统计数据") |
| | | @GetMapping("/getYearlyPassRateStatistics") |
| | | public AjaxResult getYearlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getYearlyPassRateStatistics(year)); |
| | | public R<?> getYearlyPassRateStatistics(@RequestParam("year") String year) { |
| | | return R.ok(qualityReportService.getYearlyPassRateStatistics(year)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "获取月度完成明细数据") |
| | | @GetMapping("/getMonthlyCompletionDetails") |
| | | public AjaxResult getMonthlyCompletionDetails(@RequestParam("year") String year) { |
| | | return AjaxResult.success(qualityReportService.getMonthlyCompletionDetails(year)); |
| | | public R<?> getMonthlyCompletionDetails(@RequestParam("year") String year) { |
| | | return R.ok(qualityReportService.getMonthlyCompletionDetails(year)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Operation(summary = "获取热点检测指标统计") |
| | | @GetMapping("/getTopParameters") |
| | | public AjaxResult getTopParameters(@RequestParam("modelType") Integer modelType) { |
| | | return AjaxResult.success(qualityReportService.getTopParameters(modelType)); |
| | | public R<?> getTopParameters(@RequestParam("modelType") Integer modelType) { |
| | | return R.ok(qualityReportService.getTopParameters(modelType)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardBinding; |
| | | import com.ruoyi.quality.service.QualityTestStandardBindingService; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody List<QualityTestStandardBinding> qualityTestStandardBindings) { |
| | | return AjaxResult.success(qualityTestStandardBindingService.add(qualityTestStandardBindings)); |
| | | public R<?> add(@RequestBody List<QualityTestStandardBinding> qualityTestStandardBindings) { |
| | | return R.ok(qualityTestStandardBindingService.add(qualityTestStandardBindings)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(qualityTestStandardBindingService.removeBatchByIds(ids)); |
| | | return R.ok(qualityTestStandardBindingService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult listBinding(Long testStandardId) { |
| | | return AjaxResult.success(qualityTestStandardBindingService.listBinding(testStandardId)); |
| | | public R<?> listBinding(Long testStandardId) { |
| | | return R.ok(qualityTestStandardBindingService.listBinding(testStandardId)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.quality.service.IQualityTestStandardService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.save(qualityTestStandard)); |
| | | public R<?> add(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.save(qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(qualityTestStandardService.delQualityTestStandard(ids)); |
| | | return R.ok(qualityTestStandardService.delQualityTestStandard(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.updateById(qualityTestStandard)); |
| | | public R<?> update(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.updateById(qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityTestStandardListPage(Page page, QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.qualityTestStandardListPage(page, qualityTestStandard)); |
| | | public R<?> qualityTestStandardListPage(Page page, QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.qualityTestStandardListPage(page, qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/copyParam") |
| | | public AjaxResult copyParam(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return AjaxResult.success(qualityTestStandardService.copyParam(qualityTestStandard)); |
| | | public R<?> copyParam(@RequestBody QualityTestStandard qualityTestStandard) { |
| | | return R.ok(qualityTestStandardService.copyParam(qualityTestStandard)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/qualityTestStandardAudit") |
| | | public AjaxResult qualityTestStandardAudit(@RequestBody List<QualityTestStandard> qualityTestStandards) { |
| | | return AjaxResult.success(qualityTestStandardService.updateBatchById(qualityTestStandards)); |
| | | public R<?> qualityTestStandardAudit(@RequestBody List<QualityTestStandard> qualityTestStandards) { |
| | | return R.ok(qualityTestStandardService.updateBatchById(qualityTestStandards)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getQualityTestStandardByProductId") |
| | | public AjaxResult getQualityTestStandardByProductId(@Nonnull Long productId, @Nonnull Integer inspectType, String process) { |
| | | return AjaxResult.success(qualityTestStandardService.getQualityTestStandardByProductId(productId,inspectType,process)); |
| | | public R<?> getQualityTestStandardByProductId(@Nonnull Long productId, @Nonnull Integer inspectType, String process) { |
| | | return R.ok(qualityTestStandardService.getQualityTestStandardByProductId(productId,inspectType,process)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getQualityTestStandardParamByTestStandardId") |
| | | public AjaxResult getQualityTestStandardParamByTestStandardId(Long testStandardId) { |
| | | return AjaxResult.success(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId, testStandardId))); |
| | | public R<?> getQualityTestStandardParamByTestStandardId(Long testStandardId) { |
| | | return R.ok(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId, testStandardId))); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityTestStandard; |
| | | import com.ruoyi.quality.pojo.QualityTestStandardParam; |
| | | import com.ruoyi.quality.service.QualityTestStandardParamService; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return AjaxResult.success(qualityTestStandardParamService.save(qualityTestStandardParam)); |
| | | public R<?> add(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return R.ok(qualityTestStandardParamService.save(qualityTestStandardParam)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityTestStandard(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(qualityTestStandardParamService.removeBatchByIds(ids)); |
| | | return R.ok(qualityTestStandardParamService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return AjaxResult.success(qualityTestStandardParamService.updateById(qualityTestStandardParam)); |
| | | public R<?> update(@RequestBody QualityTestStandardParam qualityTestStandardParam) { |
| | | return R.ok(qualityTestStandardParamService.updateById(qualityTestStandardParam)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(Long testStandardId) { |
| | | return AjaxResult.success(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId,testStandardId))); |
| | | public R<?> list(Long testStandardId) { |
| | | return R.ok(qualityTestStandardParamService.list(Wrappers.<QualityTestStandardParam>lambdaQuery().eq(QualityTestStandardParam::getTestStandardId,testStandardId))); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.quality.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.quality.pojo.QualityUnqualified; |
| | | import com.ruoyi.quality.service.IQualityUnqualifiedService; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | public R<?> add(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | qualityUnqualified.setInspectState(0); |
| | | return AjaxResult.success(qualityUnqualifiedService.save(qualityUnqualified)); |
| | | return R.ok(qualityUnqualifiedService.save(qualityUnqualified)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | public R<?> delQualityUnqualified(@RequestBody List<Integer> ids) { |
| | | qualityUnqualifiedService.listByIds(ids).stream().forEach(qualityUnqualified -> { |
| | | if (qualityUnqualified.getInspectState()==1){ |
| | | throw new RuntimeException("该不合格数据已经处理无法删除!"); |
| | | } |
| | | }); |
| | | return AjaxResult.success(qualityUnqualifiedService.removeBatchByIds(ids)); |
| | | return R.ok(qualityUnqualifiedService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult QualityUnqualifiedDetail(@PathVariable("id") Integer id) { |
| | | return AjaxResult.success(qualityUnqualifiedService.getUnqualified(id)); |
| | | public R<?> QualityUnqualifiedDetail(@PathVariable("id") Integer id) { |
| | | return R.ok(qualityUnqualifiedService.getUnqualified(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.updateById(qualityUnqualified)); |
| | | public R<?> update(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return R.ok(qualityUnqualifiedService.updateById(qualityUnqualified)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.qualityUnqualifiedListPage(page, qualityUnqualified)); |
| | | public R<?> qualityUnqualifiedListPage(Page page, QualityUnqualified qualityUnqualified) { |
| | | return R.ok(qualityUnqualifiedService.qualityUnqualifiedListPage(page, qualityUnqualified)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/deal") |
| | | public AjaxResult deal(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return AjaxResult.success(qualityUnqualifiedService.deal(qualityUnqualified)); |
| | | public R<?> deal(@RequestBody QualityUnqualified qualityUnqualified) { |
| | | return R.ok(qualityUnqualifiedService.deal(qualityUnqualified)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.service.ICommonFileService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | |
| | | */ |
| | | @Log(title = "附件删除", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delCommonFile") |
| | | public AjaxResult delCommonFile(@RequestBody Long[] ids) { |
| | | public R<?> delCommonFile(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | return toAjax(commonFileService.delCommonFileByIds(ids)); |
| | | commonFileService.delCommonFileByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | public void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds) throws IOException{ |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationProductDto; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerFileMapper; |
| | |
| | | @RestController |
| | | @RequestMapping("/invoiceLedger") |
| | | @AllArgsConstructor |
| | | public class InvoiceLedgerController { |
| | | public class InvoiceLedgerController extends BaseController { |
| | | |
| | | private InvoiceLedgerService invoiceLedgerService; |
| | | private InvoiceLedgerFileMapper invoiceLedgerFileMapper; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdate") |
| | | public AjaxResult invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) { |
| | | public R<?> invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) { |
| | | invoiceLedgerService.invoiceLedgerSaveOrUpdate(productDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult invoiceLedgerDel(@RequestBody List<Integer> ids) { |
| | | public R<?> invoiceLedgerDel(@RequestBody List<Integer> ids) { |
| | | invoiceLedgerService.invoiceLedgerDel(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/page") |
| | | public AjaxResult invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/fileList") |
| | | public AjaxResult invoiceLedgerFileList(Integer invoiceLedgerId) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId)); |
| | | public R<?> invoiceLedgerFileList(Integer invoiceLedgerId) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/delFile") |
| | | @Log(title = "开票台账", businessType = BusinessType.DELETE) |
| | | public AjaxResult invoiceLedgerDelFile(@RequestBody List<Integer> ids) { |
| | | if(Collections.isEmpty(ids)) return AjaxResult.error("请选择要删除的文件"); |
| | | public R<?> invoiceLedgerDelFile(@RequestBody List<Integer> ids) { |
| | | if(Collections.isEmpty(ids)) return R.fail("请选择要删除的文件"); |
| | | invoiceLedgerFileMapper.deleteBatchIds(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/uploadFile") |
| | | public AjaxResult invoiceLedgerUploadFile(MultipartFile file) { |
| | | public R<?> invoiceLedgerUploadFile(MultipartFile file) { |
| | | try { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerUploadFile(file)); |
| | | return R.ok(invoiceLedgerService.invoiceLedgerUploadFile(file)); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/info") |
| | | public AjaxResult invoiceLedgerInfo(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerDetail(id)); |
| | | public R<?> invoiceLedgerInfo(Integer id) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/commitFile") |
| | | public AjaxResult invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { |
| | | public R<?> invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { |
| | | try { |
| | | invoiceLedgerService.invoiceLedgerCommitFile(invoiceLedgerDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/salesAccount") |
| | | public AjaxResult invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 本月开票金额 |
| | | */ |
| | | @GetMapping("/getInvoiceAmount") |
| | | public AjaxResult getInvoiceAmount() { |
| | | public R<?> getInvoiceAmount() { |
| | | try { |
| | | BigDecimal amount = invoiceLedgerService.getInvoiceAmount(); |
| | | return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO); |
| | | return R.ok(amount != null ? amount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("获取开票金额失败:" + e.getMessage()); |
| | | return R.fail("获取开票金额失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/registrationProductPage") |
| | | public AjaxResult registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) { |
| | | public R<?> registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) { |
| | | |
| | | return AjaxResult.success(invoiceLedgerService.registrationProductPage(page,registrationProductDto)); |
| | | return R.ok(invoiceLedgerService.registrationProductPage(page,registrationProductDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/invoiceLedgerProductInfo") |
| | | public AjaxResult invoiceLedgerProductDetail(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerProductDetail(id)); |
| | | public R<?> invoiceLedgerProductDetail(Integer id) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerProductDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("delInvoiceLedger/{invoiceRegistrationProductId}") |
| | | public AjaxResult delInvoiceLedger(@PathVariable Integer invoiceRegistrationProductId) { |
| | | public R<?> delInvoiceLedger(@PathVariable Integer invoiceRegistrationProductId) { |
| | | try { |
| | | invoiceLedgerService.delInvoiceLedger(invoiceRegistrationProductId); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationDto; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationProductDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | @RestController |
| | | @RequestMapping("/invoiceRegistration") |
| | | @AllArgsConstructor |
| | | public class InvoiceRegistrationController { |
| | | public class InvoiceRegistrationController extends BaseController { |
| | | |
| | | private InvoiceRegistrationService invoiceRegistrationService; |
| | | |
| | |
| | | @PostMapping("/save") |
| | | @Log(title = "开票登记", businessType = com.ruoyi.framework.aspectj.lang.enums.BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult invoiceRegistrationSave(@RequestBody List<SalesLedgerDto> salesLedgerDto) { |
| | | if(Collections.isEmpty(salesLedgerDto)) return AjaxResult.error("请选择要保存的记录"); |
| | | public R<?> invoiceRegistrationSave(@RequestBody List<SalesLedgerDto> salesLedgerDto) { |
| | | if(Collections.isEmpty(salesLedgerDto)) return R.fail("请选择要保存的记录"); |
| | | salesLedgerDto.forEach(item ->{ |
| | | invoiceRegistrationService.invoiceRegistrationSave(item); |
| | | }); |
| | | |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult invoiceRegistrationDel(@RequestBody List<Integer> ids) { |
| | | public R<?> invoiceRegistrationDel(@RequestBody List<Integer> ids) { |
| | | invoiceRegistrationService.invoiceRegistrationDel(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult invoiceRegistrationUpdate(@RequestBody InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | public R<?> invoiceRegistrationUpdate(@RequestBody InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | invoiceRegistrationService.invoiceRegistrationUpdate(invoiceRegistrationDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult invoiceRegistrationListPage(Page page, InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationListPage(page, invoiceRegistrationDto)); |
| | | public R<?> invoiceRegistrationListPage(Page page, InvoiceRegistrationDto invoiceRegistrationDto) { |
| | | return R.ok(invoiceRegistrationService.invoiceRegistrationListPage(page, invoiceRegistrationDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/productList") |
| | | public AjaxResult invoiceRegistrationProductList(InvoiceRegistrationProductDto invoiceRegistrationProductDto) { |
| | | return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationProductList(invoiceRegistrationProductDto)); |
| | | public R<?> invoiceRegistrationProductList(InvoiceRegistrationProductDto invoiceRegistrationProductDto) { |
| | | return R.ok(invoiceRegistrationService.invoiceRegistrationProductList(invoiceRegistrationProductDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/detail") |
| | | public AjaxResult invoiceRegistrationDetail(Integer id) { |
| | | return AjaxResult.success(invoiceRegistrationService.invoiceRegistrationDetail(id)); |
| | | public R<?> invoiceRegistrationDetail(Integer id) { |
| | | return R.ok(invoiceRegistrationService.invoiceRegistrationDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.StatisticsTableDto; |
| | | import com.ruoyi.sales.service.impl.MetricStatisticsServiceImpl; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @Operation(summary = "头部总计") |
| | | @GetMapping("/total") |
| | | public AjaxResult total() { |
| | | public R<?> total() { |
| | | return metricStatisticsService.total(); |
| | | } |
| | | |
| | | @Operation(summary = "统计表") |
| | | @GetMapping("/statisticsTable") |
| | | public AjaxResult statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | public R<?> statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | return metricStatisticsService.statisticsTable(statisticsTableDto); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.mapper.PaymentShippingMapper; |
| | | import com.ruoyi.sales.pojo.PaymentShipping; |
| | | import com.ruoyi.sales.service.PaymentShippingService; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询支付与发货信息") |
| | | public AjaxResult listPage(Page page, PaymentShipping paymentShipping) { |
| | | public R<?> listPage(Page page, PaymentShipping paymentShipping) { |
| | | IPage<PaymentShipping> listPage = paymentShippingService.listPage(page, paymentShipping); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "添加支付与发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody PaymentShipping paymentShipping) { |
| | | public R<?> add(@RequestBody PaymentShipping paymentShipping) { |
| | | String ord = OrderUtils.countTodayByCreateTime(paymentShippingMapper, "ORD","order_no"); |
| | | paymentShipping.setOrderNo(ord); |
| | | boolean save = paymentShippingService.save(paymentShipping); |
| | | return save ? success() : error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改支付与发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody PaymentShipping paymentShipping) { |
| | | public R<?> update(@RequestBody PaymentShipping paymentShipping) { |
| | | boolean update = paymentShippingService.updateById(paymentShipping); |
| | | return update ? success() : error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除支付与发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if (CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | return AjaxResult.success(paymentShippingService.removeByIds(ids)); |
| | | return R.ok(paymentShippingService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.ReceiptPaymentDto; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdate") |
| | | public AjaxResult receiptPaymentSaveOrUpdate (@RequestBody List<ReceiptPayment> receiptPayment) { |
| | | public R<?> receiptPaymentSaveOrUpdate (@RequestBody List<ReceiptPayment> receiptPayment) { |
| | | receiptPaymentService.receiptPaymentSaveOrUpdate(receiptPayment); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult receiptPaymentUpdate (@RequestBody ReceiptPayment receiptPayment) { |
| | | return AjaxResult.success(receiptPaymentService.receiptPaymentUpdate(receiptPayment)); |
| | | public R<?> receiptPaymentUpdate (@RequestBody ReceiptPayment receiptPayment) { |
| | | return R.ok(receiptPaymentService.receiptPaymentUpdate(receiptPayment)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult receiptPaymentDel (@RequestBody List<Integer> ids) { |
| | | return AjaxResult.success(receiptPaymentService.receiptPaymentDel(ids)); |
| | | public R<?> receiptPaymentDel (@RequestBody List<Integer> ids) { |
| | | return R.ok(receiptPaymentService.receiptPaymentDel(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/customerInteractions") |
| | | public AjaxResult customerInteractions (InvoiceLedgerDto receiptPaymentDto) { |
| | | return AjaxResult.success(receiptPaymentService.customerInteractions(receiptPaymentDto)); |
| | | public R<?> customerInteractions (InvoiceLedgerDto receiptPaymentDto) { |
| | | return R.ok(receiptPaymentService.customerInteractions(receiptPaymentDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/info") |
| | | public AjaxResult receiptPaymentInfo (Integer id) { |
| | | return AjaxResult.success(receiptPaymentService.receiptPaymentInfo(id)); |
| | | public R<?> receiptPaymentInfo (Integer id) { |
| | | return R.ok(receiptPaymentService.receiptPaymentInfo(id)); |
| | | } |
| | | |
| | | /** |
| | | * 本月回款金额 |
| | | */ |
| | | @GetMapping("/getReceiptAmount") |
| | | public AjaxResult getReceiptAmount() { |
| | | public R<?> getReceiptAmount() { |
| | | try { |
| | | BigDecimal receiptAmount = receiptPaymentService.getReceiptAmount(); |
| | | return AjaxResult.success(receiptAmount != null ? receiptAmount : BigDecimal.ZERO); |
| | | return R.ok(receiptAmount != null ? receiptAmount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("获取回款金额失败:" + e.getMessage()); |
| | | return R.fail("获取回款金额失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/bindInvoiceNoRegPage") |
| | | public AjaxResult bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) { |
| | | return AjaxResult.success(receiptPaymentService.bindInvoiceNoRegPage(page,receiptPaymentDto)); |
| | | public R<?> bindInvoiceNoRegPage(Page page, ReceiptPaymentDto receiptPaymentDto) { |
| | | return R.ok(receiptPaymentService.bindInvoiceNoRegPage(page,receiptPaymentDto)); |
| | | } |
| | | |
| | | @Schema(description = "导出回款登记") |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/invoiceInfo") |
| | | public AjaxResult invoiceInfo (Integer id) { |
| | | return AjaxResult.success(receiptPaymentService.invoiceInfo(id)); |
| | | public R<?> invoiceInfo (Integer id) { |
| | | return R.ok(receiptPaymentService.invoiceInfo(id)); |
| | | } |
| | | |
| | | /** |
| | | * 本月应收,回款金额 |
| | | */ |
| | | @GetMapping("/getAmountMouth") |
| | | public AjaxResult getAmountMouth() { |
| | | return AjaxResult.success(receiptPaymentService.getAmountMouth()); |
| | | public R<?> getAmountMouth() { |
| | | return R.ok(receiptPaymentService.getAmountMouth()); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | |
| | | @Log(title = "导入销售台账", businessType = BusinessType.INSERT) |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入销售台账") |
| | | public AjaxResult importData(@RequestParam("file") |
| | | public R<?> importData(@RequestParam("file") |
| | | @ApiParam(value = "Excel文件", required = true) |
| | | MultipartFile file) { |
| | | return salesLedgerService.importData(file); |
| | |
| | | */ |
| | | @Log(title = "销售台账", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrUpdateSalesLedger") |
| | | public AjaxResult add(@RequestBody SalesLedgerDto salesLedgerDto) { |
| | | return toAjax(salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto)); |
| | | public R<?> add(@RequestBody SalesLedgerDto salesLedgerDto) { |
| | | salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "销售台账", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delLedger") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | return toAjax(salesLedgerService.deleteSalesLedgerByIds(ids)); |
| | | salesLedgerService.deleteSalesLedgerByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listNoPage") |
| | | public AjaxResult listNoPage(SalesLedgerDto salesLedgerDto) { |
| | | public R<?> listNoPage(SalesLedgerDto salesLedgerDto) { |
| | | List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "销售台账附件删除", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delLedgerFile") |
| | | public AjaxResult delLedgerFile(@RequestBody Long[] ids) { |
| | | public R<?> delLedgerFile(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | return toAjax(commonFileService.deleteSalesLedgerByIds(ids)); |
| | | commonFileService.deleteSalesLedgerByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 本月销售合同金额 |
| | | */ |
| | | @GetMapping("/getContractAmount") |
| | | public AjaxResult getContractAmount() { |
| | | public R<?> getContractAmount() { |
| | | try { |
| | | BigDecimal contractAmount = salesLedgerService.getContractAmount(); |
| | | return AjaxResult.success(contractAmount != null ? contractAmount : BigDecimal.ZERO); |
| | | return R.ok(contractAmount != null ? contractAmount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("获取合同金额失败:" + e.getMessage()); |
| | | return R.fail("获取合同金额失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * 客户合同金额TOP5统计 |
| | | */ |
| | | @GetMapping("/getTopFiveList") |
| | | public AjaxResult getTopFiveList() { |
| | | return AjaxResult.success(salesLedgerService.getTopFiveList()); |
| | | public R<?> getTopFiveList() { |
| | | return R.ok(salesLedgerService.getTopFiveList()); |
| | | } |
| | | |
| | | /** |
| | | * 近半年开票,回款金额 |
| | | */ |
| | | @GetMapping("/getAmountHalfYear") |
| | | public AjaxResult getAmountHalfYear(@RequestParam(value = "type",defaultValue = "1") Integer type) { |
| | | return AjaxResult.success(salesLedgerService.getAmountHalfYear(type)); |
| | | public R<?> getAmountHalfYear(@RequestParam(value = "type",defaultValue = "1") Integer type) { |
| | | return R.ok(salesLedgerService.getAmountHalfYear(type)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | |
| | | * 回款登记分页查询 |
| | | */ |
| | | @GetMapping("/listPageSalesLedger") |
| | | public AjaxResult listPage(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | public R<?> listPageSalesLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPage(page,salesLedgerProduct); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | |
| | | * 付款登记分页查询 |
| | | */ |
| | | @GetMapping("/listPagePurchaseLedger") |
| | | public AjaxResult listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | public R<?> listPagePurchaseLedger(Page page, SalesLedgerProductDto salesLedgerProduct) { |
| | | IPage<SalesLedgerProductDto> list = salesLedgerProductService.listPagePurchaseLedger(page,salesLedgerProduct); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | |
| | | * 查询产品信息列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(SalesLedgerProduct salesLedgerProduct) { |
| | | public R<?> list(SalesLedgerProduct salesLedgerProduct) { |
| | | List<SalesLedgerProduct> list = salesLedgerProductService.selectSalesLedgerProductList(salesLedgerProduct); |
| | | if (CollUtil.isEmpty(list)) { |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | List<Long> productIds = list.stream().map(SalesLedgerProduct::getProductModelId).collect(Collectors.toList()); |
| | | List<SimpleReturnOrderGroupDto> groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds); |
| | |
| | | item.setReturnQuality(returnQuality); |
| | | item.setAvailableQuality(item.getQuantity().subtract(returnQuality)); |
| | | }); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 获取产品信息详细信息 |
| | | */ |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | public R<?> getInfo(@PathVariable("id") Long id) |
| | | { |
| | | return success(salesLedgerProductService.selectSalesLedgerProductById(id)); |
| | | return R.ok(salesLedgerProductService.selectSalesLedgerProductById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产品信息", businessType = BusinessType.INSERT) |
| | | @PostMapping ("/addOrUpdateSalesLedgerProduct") |
| | | public AjaxResult add(@RequestBody SalesLedgerProduct salesLedgerProduct) |
| | | public R<?> add(@RequestBody SalesLedgerProduct salesLedgerProduct) |
| | | { |
| | | return toAjax(salesLedgerProductService.addOrUpdateSalesLedgerProduct(salesLedgerProduct)); |
| | | salesLedgerProductService.addOrUpdateSalesLedgerProduct(salesLedgerProduct); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Log(title = "产品信息", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delProduct") |
| | | public AjaxResult remove(@RequestBody Long[] ids) |
| | | public R<?> remove(@RequestBody Long[] ids) |
| | | { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | return toAjax(salesLedgerProductService.deleteSalesLedgerProductByIds(ids)); |
| | | salesLedgerProductService.deleteSalesLedgerProductByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | //根据产品id获取bom判断库存是否充足 |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.SalesQuotationDto; |
| | | import com.ruoyi.sales.service.SalesQuotationService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @RestController |
| | | @RequestMapping("/sales/quotation") |
| | | @AllArgsConstructor |
| | | public class SalesQuotationController { |
| | | public class SalesQuotationController extends BaseController { |
| | | private final SalesQuotationService salesQuotationService; |
| | | @GetMapping("/list") |
| | | public AjaxResult getList(Page page, SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.listPage(page, salesQuotationDto)); |
| | | public R<?> getList(Page page, SalesQuotationDto salesQuotationDto) { |
| | | return R.ok(salesQuotationService.listPage(page, salesQuotationDto)); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.add(salesQuotationDto)); |
| | | public R<?> add(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return R.ok(salesQuotationService.add(salesQuotationDto)); |
| | | } |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.edit(salesQuotationDto)); |
| | | public R<?> update(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return R.ok(salesQuotationService.edit(salesQuotationDto)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody Long id) { |
| | | return AjaxResult.success(salesQuotationService.delete(id)); |
| | | public R<?> delete(@RequestBody Long id) { |
| | | return R.ok(salesQuotationService.delete(id)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.pojo.SalespersonManagement; |
| | | import com.ruoyi.sales.service.SalespersonManagementService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询业务员信息") |
| | | public AjaxResult listPage(Page page, SalespersonManagement salespersonManagement) { |
| | | public R<?> listPage(Page page, SalespersonManagement salespersonManagement) { |
| | | IPage<SalespersonManagement> listPage = salespersonManagementService.listPage(page, salespersonManagement); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "添加业务员信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody SalespersonManagement salespersonManagement) { |
| | | public R<?> add(@RequestBody SalespersonManagement salespersonManagement) { |
| | | boolean save = salespersonManagementService.save(salespersonManagement); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改业务员信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody SalespersonManagement salespersonManagement) { |
| | | public R<?> update(@RequestBody SalespersonManagement salespersonManagement) { |
| | | boolean update = salespersonManagementService.updateById(salespersonManagement); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除业务员信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | boolean delete = salespersonManagementService.removeByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "发货信息列表") |
| | | public AjaxResult listPage(Page page, ShippingInfo req) { |
| | | public R<?> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoService.listPage(page,req); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "添加发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody ShippingInfoDto req) throws Exception { |
| | | public R<?> add(@RequestBody ShippingInfoDto req) throws Exception { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shipping_no"); |
| | | // 发货审批 |
| | |
| | | req.setShippingNo(sh); |
| | | req.setStatus("待审核"); |
| | | boolean save = shippingInfoService.add(req); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @Operation(summary = "发货扣库存") |
| | | @PostMapping("/deductStock") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.UPDATE) |
| | | public AjaxResult deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | return shippingInfoService.deductStock( req) ? AjaxResult.success() : AjaxResult.error(); |
| | | public R<?> deductStock(@RequestBody ShippingInfoDto req) throws IOException { |
| | | return shippingInfoService.deductStock( req) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "修改发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody ShippingInfo req) { |
| | | public R<?> update(@RequestBody ShippingInfo req) { |
| | | ShippingInfo byId = shippingInfoService.getById(req.getId()); |
| | | if (byId == null) { |
| | | return AjaxResult.error("发货信息不存在"); |
| | | return R.fail("发货信息不存在"); |
| | | } |
| | | boolean update = shippingInfoService.updateById(req); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除发货信息") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "发货信息管理", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | |
| | | return shippingInfoService.delete(ids) ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败"); |
| | | return shippingInfoService.delete(ids) ? R.ok("删除成功") : R.fail("删除失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/getByCustomerName") |
| | | @Operation(summary = "通过客户名称查询关联的发货单号") |
| | | public AjaxResult getByCustomerName(String customerName) { |
| | | return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | public R<?> getByCustomerName(String customerName) { |
| | | return R.ok(shippingInfoService.getShippingInfoByCustomerName(customerName)); |
| | | } |
| | | |
| | | @GetMapping("/getDateil/{id}") |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesService; |
| | | import com.ruoyi.common.enums.SaleEnum; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | |
| | | IPage<SalesLedgerVo> selectSalesLedgerListPage(Page page, SalesLedgerDto salesLedgerDto); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R<?> importData(MultipartFile file); |
| | | |
| | | List<LossProductModelDto> getSalesLedgerWithProductsLoss(Long salesLedgerId); |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.SalesTrendDto; |
| | | import com.ruoyi.sales.dto.StatisticsTableDto; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | |
| | | public AjaxResult total() { |
| | | public R<?> total() { |
| | | List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(null); |
| | | if(CollectionUtils.isEmpty(salesLedgers)) return AjaxResult.success(salesLedgers); |
| | | if(CollectionUtils.isEmpty(salesLedgers)) return R.ok(salesLedgers); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // 销售额 |
| | | map.put("contractAmountTotal", salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | |
| | | List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(new LambdaQueryWrapper<SalesLedgerProduct>() |
| | | .eq(SalesLedgerProduct::getType, 1)); |
| | | map.put("shipRate", "0%"); |
| | | if(CollectionUtils.isEmpty(salesLedgerProducts)) return AjaxResult.success(map); |
| | | if(CollectionUtils.isEmpty(salesLedgerProducts)) return R.ok(map); |
| | | // 发货数量 |
| | | long count = shippingInfoMapper.selectCount(new LambdaQueryWrapper<ShippingInfo>() |
| | | .in(ShippingInfo::getSalesLedgerProductId, salesLedgerProducts.stream().map(SalesLedgerProduct::getId).collect(Collectors.toList())) |
| | | .eq(ShippingInfo::getStatus,"已发货")); |
| | | map.put("shipRate", String.format("%.2f", count * 100.0 / salesLedgerProducts.size()) + "%"); |
| | | return AjaxResult.success(map); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | public AjaxResult statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | public R<?> statisticsTable(StatisticsTableDto statisticsTableDto) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | |
| | |
| | | map.put("orderCountList", orderCountList); |
| | | map.put("salesAmountList", salesAmountList); |
| | | map.put("shippingRateList", shippingRateList); |
| | | return AjaxResult.success(map); |
| | | return R.ok(map); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.mapper.ProductionProductInputMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductMainMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductOutputMapper; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | |
| | | import com.ruoyi.sales.vo.SalesLedgerVo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.jetbrains.annotations.Nullable; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R<?> importData(MultipartFile file) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | ExcelUtil<SalesLedgerImportDto> salesLedgerImportDtoExcelUtil = new ExcelUtil<>(SalesLedgerImportDto.class); |
| | | Map<String, List<SalesLedgerImportDto>> stringListMap = salesLedgerImportDtoExcelUtil.importExcelMultiSheet(Arrays.asList("销售台账数据", "销售产品数据"), inputStream, 0); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return AjaxResult.error("销售表格为空!"); |
| | | if (CollectionUtils.isEmpty(stringListMap)) return R.fail("销售表格为空!"); |
| | | // 业务层合并 |
| | | List<SalesLedgerImportDto> salesLedgerImportDtoList = stringListMap.get("销售台账数据"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return AjaxResult.error("销售台账数据为空!"); |
| | | if (CollectionUtils.isEmpty(salesLedgerImportDtoList)) return R.fail("销售台账数据为空!"); |
| | | List<SalesLedgerImportDto> salesLedgerProductImportDtoList = stringListMap.get("销售产品数据"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return AjaxResult.error("销售产品数据为空!"); |
| | | if (CollectionUtils.isEmpty(salesLedgerProductImportDtoList)) return R.fail("销售产品数据为空!"); |
| | | // 客户数据 - 参考 listPage 查询私海客户(type = 0) |
| | | // type = 0(私海客户)或者 type = 1(公海客户)且已被分配,并且是自己领用、自己创建或者共享给自己的客户 |
| | | Long loginUserId = loginUser.getUser().getUserId(); |
| | |
| | | } |
| | | } |
| | | |
| | | return AjaxResult.success("导入成功"); |
| | | return R.ok(null, "导入成功"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("导入失败:" + e.getMessage()); |
| | | return R.fail("导入失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.service.AnalyticsService; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | |
| | | @RestController |
| | | @RequestMapping("/staff/analytics") |
| | | public class AnalyticsController { |
| | | public class AnalyticsController extends BaseController { |
| | | |
| | | @Resource |
| | | private AnalyticsService analyticsService; |
| | | |
| | | @GetMapping("/reason") |
| | | public AjaxResult staffLeaveReasonAnalytics() { |
| | | return AjaxResult.success(analyticsService.staffLeaveReasonAnalytics()); |
| | | public R<?> staffLeaveReasonAnalytics() { |
| | | return R.ok(analyticsService.staffLeaveReasonAnalytics()); |
| | | } |
| | | |
| | | @GetMapping("/monthly_turnover_rate") |
| | | public AjaxResult getMonthlyTurnoverRateFor12Months() { |
| | | return AjaxResult.success(analyticsService.getMonthlyTurnoverRateFor12Months()); |
| | | public R<?> getMonthlyTurnoverRateFor12Months() { |
| | | return R.ok(analyticsService.getMonthlyTurnoverRateFor12Months()); |
| | | } |
| | | |
| | | @GetMapping("/total_statistic") |
| | | public AjaxResult getTotalStatistic() { |
| | | return AjaxResult.success(analyticsService.getTotalStatistic()); |
| | | public R<?> getTotalStatistic() { |
| | | return R.ok(analyticsService.getTotalStatistic()); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.Bank; |
| | | import com.ruoyi.staff.service.BankService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RestController |
| | | @RequestMapping("/bank") |
| | | @AllArgsConstructor |
| | | public class BankController { |
| | | public class BankController extends BaseController { |
| | | |
| | | private BankService bankService; |
| | | |
| | | @GetMapping("/list") |
| | | public AjaxResult list() { |
| | | return AjaxResult.success(bankService.list()); |
| | | public R<?> list() { |
| | | return R.ok(bankService.list()); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "新增银行管理表") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "银行管理表", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody Bank bank) { |
| | | return AjaxResult.success(bankService.save(bank)); |
| | | public R<?> add(@RequestBody Bank bank) { |
| | | return R.ok(bankService.save(bank)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "更新银行管理表") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "银行管理表", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody Bank bank) { |
| | | return AjaxResult.success(bankService.updateById(bank)); |
| | | public R<?> update(@RequestBody Bank bank) { |
| | | return R.ok(bankService.updateById(bank)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除银行管理表") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "银行管理表", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | return AjaxResult.success(bankService.removeBatchByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return R.ok(bankService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.HolidayApplication; |
| | | import com.ruoyi.staff.service.HolidayApplicationService; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/holidayApplication") |
| | | @AllArgsConstructor |
| | | public class HolidayApplicationController { |
| | | public class HolidayApplicationController extends BaseController { |
| | | |
| | | private HolidayApplicationService holidayApplicationService; |
| | | /** |
| | | * 请假申请分页查询 |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, HolidayApplication holidayApplication){ |
| | | return AjaxResult.success(holidayApplicationService.listPage(page, holidayApplication)); |
| | | public R<?> listPage(Page page, HolidayApplication holidayApplication){ |
| | | return R.ok(holidayApplicationService.listPage(page, holidayApplication)); |
| | | } |
| | | /** |
| | | * 新增请假申请 |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody HolidayApplication holidayApplication){ |
| | | return AjaxResult.success(holidayApplicationService.save(holidayApplication)); |
| | | public R<?> add(@RequestBody HolidayApplication holidayApplication){ |
| | | return R.ok(holidayApplicationService.save(holidayApplication)); |
| | | } |
| | | /** |
| | | * 修改请假申请 |
| | | */ |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody HolidayApplication holidayApplication){ |
| | | return AjaxResult.success(holidayApplicationService.updateById(holidayApplication)); |
| | | public R<?> update(@RequestBody HolidayApplication holidayApplication){ |
| | | return R.ok(holidayApplicationService.updateById(holidayApplication)); |
| | | } |
| | | /** |
| | | * 删除请假申请 |
| | | */ |
| | | @DeleteMapping("/delete/{id}") |
| | | public AjaxResult delete(@PathVariable("id") Long id){ |
| | | return AjaxResult.success(holidayApplicationService.removeById(id)); |
| | | public R<?> delete(@PathVariable("id") Long id){ |
| | | return R.ok(holidayApplicationService.removeById(id)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.PersonalAttendanceRecordsDto; |
| | | import com.ruoyi.staff.pojo.PersonalAttendanceRecords; |
| | | import com.ruoyi.staff.service.PersonalAttendanceRecordsService; |
| | |
| | | @RestController |
| | | @RequestMapping("/personalAttendanceRecords") |
| | | @Tag(name = "人员打卡签到") |
| | | public class PersonalAttendanceRecordsController { |
| | | public class PersonalAttendanceRecordsController extends BaseController { |
| | | @Resource |
| | | private PersonalAttendanceRecordsService personalAttendanceRecordsService; |
| | | |
| | | @Operation(summary = "新增打卡签到") |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return AjaxResult.success(personalAttendanceRecordsService.add(personalAttendanceRecordsDto)); |
| | | public R<?> add(@RequestBody PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return R.ok(personalAttendanceRecordsService.add(personalAttendanceRecordsDto)); |
| | | } |
| | | |
| | | @Operation(summary = "分页查询打卡签到") |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return AjaxResult.success(personalAttendanceRecordsService.listPage(page, personalAttendanceRecordsDto)); |
| | | public R<?> listPage(Page page, PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return R.ok(personalAttendanceRecordsService.listPage(page, personalAttendanceRecordsDto)); |
| | | } |
| | | |
| | | @Operation(summary = "获取当前人的考勤相关数据") |
| | | @GetMapping("/today") |
| | | public AjaxResult todayInfo(PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return AjaxResult.success(personalAttendanceRecordsService.todayInfo(personalAttendanceRecordsDto)); |
| | | public R<?> todayInfo(PersonalAttendanceRecordsDto personalAttendanceRecordsDto){ |
| | | return R.ok(personalAttendanceRecordsService.todayInfo(personalAttendanceRecordsDto)); |
| | | } |
| | | |
| | | @Operation(summary = "导出打卡签到") |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.SchemeApplicableStaff; |
| | | import com.ruoyi.staff.service.SchemeApplicableStaffService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "分页查询") |
| | | public AjaxResult listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | return schemeApplicableStaffService.listPage(page,schemeApplicableStaff); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "社保方案适用人员表", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> add(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | return schemeApplicableStaffService.add(schemeApplicableStaff); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "社保方案适用人员表", businessType = BusinessType.UPDATE) |
| | | public AjaxResult updateSchemeApplicableStaff(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> updateSchemeApplicableStaff(@RequestBody SchemeApplicableStaff schemeApplicableStaff) { |
| | | return schemeApplicableStaffService.updateSchemeApplicableStaff(schemeApplicableStaff); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Log(title = "社保方案适用人员表", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return schemeApplicableStaffService.delete(ids); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | | import com.ruoyi.staff.service.StaffContractService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffContract") |
| | | @Tag(name = "员工台账/合同管理") |
| | | public class StaffContractController { |
| | | public class StaffContractController extends BaseController { |
| | | |
| | | @Resource |
| | | private StaffContractService staffContractService; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffContractListPage(Page page, StaffContract staffContract) { |
| | | return AjaxResult.success(staffContractService.staffContractListPage(page, staffContract)); |
| | | public R<?> staffContractListPage(Page page, StaffContract staffContract) { |
| | | return R.ok(staffContractService.staffContractListPage(page, staffContract)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.staff.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.StaffLeaveDto; |
| | | import com.ruoyi.staff.service.StaffLeaveService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffLeave") |
| | | @Tag(name = "员工离职") |
| | | public class StaffLeaveController { |
| | | public class StaffLeaveController extends BaseController { |
| | | @Resource |
| | | private StaffLeaveService staffLeaveService; |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffLeaveListPage(Page page, StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.staffLeaveListPage(page, staffLeaveDto)); |
| | | public R<?> staffLeaveListPage(Page page, StaffLeaveDto staffLeaveDto) { |
| | | return R.ok(staffLeaveService.staffLeaveListPage(page, staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.add(staffLeaveDto)); |
| | | public R<?> add(@RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return R.ok(staffLeaveService.add(staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping("/{id}") |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return AjaxResult.success(staffLeaveService.update(id, staffLeaveDto)); |
| | | public R<?> update(@PathVariable("id") Long id, @RequestBody StaffLeaveDto staffLeaveDto) { |
| | | return R.ok(staffLeaveService.update(id, staffLeaveDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult del(@RequestBody List<Integer> ids) { |
| | | public R<?> del(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(staffLeaveService.del(ids)); |
| | | return R.ok(staffLeaveService.del(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.StaffOnJobDto; |
| | | import com.ruoyi.staff.dto.StaffOnJobExcelDto; |
| | | import com.ruoyi.staff.pojo.StaffContract; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffOnJob") |
| | | @Tag(name = "员工台账") |
| | | public class StaffOnJobController { |
| | | public class StaffOnJobController extends BaseController { |
| | | |
| | | @Resource |
| | | private IStaffOnJobService staffOnJobService; |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult staffOnJobListPage(Page page, StaffOnJob staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobListPage(page, staffOnJob)); |
| | | public R<?> staffOnJobListPage(Page page, StaffOnJob staffOnJob) { |
| | | return R.ok(staffOnJobService.staffOnJobListPage(page, staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult staffOnJobList(StaffOnJob staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobList(staffOnJob)); |
| | | public R<?> staffOnJobList(StaffOnJob staffOnJob) { |
| | | return R.ok(staffOnJobService.staffOnJobList(staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("") |
| | | public AjaxResult add(@RequestBody StaffOnJobDto staffOnJob) { |
| | | return AjaxResult.success(staffOnJobService.add(staffOnJob)); |
| | | public R<?> add(@RequestBody StaffOnJobDto staffOnJob) { |
| | | return R.ok(staffOnJobService.add(staffOnJob)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping("/{id}") |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StaffOnJobDto staffOnJobDto) { |
| | | return AjaxResult.success(staffOnJobService.update(id, staffOnJobDto)); |
| | | public R<?> update(@PathVariable("id") Long id, @RequestBody StaffOnJobDto staffOnJobDto) { |
| | | return R.ok(staffOnJobService.update(id, staffOnJobDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delStaffOnJobs(@RequestBody List<Integer> ids) { |
| | | public R<?> delStaffOnJobs(@RequestBody List<Integer> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(staffOnJobService.delStaffOnJobs(ids)); |
| | | return R.ok(staffOnJobService.delStaffOnJobs(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | public AjaxResult staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(staffOnJobService.staffOnJobDetail(id)); |
| | | public R<?> staffOnJobDetail(@PathVariable("id") Long id) { |
| | | return R.ok(staffOnJobService.staffOnJobDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/renewContract/{id}") |
| | | public AjaxResult renewContract(@PathVariable Long id, @RequestBody StaffContract staffContract) { |
| | | return AjaxResult.success(staffOnJobService.renewContract(id, staffContract)); |
| | | public R<?> renewContract(@PathVariable Long id, @RequestBody StaffContract staffContract) { |
| | | return R.ok(staffOnJobService.renewContract(id, staffContract)); |
| | | } |
| | | |
| | | @Operation(summary = "下载模板") |
| | |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "在职员工导入", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importData(@RequestPart("file") MultipartFile file) { |
| | | public R<?> importData(@RequestPart("file") MultipartFile file) { |
| | | Boolean b = staffOnJobService.importData(file); |
| | | if (b) { |
| | | return AjaxResult.success("导入成功"); |
| | | return R.ok(null, "导入成功"); |
| | | } |
| | | return AjaxResult.error("导入失败"); |
| | | return R.fail("导入失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/exportCopy") |
| | | @Operation(summary = "word模板合同在职员工导出") |
| | | public AjaxResult exportCopy(HttpServletResponse response,@RequestBody StaffOnJob staffOnJob) throws Exception{ |
| | | return AjaxResult.success(staffOnJobService.exportCopy(response, staffOnJob)); |
| | | public R<?> exportCopy(HttpServletResponse response,@RequestBody StaffOnJob staffOnJob) throws Exception{ |
| | | return R.ok(staffOnJobService.exportCopy(response, staffOnJob)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.CalculateSalaryDto; |
| | | import com.ruoyi.staff.pojo.StaffSalaryMain; |
| | | import com.ruoyi.staff.service.StaffSalaryMainService; |
| | |
| | | @RestController |
| | | @RequestMapping("/staffSalaryMain") |
| | | @AllArgsConstructor |
| | | public class StaffSalaryMainController { |
| | | public class StaffSalaryMainController extends BaseController { |
| | | |
| | | private StaffSalaryMainService staffSalaryMainService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "员工工资主表分页查询") |
| | | public AjaxResult listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | public R<?> listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | return staffSalaryMainService.listPage(page, staffSalaryMain); |
| | | } |
| | | |
| | | @Operation(summary = "通过部门ids获取用户信息计算每个员工的工资") |
| | | @PostMapping("/calculateSalary") |
| | | public AjaxResult calculateSalary(@RequestBody CalculateSalaryDto calculateSalaryDto) { |
| | | public R<?> calculateSalary(@RequestBody CalculateSalaryDto calculateSalaryDto) { |
| | | return staffSalaryMainService.calculateSalary(calculateSalaryDto); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "新建工资表") |
| | | @Log(title = "新建工资表", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | public R<?> add(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | return staffSalaryMainService.add(staffSalaryMain); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "修改工资表") |
| | | @Log(title = "修改工资表", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult updateStaffSalaryMain(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | public R<?> updateStaffSalaryMain(@RequestBody StaffSalaryMain staffSalaryMain) { |
| | | return staffSalaryMainService.updateStaffSalaryMain(staffSalaryMain); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "删除工资表") |
| | | @Log(title = "删除工资表", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | return staffSalaryMainService.delete(ids); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.compensationperformance.pojo.CompensationPerformance; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.SaveStaffSchedulingDto; |
| | | import com.ruoyi.staff.dto.StaffSchedulingDto; |
| | | import com.ruoyi.staff.service.StaffSchedulingService; |
| | |
| | | @RestController |
| | | @RequestMapping("/staff/staffScheduling") |
| | | @RequiredArgsConstructor |
| | | public class StaffSchedulingController { |
| | | public class StaffSchedulingController extends BaseController { |
| | | |
| | | private final StaffSchedulingService staffSchedulingService; |
| | | |
| | | @PostMapping("/listPage") |
| | | public AjaxResult listPage(@RequestBody SearchSchedulingVo vo){ |
| | | return AjaxResult.success(staffSchedulingService.listPage(vo)); |
| | | public R<?> listPage(@RequestBody SearchSchedulingVo vo){ |
| | | return R.ok(staffSchedulingService.listPage(vo)); |
| | | } |
| | | |
| | | @PostMapping("/save") |
| | | public AjaxResult save(@RequestBody @Validated SaveStaffSchedulingDto saveStaffSchedulingDto){ |
| | | public R<?> save(@RequestBody @Validated SaveStaffSchedulingDto saveStaffSchedulingDto){ |
| | | staffSchedulingService.saveStaffScheduling(saveStaffSchedulingDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/delByIds") |
| | | public AjaxResult delByIds(@RequestBody List<Integer> ids){ |
| | | public R<?> delByIds(@RequestBody List<Integer> ids){ |
| | | staffSchedulingService.removeByIds(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @DeleteMapping("/del/{id}") |
| | | public AjaxResult del(@PathVariable("id") Integer id){ |
| | | public R<?> del(@PathVariable("id") Integer id){ |
| | | staffSchedulingService.removeById(id); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前用户最新排班记录 |
| | | */ |
| | | @GetMapping("/getCurrentUserLatestScheduling") |
| | | public AjaxResult getCurrentUserLatestScheduling(){ |
| | | return AjaxResult.success(staffSchedulingService.getCurrentUserLatestScheduling()); |
| | | public R<?> getCurrentUserLatestScheduling(){ |
| | | return R.ok(staffSchedulingService.getCurrentUserLatestScheduling()); |
| | | } |
| | | |
| | | @Log(title = "导出人员排班列表", businessType = BusinessType.EXPORT) |
| | |
| | | package com.ruoyi.staff.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.pojo.SchemeApplicableStaff; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | |
| | | */ |
| | | public interface SchemeApplicableStaffService extends IService<SchemeApplicableStaff> { |
| | | |
| | | AjaxResult listPage(Page page, SchemeApplicableStaff schemeApplicableStaff); |
| | | R<?> listPage(Page page, SchemeApplicableStaff schemeApplicableStaff); |
| | | |
| | | AjaxResult add(SchemeApplicableStaff schemeApplicableStaff); |
| | | R<?> add(SchemeApplicableStaff schemeApplicableStaff); |
| | | |
| | | AjaxResult updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff); |
| | | R<?> updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.staff.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.staff.dto.CalculateSalaryDto; |
| | | import com.ruoyi.staff.pojo.StaffSalaryMain; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | |
| | | */ |
| | | public interface StaffSalaryMainService extends IService<StaffSalaryMain> { |
| | | |
| | | AjaxResult listPage(Page page, StaffSalaryMain staffSalaryMain); |
| | | R listPage(Page page, StaffSalaryMain staffSalaryMain); |
| | | |
| | | AjaxResult add(StaffSalaryMain staffSalaryMain); |
| | | R<?> add(StaffSalaryMain staffSalaryMain); |
| | | |
| | | AjaxResult updateStaffSalaryMain(StaffSalaryMain staffSalaryMain); |
| | | R<?> updateStaffSalaryMain(StaffSalaryMain staffSalaryMain); |
| | | |
| | | AjaxResult delete(List<Long> ids); |
| | | R<?> delete(List<Long> ids); |
| | | |
| | | AjaxResult calculateSalary(CalculateSalaryDto calculateSalaryDto); |
| | | R<?> calculateSalary(CalculateSalaryDto calculateSalaryDto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.bean.dto.UserAccountDto; |
| | | import com.ruoyi.production.bean.dto.UserProductionAccountingDto; |
| | | import com.ruoyi.production.service.SalesLedgerProductionAccountingService; |
| | |
| | | |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> listPage(Page page, SchemeApplicableStaff schemeApplicableStaff) { |
| | | LambdaQueryWrapper<SchemeApplicableStaff> schemeApplicableStaffLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(schemeApplicableStaff != null){ |
| | | if(StringUtils.isNotEmpty(schemeApplicableStaff.getTitle())){ |
| | |
| | | Page<SchemeApplicableStaff> page1 = schemeApplicableStaffMapper.selectPage(page, schemeApplicableStaffLambdaQueryWrapper); |
| | | List<Long> collect = page1.getRecords().stream().map(SchemeApplicableStaff::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(collect)){ |
| | | return AjaxResult.success(page1); |
| | | return R.ok(page1); |
| | | } |
| | | List<SchemeInsuranceDetail> schemeInsuranceDetails = schemeInsuranceDetailMapper |
| | | .selectList(new LambdaQueryWrapper<SchemeInsuranceDetail>() |
| | |
| | | item.setDeptNames(sysDepts.stream().map(SysDept::getDeptName).collect(Collectors.joining(","))); |
| | | } |
| | | }); |
| | | return AjaxResult.success(page1); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | public void setSchemeApplicableStaffUserInfo(SchemeApplicableStaff schemeApplicableStaff) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> add(SchemeApplicableStaff schemeApplicableStaff) { |
| | | if(schemeApplicableStaff == null){ |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | if(CollectionUtils.isEmpty(schemeApplicableStaff.getSchemeInsuranceDetailList())){ |
| | | return AjaxResult.error("请选择方案明细"); |
| | | return R.fail("请选择方案明细"); |
| | | } |
| | | setSchemeApplicableStaffUserInfo(schemeApplicableStaff); //根据部门设置用户信息 |
| | | int insert = schemeApplicableStaffMapper.insert(schemeApplicableStaff); |
| | |
| | | item.setSchemeId(schemeApplicableStaff.getId()); |
| | | schemeInsuranceDetailMapper.insert(item); |
| | | }); |
| | | return AjaxResult.success(insert); |
| | | return R.ok(insert); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff) { |
| | | public R<?> updateSchemeApplicableStaff(SchemeApplicableStaff schemeApplicableStaff) { |
| | | if(schemeApplicableStaff == null){ |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | setSchemeApplicableStaffUserInfo(schemeApplicableStaff); //根据部门设置用户信息 |
| | | int update = schemeApplicableStaffMapper.updateById(schemeApplicableStaff); |
| | |
| | | item.setSchemeId(schemeApplicableStaff.getId()); |
| | | schemeInsuranceDetailMapper.insert(item); |
| | | }); |
| | | return AjaxResult.success(update); |
| | | return R.ok(update); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | int delete = schemeApplicableStaffMapper.deleteBatchIds(ids); |
| | | schemeInsuranceDetailMapper.delete(new LambdaQueryWrapper<SchemeInsuranceDetail>() |
| | | .in(SchemeInsuranceDetail::getSchemeId, ids)); |
| | | return AjaxResult.success(delete); |
| | | return R.ok(delete); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.project.system.mapper.SysUserDeptMapper; |
| | | import com.ruoyi.staff.dto.CalculateSalaryDto; |
| | | import com.ruoyi.staff.mapper.StaffLeaveMapper; |
| | |
| | | private final AccountExpenseMapper accountExpenseMapper; |
| | | |
| | | @Override |
| | | public AjaxResult listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | public R<?> listPage(Page page, StaffSalaryMain staffSalaryMain) { |
| | | LambdaQueryWrapper<StaffSalaryMain> staffSalaryMainLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(staffSalaryMain != null){ |
| | | if(StringUtils.isNotEmpty(staffSalaryMain.getSalaryTitle())){ |
| | |
| | | List<StaffSalaryDetail> staffSalaryDetailList = staffSalaryDetailMapper.selectList(new LambdaQueryWrapper<StaffSalaryDetail>().eq(StaffSalaryDetail::getMainId, main.getId())); |
| | | main.setStaffSalaryDetailList(staffSalaryDetailList); |
| | | }); |
| | | return AjaxResult.success(page1); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult add(StaffSalaryMain staffSalaryMain) { |
| | | public R<?> add(StaffSalaryMain staffSalaryMain) { |
| | | staffSalaryMainMapper.insert(staffSalaryMain); |
| | | staffSalaryMain.getStaffSalaryDetailList().forEach(detail -> { |
| | | detail.setMainId(staffSalaryMain.getId()); |
| | | }); |
| | | staffSalaryDetailService.saveBatch(staffSalaryMain.getStaffSalaryDetailList()); |
| | | return AjaxResult.success("新增成功"); |
| | | return R.ok(null, "新增成功"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult updateStaffSalaryMain(StaffSalaryMain staffSalaryMain) { |
| | | public R<?> updateStaffSalaryMain(StaffSalaryMain staffSalaryMain) { |
| | | if(staffSalaryMain == null){ |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | StaffSalaryMain staffSalaryMain1 = staffSalaryMainMapper.selectById(staffSalaryMain.getId()); |
| | | if(staffSalaryMain1 == null){ |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | // 待审核不可编辑 |
| | | // if(staffSalaryMain1.getStatus() > 3){ |
| | | // return AjaxResult.error("待审核不可编辑"); |
| | | // return R.fail("待审核不可编辑"); |
| | | // } |
| | | staffSalaryMainMapper.updateById(staffSalaryMain); |
| | | if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(staffSalaryMain.getStaffSalaryDetailList())){ |
| | |
| | | accountExpense.setInputTime(new Date()); |
| | | accountExpenseMapper.insert(accountExpense); |
| | | } |
| | | return AjaxResult.success("修改成功"); |
| | | return R.ok(null, "修改成功"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult delete(List<Long> ids) { |
| | | public R<?> delete(List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | staffSalaryMainMapper.deleteBatchIds(ids); |
| | | staffSalaryDetailMapper.delete(new LambdaQueryWrapper<StaffSalaryDetail>().in(StaffSalaryDetail::getMainId, ids)); |
| | | return AjaxResult.success("删除成功"); |
| | | return R.ok(null, "删除成功"); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult calculateSalary(CalculateSalaryDto calculateSalaryDto) { |
| | | public R<?> calculateSalary(CalculateSalaryDto calculateSalaryDto) { |
| | | if(CollectionUtils.isEmpty(calculateSalaryDto.getIds())){ |
| | | return AjaxResult.error("参数错误"); |
| | | return R.fail("参数错误"); |
| | | } |
| | | List<Map<String, Object>> longs = setSchemeApplicableStaffUserInfo(calculateSalaryDto.getIds()); // 通过部门ids获取用户信息 |
| | | if(CollectionUtils.isEmpty(longs)){ |
| | | return AjaxResult.error("无员工"); |
| | | return R.fail("无员工"); |
| | | } |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (Map<String, Object> id : longs) { |
| | |
| | | schemeApplicableStaffService.calculateByEmployeeId((Integer) id.get("id"),id,calculateSalaryDto.getDate()); |
| | | mapList.add(id); |
| | | } |
| | | return AjaxResult.success(mapList); |
| | | return R.ok(mapList); |
| | | } |
| | | |
| | | public List<Map<String, Object>> setSchemeApplicableStaffUserInfo(List<Long> ids) { |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @Tag(name = "入库") |
| | | @RequestMapping("/stockInRecord") |
| | | @RequiredArgsConstructor |
| | | public class StockInRecordController { |
| | | public class StockInRecordController extends BaseController { |
| | | |
| | | private final StockInRecordService stockInRecordService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "生产入库-入库管理-列表", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "入库管理列表") |
| | | public AjaxResult listPage(Page page, StockInRecordDto stockInRecordDto) { |
| | | public R<?> listPage(Page page, StockInRecordDto stockInRecordDto) { |
| | | IPage<StockInRecordDto> result = stockInRecordService.listPage(page, stockInRecordDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "入库管理-删除入库", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(stockInRecordService.batchDelete(ids)); |
| | | return R.ok(stockInRecordService.batchDelete(ids)); |
| | | } |
| | | |
| | | @DeleteMapping("/pending") |
| | | @Log(title = "入库管理-删除待审批入库", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "删除待审批的入库记录") |
| | | public AjaxResult deletePending(@RequestBody List<Long> ids) { |
| | | public R<?> deletePending(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(stockInRecordService.batchDeletePending(ids)); |
| | | return R.ok(stockInRecordService.batchDeletePending(ids)); |
| | | } |
| | | |
| | | @PostMapping("/exportStockInRecord") |
| | |
| | | @PostMapping("/approve") |
| | | @Log(title = "入库管理-审批入库", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "批量审批入库记录") |
| | | public AjaxResult approve(@RequestBody StockInRecordDto approveDto) { |
| | | public R<?> approve(@RequestBody StockInRecordDto approveDto) { |
| | | if(CollectionUtils.isEmpty(approveDto.getIds())){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | stockInRecordService.batchApprove(approveDto.getIds(), approveDto.getApprovalStatus()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "生产出库-出库管理-列表", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "出库管理列表") |
| | | public AjaxResult listPage(Page page, StockOutRecordDto stockOutRecordDto) { |
| | | public R listPage(Page page, StockOutRecordDto stockOutRecordDto) { |
| | | IPage<StockOutRecordDto> result = stockOutRecordService.listPage(page, stockOutRecordDto); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("") |
| | | @Log(title = "出库管理-新增出库", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody StockOutRecordDto stockOutRecordDto) { |
| | | return AjaxResult.success(stockOutRecordService.add(stockOutRecordDto)); |
| | | public R add(@RequestBody StockOutRecordDto stockOutRecordDto) { |
| | | return R.ok(stockOutRecordService.add(stockOutRecordDto)); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @Log(title = "出库管理-更新出库", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@PathVariable("id") Long id, @RequestBody StockOutRecordDto stockOutRecordDto) { |
| | | return AjaxResult.success(stockOutRecordService.update(id, stockOutRecordDto)); |
| | | public R update(@PathVariable("id") Long id, @RequestBody StockOutRecordDto stockOutRecordDto) { |
| | | return R.ok(stockOutRecordService.update(id, stockOutRecordDto)); |
| | | } |
| | | |
| | | @DeleteMapping("") |
| | | @Log(title = "出库管理-删除出库", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(stockOutRecordService.batchDelete(ids)); |
| | | return R.ok(stockOutRecordService.batchDelete(ids)); |
| | | } |
| | | |
| | | @DeleteMapping("/pending") |
| | | @Log(title = "出库管理-删除待审批出库", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "删除待审批的出库记录") |
| | | public AjaxResult deletePending(@RequestBody List<Long> ids) { |
| | | public R deletePending(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | return AjaxResult.success(stockOutRecordService.batchDeletePending(ids)); |
| | | return R.ok(stockOutRecordService.batchDeletePending(ids)); |
| | | } |
| | | |
| | | @PostMapping("/exportStockOutRecord") |
| | |
| | | @PostMapping("/approve") |
| | | @Log(title = "出库管理-审批出库", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "批量审批出库记录") |
| | | public AjaxResult approve(@RequestBody StockOutRecordDto approveDto) { |
| | | public R approve(@RequestBody StockOutRecordDto approveDto) { |
| | | if(CollectionUtils.isEmpty(approveDto.getIds())){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | stockOutRecordService.batchApprove(approveDto.getIds(), approveDto.getApprovalStatus()); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.technology.bean.dto.TechnologyOperationParamDto; |
| | | import com.ruoyi.technology.bean.vo.TechnologyOperationParamVo; |
| | |
| | | @RequestMapping("/technologyOperationParam") |
| | | @Tag(name = "工序参数") |
| | | @RequiredArgsConstructor |
| | | public class TechnologyOperationParamController { |
| | | public class TechnologyOperationParamController extends BaseController { |
| | | |
| | | private final TechnologyOperationParamService technologyOperationParamService; |
| | | |
| | |
| | | @DeleteMapping("/batchDelete/{id}") |
| | | @Log(title = "Delete technology operation param", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "删除工序参数") |
| | | public AjaxResult batchDelete(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(technologyOperationParamService.batchDelete(id)); |
| | | public R<?> batchDelete(@PathVariable("id") Long id) { |
| | | return R.ok(technologyOperationParamService.batchDelete(id)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.warehouse.pojo.DocumentClassification; |
| | | import com.ruoyi.warehouse.service.DocumentClassificationService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | //树结构 |
| | | @GetMapping("/getList") |
| | | public AjaxResult getList() { |
| | | return AjaxResult.success(documentClassificationService.selectDocumentClassificationList()); |
| | | public R<?> getList() { |
| | | return R.ok(documentClassificationService.selectDocumentClassificationList()); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "文档分类-添加") |
| | | @Log(title = "文档分类-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody DocumentClassification documentClassification) { |
| | | return AjaxResult.success(documentClassificationService.save(documentClassification)); |
| | | public R<?> add(@RequestBody DocumentClassification documentClassification) { |
| | | return R.ok(documentClassificationService.save(documentClassification)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "文档分类-更新") |
| | | @Log(title = "文档分类-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody DocumentClassification documentClassification) { |
| | | return AjaxResult.success(documentClassificationService.updateById(documentClassification)); |
| | | public R<?> update(@RequestBody DocumentClassification documentClassification) { |
| | | return R.ok(documentClassificationService.updateById(documentClassification)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "文档分类删除") |
| | | @Log(title = "文档分类删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(documentClassificationService.deleteByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(documentClassificationService.deleteByIds(ids)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.warehouse.mapper.DocumentationReturnManagementMapper; |
| | | import com.ruoyi.warehouse.pojo.DocumentationBorrowManagement; |
| | | import com.ruoyi.warehouse.pojo.DocumentationReturnManagement; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "文档借阅管理-借阅分页查询") |
| | | @Log(title = "文档借阅管理-借阅分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, DocumentationBorrowManagement documentationBorrowManagement) { |
| | | return AjaxResult.success(documentationBorrowManagementService.listPage(page, documentationBorrowManagement)); |
| | | public R<?> listPage(Page page, DocumentationBorrowManagement documentationBorrowManagement) { |
| | | return R.ok(documentationBorrowManagementService.listPage(page, documentationBorrowManagement)); |
| | | } |
| | | @GetMapping("/list") |
| | | @Operation(summary = "文档借阅管理-借阅查询") |
| | | @Log(title = "文档借阅管理-借阅查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult list() { |
| | | return AjaxResult.success(documentationBorrowManagementService.listAll()); |
| | | public R<?> list() { |
| | | return R.ok(documentationBorrowManagementService.listAll()); |
| | | } |
| | | @GetMapping("/listPageReturn") |
| | | @Operation(summary = "文档借阅管理-归还分页查询") |
| | | @Log(title = "文档借阅管理-归还分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPageReturn(Page page, DocumentationReturnManagement documentationReturnManagement) { |
| | | return AjaxResult.success(documentationReturnManagementMapper.listPage(page, documentationReturnManagement)); |
| | | public R<?> listPageReturn(Page page, DocumentationReturnManagement documentationReturnManagement) { |
| | | return R.ok(documentationReturnManagementMapper.listPage(page, documentationReturnManagement)); |
| | | } |
| | | @GetMapping("/getByDocumentationId/{id}") |
| | | @Operation(summary = "根据书籍id查询借阅记录") |
| | | @Log(title = "根据书籍id查询借阅记录", businessType = BusinessType.OTHER) |
| | | public AjaxResult getByDocumentationId(@PathVariable Long id) { |
| | | return AjaxResult.success(documentationBorrowManagementService.selectByDocumentationId(id)); |
| | | public R<?> getByDocumentationId(@PathVariable Long id) { |
| | | return R.ok(documentationBorrowManagementService.selectByDocumentationId(id)); |
| | | } |
| | | @PostMapping("/add") |
| | | @Operation(summary = "文档借阅管理-借阅") |
| | | @Log(title = "文档借阅管理-借阅", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) { |
| | | return AjaxResult.success(documentationBorrowManagementService.add(documentationBorrowManagement)); |
| | | public R<?> add(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) { |
| | | return R.ok(documentationBorrowManagementService.add(documentationBorrowManagement)); |
| | | } |
| | | @PutMapping("/revent") |
| | | @Operation(summary = "文档借阅管理-归还") |
| | | @Log(title = "文档借阅管理-归还", businessType = BusinessType.UPDATE) |
| | | public AjaxResult revent(@RequestBody DocumentationReturnManagement documentationReturnManagement) { |
| | | return AjaxResult.success(documentationBorrowManagementService.reventdbm(documentationReturnManagement)); |
| | | public R<?> revent(@RequestBody DocumentationReturnManagement documentationReturnManagement) { |
| | | return R.ok(documentationBorrowManagementService.reventdbm(documentationReturnManagement)); |
| | | } |
| | | @PutMapping("/update") |
| | | @Operation(summary = "文档借阅管理-更新") |
| | | @Log(title = "文档借阅管理-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) { |
| | | return AjaxResult.success(documentationBorrowManagementService.updateById(documentationBorrowManagement)); |
| | | public R<?> update(@RequestBody DocumentationBorrowManagement documentationBorrowManagement) { |
| | | return R.ok(documentationBorrowManagementService.updateById(documentationBorrowManagement)); |
| | | } |
| | | @PutMapping("/reventUpdate") |
| | | @Operation(summary = "文档借阅管理-归还更新") |
| | | @Log(title = "文档借阅管理-归还更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult reventupdate(@RequestBody DocumentationReturnManagement documentationReturnManagement) { |
| | | return AjaxResult.success(documentationReturnManagementMapper.updateById(documentationReturnManagement)); |
| | | public R<?> reventupdate(@RequestBody DocumentationReturnManagement documentationReturnManagement) { |
| | | return R.ok(documentationReturnManagementMapper.updateById(documentationReturnManagement)); |
| | | } |
| | | @DeleteMapping ("/delete") |
| | | @Operation(summary = "文档借阅管理-借阅删除") |
| | | @Log(title = "文档借阅管理-借阅删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(documentationBorrowManagementService.deleteByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(documentationBorrowManagementService.deleteByIds(ids)); |
| | | } |
| | | @DeleteMapping ("/reventDelete") |
| | | @Operation(summary = "文档借阅管理-归还删除") |
| | | @Log(title = "文档借阅管理-归还删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult reventdelete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(documentationBorrowManagementService.reventDeleteByIds(ids)); |
| | | public R<?> reventdelete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(documentationBorrowManagementService.reventDeleteByIds(ids)); |
| | | } |
| | | @PostMapping("/export") |
| | | @Operation(summary = "文档借阅管理-借阅导出") |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.warehouse.dto.DocumentationDto; |
| | | import com.ruoyi.warehouse.pojo.Documentation; |
| | | import com.ruoyi.warehouse.service.DocumentationService; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "文档信息表-分页查询") |
| | | @Log(title = "文档信息表-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, Documentation documentation) { |
| | | public R<?> listPage(Page page, Documentation documentation) { |
| | | IPage<DocumentationDto> list = documentationService.listPage(page, documentation); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "文档信息表查询") |
| | | @Log(title = "文档信息表查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult list() { |
| | | public R<?> list() { |
| | | List<DocumentationDto> list = documentationService.listAll(); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "文档信息表-添加") |
| | | @Log(title = "文档信息表-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody Documentation documentation) { |
| | | return AjaxResult.success(documentationService.save(documentation)); |
| | | public R<?> add(@RequestBody Documentation documentation) { |
| | | return R.ok(documentationService.save(documentation)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "文档信息表-更新") |
| | | @Log(title = "文档信息表-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody Documentation documentation) { |
| | | return AjaxResult.success(documentationService.updateById(documentation)); |
| | | public R<?> update(@RequestBody Documentation documentation) { |
| | | return R.ok(documentationService.updateById(documentation)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "文档信息表-删除") |
| | | @Log(title = "文档信息表-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(documentationService.deleteByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(documentationService.deleteByIds(ids)); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | |
| | | |
| | | @Operation(summary = "文档信息表-统计") |
| | | @GetMapping("/overview") |
| | | public AjaxResult getOverviewStatistics() { |
| | | public R<?> getOverviewStatistics() { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("totalDocsCount", documentationService.getTotalDocsCount()); |
| | | result.put("categoryNumCount", documentationService.getCategoryNumCount()); |
| | | result.put("borrowedDocsCount", documentationService.getBorrowedDocsCount()); |
| | | result.put("monthlyAddedDocsCount", documentationService.getMonthlyAddedDocsCount()); |
| | | return AjaxResult.success(result); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @Operation(summary = "文档信息表-分类统计") |
| | | @GetMapping("/category") |
| | | public AjaxResult getCategoryDistribution() { |
| | | return AjaxResult.success(documentationService.getCategoryDistribution()); |
| | | public R<?> getCategoryDistribution() { |
| | | return R.ok(documentationService.getCategoryDistribution()); |
| | | } |
| | | |
| | | @Operation(summary = "文档信息表-状态统计") |
| | | @GetMapping("/status") |
| | | public AjaxResult getStatusDistribution() { |
| | | return AjaxResult.success(documentationService.getStatusDistribution()); |
| | | public R<?> getStatusDistribution() { |
| | | return R.ok(documentationService.getStatusDistribution()); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.pojo.AccountFile; |
| | | import com.ruoyi.account.service.AccountFileService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.warehouse.pojo.DocumentationFile; |
| | | import com.ruoyi.warehouse.service.DocumentationFileService; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/documentation/documentationFile") |
| | | public class DocumentationFileController { |
| | | public class DocumentationFileController extends BaseController { |
| | | |
| | | |
| | | @Resource |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody DocumentationFile documentationFile) { |
| | | return AjaxResult.success(documentationFileService.save(documentationFile)); |
| | | public R<?> add(@RequestBody DocumentationFile documentationFile) { |
| | | return R.ok(documentationFileService.save(documentationFile)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult delDocumentationFile(@RequestBody List<Long> ids) { |
| | | public R<?> delDocumentationFile(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return AjaxResult.error("请选择至少一条数据"); |
| | | return R.fail("请选择至少一条数据"); |
| | | } |
| | | //删除检验附件 |
| | | return AjaxResult.success(documentationFileService.removeBatchByIds(ids)); |
| | | return R.ok(documentationFileService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult documentationFileListPage(DocumentationFile documentationFile) { |
| | | return AjaxResult.success(documentationFileService.documentationFileListPage( documentationFile)); |
| | | public R<?> documentationFileListPage(DocumentationFile documentationFile) { |
| | | return R.ok(documentationFileService.documentationFileListPage( documentationFile)); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.warehouse.pojo.Warehouse; |
| | | import com.ruoyi.warehouse.service.WarehouseService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | @GetMapping("/tree") |
| | | @Operation(summary = "仓库-查询树") |
| | | @Log(title = "仓库-查询树", businessType = BusinessType.OTHER) |
| | | public AjaxResult listTree() { |
| | | return AjaxResult.success(warehouseService.findListTree()); |
| | | public R<?> listTree() { |
| | | return R.ok(warehouseService.findListTree()); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "仓库-查询") |
| | | @Log(title = "仓库-查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult list(Warehouse warehouse) { |
| | | return AjaxResult.success(warehouseService.findList(warehouse)); |
| | | public R<?> list(Warehouse warehouse) { |
| | | return R.ok(warehouseService.findList(warehouse)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "仓库-添加") |
| | | @Log(title = "仓库-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody Warehouse warehouse) { |
| | | return AjaxResult.success(warehouseService.save(warehouse)); |
| | | public R<?> add(@RequestBody Warehouse warehouse) { |
| | | return R.ok(warehouseService.save(warehouse)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "仓库-更新") |
| | | @Log(title = "仓库-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody Warehouse warehouse) { |
| | | return AjaxResult.success(warehouseService.updateById(warehouse)); |
| | | public R<?> update(@RequestBody Warehouse warehouse) { |
| | | return R.ok(warehouseService.updateById(warehouse)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "仓库-删除") |
| | | @Log(title = "仓库-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(warehouseService.deleteByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(warehouseService.deleteByIds(ids)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.warehouse.dto.WarehouseGoodsShelvesDto; |
| | | import com.ruoyi.warehouse.pojo.WarehouseGoodsShelves; |
| | | import com.ruoyi.warehouse.service.WarehouseGoodsShelvesService; |
| | |
| | | @GetMapping("/listById") |
| | | @Operation(summary = "商品货架-查询") |
| | | @Log(title = "商品货架-查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listById(WarehouseGoodsShelves warehouseGoodsShelves) { |
| | | public R<?> listById(WarehouseGoodsShelves warehouseGoodsShelves) { |
| | | List<WarehouseGoodsShelvesDto> list = warehouseGoodsShelvesService.findList(warehouseGoodsShelves); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | @PostMapping("/add") |
| | | @Operation(summary = "商品货架-添加") |
| | | @Log(title = "商品货架-添加", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) { |
| | | return AjaxResult.success(warehouseGoodsShelvesService.add(warehouseGoodsShelves)); |
| | | public R<?> add(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) { |
| | | return R.ok(warehouseGoodsShelvesService.add(warehouseGoodsShelves)); |
| | | } |
| | | @PutMapping("/update") |
| | | @Operation(summary = "商品货架-更新") |
| | | @Log(title = "商品货架-更新", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) { |
| | | return AjaxResult.success(warehouseGoodsShelvesService.updateRowcolById(warehouseGoodsShelves)); |
| | | public R<?> update(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) { |
| | | return R.ok(warehouseGoodsShelvesService.updateRowcolById(warehouseGoodsShelves)); |
| | | } |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "商品货架-删除") |
| | | @Log(title = "商品货架-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return AjaxResult.success(warehouseGoodsShelvesService.deleteByIds(ids)); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return R.ok(warehouseGoodsShelvesService.deleteByIds(ids)); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.warehouse.dto.WarehouseGoodsShelvesRowcolDto; |
| | | import com.ruoyi.warehouse.pojo.WarehouseGoodsShelvesRowcol; |
| | | import com.ruoyi.warehouse.service.WarehouseGoodsShelvesRowcolService; |
| | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "商品货架行列-查询") |
| | | @Log(title = "商品货架行列-查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult list(WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) { |
| | | public R<?> list(WarehouseGoodsShelvesRowcol warehouseGoodsShelvesRowcol) { |
| | | |
| | | List<WarehouseGoodsShelvesRowcolDto> list = warehouseGoodsShelvesRowcolService.getList(warehouseGoodsShelvesRowcol); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.waterrecord.pojo.WaterRecord; |
| | | import com.ruoyi.waterrecord.service.WaterRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "用水管理-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, WaterRecord waterRecord){ |
| | | public R<?> listPage(Page page, WaterRecord waterRecord){ |
| | | IPage<WaterRecord> listPage = waterRecordService.listPage(page, waterRecord); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "用水管理-新增", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody WaterRecord waterRecord){ |
| | | public R<?> add(@RequestBody WaterRecord waterRecord){ |
| | | boolean save = waterRecordService.save(waterRecord); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "用水管理-修改", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody WaterRecord waterRecord){ |
| | | public R<?> update(@RequestBody WaterRecord waterRecord){ |
| | | boolean update = waterRecordService.updateById(waterRecord); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "用水管理-删除", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | boolean delete = waterRecordService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "导入用水管理", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | @Operation(summary = "导入用水管理") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | return waterRecordService.importData(file); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.waterrecord.pojo.WaterRecord; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | */ |
| | | IPage<WaterRecord> listPage(Page page, WaterRecord waterRecord); |
| | | |
| | | AjaxResult importData(MultipartFile file); |
| | | R<?> importData(MultipartFile file); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.waterrecord.mapper.WaterRecordMapper; |
| | | import com.ruoyi.waterrecord.pojo.WaterRecord; |
| | | import com.ruoyi.waterrecord.service.WaterRecordService; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult importData(MultipartFile file) { |
| | | public R<?> importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<WaterRecord> util = new ExcelUtil<WaterRecord>(WaterRecord.class); |
| | | List<WaterRecord> userList = util.importExcel(file.getInputStream()); |
| | | if(CollectionUtils.isEmpty(userList)){ |
| | | return AjaxResult.warn("模板错误或导入数据为空"); |
| | | return R.fail(HttpStatus.WARN, "模板错误或导入数据为空"); |
| | | } |
| | | this.saveOrUpdateBatch(userList); |
| | | return AjaxResult.success(true); |
| | | return R.ok(true); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return AjaxResult.error("导入失败"); |
| | | return R.fail("导入失败"); |
| | | } |
| | | } |
| | | } |
| | |
| | | # 版权年份 |
| | | copyrightYear: 2025 |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | profile: /Users/mac/project/product-inventory-management/file |
| | | |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 7006 |
| | | port: 9009 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | |
| | | accessKey: admin |
| | | secretKey: 12345678 |
| | | preview-expiry: 24 # 预览地址默认24小时 |
| | | default-bucket: uploadPath |
| | | default-bucket: jxc |
| | | # 用户配置 |
| | | user: |
| | | password: |
| | |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://localhost:3306/product-inventory-management-new-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://1.15.17.182:9999/product-inventory-management-new-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | password: xd@123456.. |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | # 令牌密钥 新版jwt密钥长度必须64位以上 |
| | | secret: xpAVjhCjQDaDB7mjPAzMDSbQWXNu2zYkTdDNUsPMS5Xx8QMmQVYN7n74eZrYJxDJ |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 450 |
| | |
| | | # 是否允许生成文件覆盖到本地(自定义路径),默认不允许 |
| | | allowOverwrite: false |
| | | |
| | | |
| | | knowledge: |
| | | one: D:\新疆大罗素企业产品体系说明文档.md |
| | | |
| | | # 文件上传配置 |
| | | file: |
| | | temp-dir: D:/ruoyi/temp/uploads # 临时目录 后期删除 |
| | | upload-dir: D:/ruoyi/prod/uploads # 正式目录 后期删除 |
| | | path: D:/ruoyi/prod/uploads # 上传目录 |
| | | temp-dir: /Users/mac/project/product-inventory-management/file/temp/uploads |
| | | upload-dir: /Users/mac/project/product-inventory-management/file/prod/uploads |
| | | path: /Users/mac/project/product-inventory-management/download/uploads # 上传目录 |
| | | urlPrefix: /common # 链接前缀 |
| | | domain: http://127.0.0.1:7006 # 域名前缀 |
| | | domain: http://127.0.0.1:9009 # 域名前缀 |
| | | expired: 120 # 过期时间(单位:分钟) |
| | | useLimit: 10 # 使用次数 |
| | | compress: true # 是否压缩 |
| | | needCompressSize: 10MB # 压缩阈值 |
| | | compressQuality: 0.5 # 压缩质量(0.0-1.0) |
| | | knowledge: |
| | | one: D:\新疆大罗素企业产品体系说明文档.md |
| | | |