bluejay
2025-04-09 97eac0bb220f686c0d39e536a158d2fbde6ea0ab
aps-modules/aps-core/src/main/java/com/aps/core/controller/ApsPlatePlanController.java
@@ -5,6 +5,11 @@
import com.aps.common.core.domain.R;
import com.aps.common.core.utils.file.FileUtils;
import com.aps.common.core.utils.uuid.IdUtils;
import com.aps.common.security.utils.DictUtils;
import com.aps.core.domain.ApsPartPlanTemp;
import com.aps.core.domain.ApsPlatePlanTemp;
import com.aps.system.api.domain.SysDictData;
import com.aps.system.api.domain.SysFile;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,8 +40,7 @@
 */
@RestController
@RequestMapping("/ApsPlatePlan")
public class ApsPlatePlanController extends BaseController
{
public class ApsPlatePlanController extends BaseController {
    @Autowired
    private IApsPlatePlanService apsPlatePlanService;
@@ -45,8 +49,7 @@
     */
    @RequiresPermissions("ApsPlatePlan:ApsPlatePlan:list")
    @GetMapping("/list")
    public TableDataInfo list(ApsPlatePlan apsPlatePlan)
    {
    public TableDataInfo list(ApsPlatePlan apsPlatePlan) {
        startPage();
        List<ApsPlatePlan> list = apsPlatePlanService.selectApsPlatePlanList(apsPlatePlan);
        return getDataTable(list);
@@ -58,8 +61,7 @@
    @RequiresPermissions("ApsPlatePlan:ApsPlatePlan:export")
    @Log(title = "钣金计划管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ApsPlatePlan apsPlatePlan)
    {
    public void export(HttpServletResponse response, ApsPlatePlan apsPlatePlan) {
        List<ApsPlatePlan> list = apsPlatePlanService.selectApsPlatePlanList(apsPlatePlan);
        ExcelUtil<ApsPlatePlan> util = new ExcelUtil<ApsPlatePlan>(ApsPlatePlan.class);
        util.exportExcel(response, list, "钣金计划管理数据");
@@ -70,8 +72,7 @@
     */
    @RequiresPermissions("ApsPlatePlan:ApsPlatePlan:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(apsPlatePlanService.selectApsPlatePlanById(id));
    }
@@ -81,8 +82,7 @@
    @RequiresPermissions("ApsPlatePlan:ApsPlatePlan:add")
    @Log(title = "钣金计划管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ApsPlatePlan apsPlatePlan)
    {
    public AjaxResult add(@RequestBody ApsPlatePlan apsPlatePlan) {
        return toAjax(apsPlatePlanService.insertApsPlatePlan(apsPlatePlan));
    }
@@ -92,8 +92,7 @@
    @RequiresPermissions("ApsPlatePlan:ApsPlatePlan:edit")
    @Log(title = "钣金计划管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ApsPlatePlan apsPlatePlan)
    {
    public AjaxResult edit(@RequestBody ApsPlatePlan apsPlatePlan) {
        return toAjax(apsPlatePlanService.updateApsPlatePlan(apsPlatePlan));
    }
@@ -103,26 +102,35 @@
    @RequiresPermissions("ApsPlatePlan:ApsPlatePlan:remove")
    @Log(title = "钣金计划管理", businessType = BusinessType.DELETE)
   @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(apsPlatePlanService.deleteApsPlatePlanByIds(ids));
    }
    @PostMapping("/upload")
    public AjaxResult upload(MultipartFile file)
    {
        try
        {
            // 上传并返回访问地址
            ExcelUtil<ApsPlatePlan> util = new ExcelUtil<ApsPlatePlan>(ApsPlatePlan.class);
            List<ApsPlatePlan> userList = util.importExcel(file.getInputStream());
            System.out.println(userList.size());
    /**
     * 导入Excel数据
     * @param file
     * @return
     * @throws Exception
     */
    @PostMapping("/importData")
    public AjaxResult importData(MultipartFile file) throws Exception {
        ExcelUtil<ApsPlatePlanTemp> util = new ExcelUtil<ApsPlatePlanTemp>(ApsPlatePlanTemp.class);
        List<ApsPlatePlanTemp> platePlanTemps = util.importExcel(file.getInputStream());
        //判断导入数据是否为空
        if (platePlanTemps.size() > 0) {
            String batchNum = apsPlatePlanService.importData(platePlanTemps);
            return AjaxResult.success("导入成功!",batchNum);
        } else {
            return AjaxResult.error("模板内容为空");
        }
        catch (Exception e)
        {
        }
        return toAjax(true);
    /**
     * 确认部分计划控制器
     * @param planTemp 包含部分计划信息的临时对象,用于确认计划
     * @return 返回操作结果的AjaxResult对象
     */
    @GetMapping("/confirmPart")
    public AjaxResult confirmPart(ApsPlatePlanTemp planTemp) {
        return toAjax(apsPlatePlanService.confirmPlan(planTemp));
    }
}