renkang
2025-01-07 0673f6fde8fd884332c404031a2ee523ec45d190
客户资料 巡检任务业务
已修改20个文件
1069 ■■■■ 文件已修改
server/system_service/src/main/java/com/doumee/core/utils/Constants.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/system_service/src/main/java/com/doumee/dao/system/model/Multifile.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwMaterialController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwProblemController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingController.java 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingRecordController.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwStocktakingRecordMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwMaterial.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwProblem.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktaking.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktakingRecord.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwMaterialService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingRecordService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwMaterialServiceImpl.java 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwOutinboundServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProblemServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingRecordServiceImpl.java 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java 361 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/system_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -52,6 +52,7 @@
    public static final String YW_DEVICE ="YW_DEVICE" ;
    public static final String YW_PATROL ="YW_PATROL" ;
    public static final String YW_CONTRACT_BILL ="YW_CONTRACT_BILL" ;
    public static final String YW_MATERIAL ="YW_MATERIAL" ;
    public static final String RESERVATION_TOTAL_NUM ="RESERVATION_TOTAL_NUM" ;
    public static final String SIGN_IN_PLACE_LAT ="SIGN_IN_PLACE_LAT" ;
@@ -1385,6 +1386,8 @@
        YW_CONTRACT_FILE(9, "合同附件 ", "合同附件 "),
        FN_CONTRACT_REVENUE_FILE(10, "收支流水附件 ", "合同账单附件 "),
        FN_PATROL_TASK_RECORD_FILE(11, "巡检任务点处理附件 ", "巡检任务点处理附件 "),
        MATERIAL_FILE(12, "资产附件 ", "资产附件 "),
        PROBLEM_FILE(13, "问题附件 ", "问题附件 "),
        ;
        // 成员变量
server/system_service/src/main/java/com/doumee/dao/system/model/Multifile.java
@@ -63,8 +63,8 @@
    @ExcelColumn(name="类型0图片 1视频 2其他")
    private Integer type;
    @ApiModelProperty(value = "关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件 5阜宁设备图片 6阜宁设备运维图片", example = "1")
    @ExcelColumn(name="关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件  5阜宁设备图片 6阜宁设备运维图片")
    @ApiModelProperty(value = "关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件 5阜宁设备图片 6阜宁设备运维图片 7资产附件", example = "1")
    @ExcelColumn(name="关联对象类型 0隐患现场情况 1隐患处理前情况 2隐患处理后情况 3隐患退回说明 4会议室文件  5阜宁设备图片 6阜宁设备运维图片 7资产附件")
    private Integer objType;
    @ApiModelProperty(value = "文件地址")
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwMaterialController.java
@@ -36,14 +36,15 @@
    @ApiOperation("新建")
    @PostMapping("/create")
    @CloudRequiredPermission("business:ywmaterial:create")
    public ApiResponse create(@RequestBody YwMaterial ywMaterial) {
    public ApiResponse create(@RequestBody YwMaterial ywMaterial,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywMaterial.setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywMaterialService.create(ywMaterial));
    }
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @CloudRequiredPermission("business:ywmaterial:delete")
    public ApiResponse deleteById(@PathVariable Integer id) {
    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywMaterialService.deleteById(id);
        return ApiResponse.success(null);
    }
@@ -51,7 +52,7 @@
    @ApiOperation("批量删除")
    @GetMapping("/delete/batch")
    @CloudRequiredPermission("business:ywmaterial:delete")
    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        String [] idArray = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String id : idArray) {
@@ -64,29 +65,38 @@
    @ApiOperation("根据ID修改")
    @PostMapping("/updateById")
    @CloudRequiredPermission("business:ywmaterial:update")
    public ApiResponse updateById(@RequestBody YwMaterial ywMaterial) {
    public ApiResponse updateById(@RequestBody YwMaterial ywMaterial,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywMaterialService.updateById(ywMaterial);
        return ApiResponse.success(null);
    }
    @ApiOperation("根据ID修改状态")
    @PostMapping("/updateStatus")
    @CloudRequiredPermission("business:ywmaterial:update")
    public ApiResponse updateStatus(@RequestBody YwMaterial ywMaterial,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywMaterialService.updateStatus(ywMaterial);
        return ApiResponse.success(null);
    }
    @ApiOperation("分页查询")
    @PostMapping("/page")
    @CloudRequiredPermission("business:ywmaterial:query")
    public ApiResponse<PageData<YwMaterial>> findPage (@RequestBody PageWrap<YwMaterial> pageWrap) {
    public ApiResponse<PageData<YwMaterial>> findPage (@RequestBody PageWrap<YwMaterial> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywMaterialService.findPage(pageWrap));
    }
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @CloudRequiredPermission("business:ywmaterial:exportExcel")
    public void exportExcel (@RequestBody PageWrap<YwMaterial> pageWrap, HttpServletResponse response) {
    public void exportExcel (@RequestBody PageWrap<YwMaterial> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ExcelExporter.build(YwMaterial.class).export(ywMaterialService.findPage(pageWrap).getRecords(), "运维资产信息表", response);
    }
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @CloudRequiredPermission("business:ywmaterial:query")
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(ywMaterialService.findById(id));
    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywMaterialService.getDetail(id));
    }
}
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwOutinboundController.java
@@ -36,14 +36,15 @@
    @ApiOperation("新建")
    @PostMapping("/create")
    @CloudRequiredPermission("business:ywoutinbound:create")
    public ApiResponse create(@RequestBody YwOutinbound ywOutinbound) {
    public ApiResponse create(@RequestBody YwOutinbound ywOutinbound,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywOutinbound.setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywOutinboundService.create(ywOutinbound));
    }
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @CloudRequiredPermission("business:ywoutinbound:delete")
    public ApiResponse deleteById(@PathVariable Integer id) {
    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywOutinboundService.deleteById(id);
        return ApiResponse.success(null);
    }
@@ -51,7 +52,7 @@
    @ApiOperation("批量删除")
    @GetMapping("/delete/batch")
    @CloudRequiredPermission("business:ywoutinbound:delete")
    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        String [] idArray = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String id : idArray) {
@@ -64,7 +65,8 @@
    @ApiOperation("根据ID修改")
    @PostMapping("/updateById")
    @CloudRequiredPermission("business:ywoutinbound:update")
    public ApiResponse updateById(@RequestBody YwOutinbound ywOutinbound) {
    public ApiResponse updateById(@RequestBody YwOutinbound ywOutinbound,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywOutinbound.setLoginUserInfo(this.getLoginUser(token));
        ywOutinboundService.updateById(ywOutinbound);
        return ApiResponse.success(null);
    }
@@ -72,21 +74,21 @@
    @ApiOperation("分页查询")
    @PostMapping("/page")
    @CloudRequiredPermission("business:ywoutinbound:query")
    public ApiResponse<PageData<YwOutinbound>> findPage (@RequestBody PageWrap<YwOutinbound> pageWrap) {
    public ApiResponse<PageData<YwOutinbound>> findPage (@RequestBody PageWrap<YwOutinbound> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywOutinboundService.findPage(pageWrap));
    }
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @CloudRequiredPermission("business:ywoutinbound:exportExcel")
    public void exportExcel (@RequestBody PageWrap<YwOutinbound> pageWrap, HttpServletResponse response) {
    public void exportExcel (@RequestBody PageWrap<YwOutinbound> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ExcelExporter.build(YwOutinbound.class).export(ywOutinboundService.findPage(pageWrap).getRecords(), "运维出入库信息表", response);
    }
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @CloudRequiredPermission("business:ywoutinbound:query")
    public ApiResponse findById(@PathVariable Integer id) {
    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywOutinboundService.getDetail(id));
    }
}
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwProblemController.java
@@ -2,6 +2,7 @@
import com.doumee.api.BaseController;
import com.doumee.config.annotation.CloudRequiredPermission;
import com.doumee.config.annotation.LoginNoRequired;
import com.doumee.core.annotation.excel.ExcelExporter;
import com.doumee.core.annotation.pr.PreventRepeat;
import com.doumee.core.model.ApiResponse;
@@ -32,10 +33,10 @@
    @Autowired
    private YwProblemService ywProblemService;
    @LoginNoRequired
    @PreventRepeat
    @ApiOperation("新建")
    @ApiOperation("问题提报")
    @PostMapping("/create")
    @CloudRequiredPermission("business:ywproblem:create")
    public ApiResponse create(@RequestBody YwProblem ywProblem) {
        return ApiResponse.success(ywProblemService.create(ywProblem));
    }
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingController.java
@@ -36,22 +36,23 @@
    @ApiOperation("新建")
    @PostMapping("/create")
    @CloudRequiredPermission("business:ywstocktaking:create")
    public ApiResponse create(@RequestBody YwStocktaking ywStocktaking) {
    public ApiResponse create(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktaking.setLoginUserInfo(this.getLoginUser(token));
        return ApiResponse.success(ywStocktakingService.create(ywStocktaking));
    }
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @CloudRequiredPermission("business:ywstocktaking:delete")
    public ApiResponse deleteById(@PathVariable Integer id) {
        ywStocktakingService.deleteById(id);
    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingService.deleteById(id,getLoginUser(token));
        return ApiResponse.success(null);
    }
    @ApiOperation("批量删除")
    @GetMapping("/delete/batch")
    @CloudRequiredPermission("business:ywstocktaking:delete")
    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        String [] idArray = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String id : idArray) {
@@ -64,7 +65,7 @@
    @ApiOperation("根据ID修改")
    @PostMapping("/updateById")
    @CloudRequiredPermission("business:ywstocktaking:update")
    public ApiResponse updateById(@RequestBody YwStocktaking ywStocktaking) {
    public ApiResponse updateById(@RequestBody YwStocktaking ywStocktaking,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingService.updateById(ywStocktaking);
        return ApiResponse.success(null);
    }
@@ -72,21 +73,51 @@
    @ApiOperation("分页查询")
    @PostMapping("/page")
    @CloudRequiredPermission("business:ywstocktaking:query")
    public ApiResponse<PageData<YwStocktaking>> findPage (@RequestBody PageWrap<YwStocktaking> pageWrap) {
    public ApiResponse<PageData<YwStocktaking>> findPage (@RequestBody PageWrap<YwStocktaking> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywStocktakingService.findPage(pageWrap));
    }
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @CloudRequiredPermission("business:ywstocktaking:exportExcel")
    public void exportExcel (@RequestBody PageWrap<YwStocktaking> pageWrap, HttpServletResponse response) {
    public void exportExcel (@RequestBody PageWrap<YwStocktaking> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ExcelExporter.build(YwStocktaking.class).export(ywStocktakingService.findPage(pageWrap).getRecords(), "运维盘点信息表", response);
    }
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @CloudRequiredPermission("business:ywstocktaking:query")
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(ywStocktakingService.findById(id));
    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywStocktakingService.getDetail(id));
    }
    @ApiOperation("取消盘点单")
    @GetMapping("/cancelById")
    @CloudRequiredPermission("business:ywstocktaking:delete")
    public ApiResponse cancelById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingService.cancelById(id,getLoginUser(token));
        return ApiResponse.success(null);
    }
    @ApiOperation("开始盘点单")
    @GetMapping("/beginById")
    @CloudRequiredPermission("business:ywstocktaking:delete")
    public ApiResponse beginById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingService.beginById(id,getLoginUser(token));
        return ApiResponse.success(null);
    }
    @ApiOperation("完成盘点单")
    @GetMapping("/finishById")
    @CloudRequiredPermission("business:ywstocktaking:delete")
    public ApiResponse finishById(@RequestParam Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingService.finishById(id,getLoginUser(token));
        return ApiResponse.success(null);
    }
}
server/visits/dmvisit_admin/src/main/java/com/doumee/cloud/admin/YwStocktakingRecordController.java
@@ -36,14 +36,14 @@
    @ApiOperation("新建")
    @PostMapping("/create")
    @CloudRequiredPermission("business:ywstocktakingrecord:create")
    public ApiResponse create(@RequestBody YwStocktakingRecord ywStocktakingRecord) {
    public ApiResponse create(@RequestBody YwStocktakingRecord ywStocktakingRecord,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywStocktakingRecordService.create(ywStocktakingRecord));
    }
    @ApiOperation("根据ID删除")
    @GetMapping("/delete/{id}")
    @CloudRequiredPermission("business:ywstocktakingrecord:delete")
    public ApiResponse deleteById(@PathVariable Integer id) {
    public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingRecordService.deleteById(id);
        return ApiResponse.success(null);
    }
@@ -51,7 +51,7 @@
    @ApiOperation("批量删除")
    @GetMapping("/delete/batch")
    @CloudRequiredPermission("business:ywstocktakingrecord:delete")
    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
    public ApiResponse deleteByIdInBatch(@RequestParam String ids,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        String [] idArray = ids.split(",");
        List<Integer> idList = new ArrayList<>();
        for (String id : idArray) {
@@ -64,7 +64,7 @@
    @ApiOperation("根据ID修改")
    @PostMapping("/updateById")
    @CloudRequiredPermission("business:ywstocktakingrecord:update")
    public ApiResponse updateById(@RequestBody YwStocktakingRecord ywStocktakingRecord) {
    public ApiResponse updateById(@RequestBody YwStocktakingRecord ywStocktakingRecord,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingRecordService.updateById(ywStocktakingRecord);
        return ApiResponse.success(null);
    }
@@ -72,21 +72,32 @@
    @ApiOperation("分页查询")
    @PostMapping("/page")
    @CloudRequiredPermission("business:ywstocktakingrecord:query")
    public ApiResponse<PageData<YwStocktakingRecord>> findPage (@RequestBody PageWrap<YwStocktakingRecord> pageWrap) {
    public ApiResponse<PageData<YwStocktakingRecord>> findPage (@RequestBody PageWrap<YwStocktakingRecord> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywStocktakingRecordService.findPage(pageWrap));
    }
    @ApiOperation("导出Excel")
    @PostMapping("/exportExcel")
    @CloudRequiredPermission("business:ywstocktakingrecord:exportExcel")
    public void exportExcel (@RequestBody PageWrap<YwStocktakingRecord> pageWrap, HttpServletResponse response) {
    public void exportExcel (@RequestBody PageWrap<YwStocktakingRecord> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ExcelExporter.build(YwStocktakingRecord.class).export(ywStocktakingRecordService.findPage(pageWrap).getRecords(), "运维盘点明细记录表", response);
    }
    @ApiOperation("根据ID查询")
    @GetMapping("/{id}")
    @CloudRequiredPermission("business:ywstocktakingrecord:query")
    public ApiResponse findById(@PathVariable Integer id) {
        return ApiResponse.success(ywStocktakingRecordService.findById(id));
    public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        return ApiResponse.success(ywStocktakingRecordService.getDetail(id));
    }
    @ApiOperation("盘点提交")
    @PostMapping("/takingData")
    @CloudRequiredPermission("business:ywstocktakingrecord:update")
    public ApiResponse takingData(@RequestBody YwStocktakingRecord ywStocktakingRecord,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) {
        ywStocktakingRecord.setLoginUserInfo(getLoginUser(token));
        ywStocktakingRecordService.takingData(ywStocktakingRecord);
        return ApiResponse.success(null);
    }
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/YwStocktakingRecordMapper.java
@@ -2,11 +2,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doumee.dao.business.model.YwStocktakingRecord;
import com.github.yulichang.base.MPJBaseMapper;
/**
 * @author 江蹄蹄
 * @date 2025/01/06 11:05
 */
public interface YwStocktakingRecordMapper extends BaseMapper<YwStocktakingRecord> {
public interface YwStocktakingRecordMapper extends MPJBaseMapper<YwStocktakingRecord> {
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwMaterial.java
@@ -1,6 +1,9 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.core.model.LoginUserModel;
import com.doumee.dao.system.model.Multifile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -19,7 +22,7 @@
@Data
@ApiModel("运维资产信息表")
@TableName("`yw_material`")
public class YwMaterial {
public class YwMaterial extends LoginUserModel {
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键", example = "1")
@@ -54,8 +57,7 @@
    @ApiModelProperty(value = "名称")
    @ExcelColumn(name="名称")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date name;
    private String name;
    @ApiModelProperty(value = "状态 0启用 1禁用", example = "1")
    @ExcelColumn(name="状态 0启用 1禁用")
@@ -105,4 +107,17 @@
    @ExcelColumn(name="所属房源编码(关联yw_room)")
    private Integer roomId;
    @ApiModelProperty(value = "是否自动编码:0=否;1=是;", example = "1")
    @ExcelColumn(name="是否自动编码:0=否;1=是;")
    private Integer autoCode;
    @ApiModelProperty(value = "附件信息", example = "1")
    @TableField(exist = false)
    private Multifile multifile;
    @ApiModelProperty(value = "所属项目主键", example = "1")
    @TableField(exist = false)
    private Integer projectId;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwProblem.java
@@ -1,6 +1,8 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.dao.system.model.Multifile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -9,6 +11,7 @@
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
/**
 * 运维问题上报信息表
@@ -65,8 +68,7 @@
    @ApiModelProperty(value = "上报人姓名")
    @ExcelColumn(name="上报人姓名")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date name;
    private String name;
    @ApiModelProperty(value = "联系电话")
    @ExcelColumn(name="联系电话")
@@ -106,4 +108,7 @@
    @ExcelColumn(name="关联工单编码(关联yw_workorder)")
    private Integer workorderId;
    @ApiModelProperty(value = "附件信息")
    @TableField(exist = false)
    private List<Multifile> fileList;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktaking.java
@@ -1,6 +1,8 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.core.model.LoginUserModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -8,6 +10,8 @@
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
@@ -18,7 +22,7 @@
@Data
@ApiModel("运维盘点信息表")
@TableName("`yw_stocktaking`")
public class YwStocktaking {
public class YwStocktaking extends LoginUserModel {
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键", example = "1")
@@ -61,7 +65,11 @@
    @ApiModelProperty(value = "盘点员编码(关联system_user)")
    @ExcelColumn(name="盘点员编码(关联system_user)")
    private String userId;
    private Integer userId;
    @ApiModelProperty(value = "名称")
    @ExcelColumn(name="名称")
    private String name;
    @ApiModelProperty(value = "盘点时间")
    @ExcelColumn(name="盘点时间")
@@ -139,4 +147,35 @@
    @ExcelColumn(name="取消备注")
    private String cancelInfo;
    @ApiModelProperty(value = "仓库名称")
    @TableField(exist = false)
    private String warehouseName;
    @ApiModelProperty(value = "创建人名称")
    @TableField(exist = false)
    private String createName;
    @ApiModelProperty(value = "盘点员名称")
    @TableField(exist = false)
    private String userName;
    @ApiModelProperty(value = "已盘记录数")
    @TableField(exist = false)
    private Integer finishAmount;
    @ApiModelProperty(value = "未盘记录数")
    @TableField(exist = false)
    private Integer unFinishAmount;
    @ApiModelProperty(value = "盘盈记录数")
    @TableField(exist = false)
    private Integer profitAmount;
    @ApiModelProperty(value = "盘亏记录数")
    @TableField(exist = false)
    private Integer lossAmount;
    @ApiModelProperty(value = "相符记录数")
    @TableField(exist = false)
    private Integer equalAmount;
}
server/visits/dmvisit_service/src/main/java/com/doumee/dao/business/model/YwStocktakingRecord.java
@@ -1,6 +1,8 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.doumee.core.annotation.excel.ExcelColumn;
import com.doumee.core.model.LoginUserModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
@@ -19,7 +21,7 @@
@Data
@ApiModel("运维盘点明细记录表")
@TableName("`yw_stocktaking_record`")
public class YwStocktakingRecord {
public class YwStocktakingRecord extends LoginUserModel {
    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "主键", example = "1")
@@ -89,4 +91,49 @@
    @ExcelColumn(name="盘点计划编码(关联yw_stocktaking)")
    private Integer stocktakingId;
    @ApiModelProperty(value = "资产编码")
    @TableField(exist = false)
    private String materialCode;
    @ApiModelProperty(value = "资产名称")
    @TableField(exist = false)
    private String materialName;
    @ApiModelProperty(value = "资产条形码")
    @TableField(exist = false)
    private String materialQrcode;
    @ApiModelProperty(value = "资产品牌")
    @TableField(exist = false)
    private String materialBrand;
    @ApiModelProperty(value = "资产规格型号")
    @TableField(exist = false)
    private String materialAttr;
    @ApiModelProperty(value = "资产单位")
    @TableField(exist = false)
    private String materialUnitName;
    @ApiModelProperty(value = "仓库名称")
    @TableField(exist = false)
    private String warehouseName;
    @ApiModelProperty(value = "盘点人名称")
    @TableField(exist = false)
    private String userName;
    @ApiModelProperty(value = "盘点人组织名称")
    @TableField(exist = false)
    private String companyName;
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwMaterialService.java
@@ -55,6 +55,8 @@
     */
    void updateByIdInBatch(List<YwMaterial> ywMaterials);
    void updateStatus(YwMaterial ywMaterials);
    /**
     * 主键查询
     *
@@ -94,4 +96,6 @@
     * @return long
     */
    long count(YwMaterial ywMaterial);
    YwMaterial getDetail(Integer id);
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingRecordService.java
@@ -63,6 +63,7 @@
     */
    YwStocktakingRecord findById(Integer id);
    YwStocktakingRecord getDetail(Integer id);
    /**
     * 条件查询单条记录
     *
@@ -94,4 +95,6 @@
     * @return long
     */
    long count(YwStocktakingRecord ywStocktakingRecord);
    void takingData(YwStocktakingRecord ywStocktakingRecord);
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/YwStocktakingService.java
@@ -1,5 +1,6 @@
package com.doumee.service.business;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.YwStocktaking;
@@ -25,8 +26,13 @@
     *
     * @param id 主键
     */
    void deleteById(Integer id);
    void deleteById(Integer id, LoginUserInfo loginUserInfo);
    void cancelById(Integer id, LoginUserInfo loginUserInfo);
    void beginById(Integer id, LoginUserInfo loginUserInfo);
    void finishById(Integer id, LoginUserInfo loginUserInfo);
    /**
     * 删除
     *
@@ -63,6 +69,7 @@
     */
    YwStocktaking findById(Integer id);
    YwStocktaking getDetail(Integer id);
    /**
     * 条件查询单条记录
     *
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwMaterialServiceImpl.java
@@ -1,20 +1,37 @@
package com.doumee.service.business.impl;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.LoginUserModel;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.YwMaterialMapper;
import com.doumee.dao.business.model.YwMaterial;
import com.doumee.dao.business.YwOutinboundMapper;
import com.doumee.dao.business.YwOutinboundRecordMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.MultifileMapper;
import com.doumee.dao.system.model.Multifile;
import com.doumee.service.business.YwMaterialService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
 * 运维资产信息表Service实现
@@ -27,15 +44,69 @@
    @Autowired
    private YwMaterialMapper ywMaterialMapper;
    @Autowired
    private MultifileMapper multifileMapper;
    @Autowired
    private YwOutinboundRecordMapper ywOutinboundRecordMapper;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public Integer create(YwMaterial ywMaterial) {
        //TODO rk 所属项目/房间需求问题
        if(Objects.isNull(ywMaterial)
            || StringUtils.isBlank(ywMaterial.getName())
                || StringUtils.isBlank(ywMaterial.getCode())
                || StringUtils.isBlank(ywMaterial.getQrcode())
                || Objects.isNull(ywMaterial.getCateId())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        ywMaterial.setId(null);
        if(StringUtils.isBlank(ywMaterial.getCode())){
            //自动生成 TODO 存在问题
            Long countCode = ywMaterialMapper.selectCount(new QueryWrapper<YwMaterial>().lambda().eq(YwMaterial::getAutoCode, Constants.ONE));
            String nextCode = StringUtils.leftPad(Long.toString(countCode + 1),4,"0");
            ywMaterial.setCode("P"+nextCode);
            ywMaterial.setAutoCode(Constants.ONE);
        }else{
            //验证code是否存在
            if(ywMaterialMapper.selectCount(new QueryWrapper<YwMaterial>().lambda().eq(YwMaterial::getCode, ywMaterial.getCode()))>0){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前编码已存在");
            };
            ywMaterial.setAutoCode(Constants.ZERO);
        }
        LoginUserInfo loginUserInfo = ywMaterial.getLoginUserInfo();
        ywMaterial.setCreator(loginUserInfo.getId());
        ywMaterial.setCreateDate(new Date());
        ywMaterial.setIsdeleted(Constants.ZERO);
        ywMaterial.setStatus(Constants.ZERO);
        ywMaterialMapper.insert(ywMaterial);
        if(Objects.nonNull(ywMaterial.getMultifile())){
            if(org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getFileurl())
                    || org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getName())){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"附件信息错误");
            }
            ywMaterial.getMultifile().setCreator(loginUserInfo.getId());
            ywMaterial.getMultifile().setCreateDate(new Date());
            ywMaterial.getMultifile().setIsdeleted(Constants.ZERO);
            ywMaterial.getMultifile().setObjType(Constants.MultiFile.MATERIAL_FILE.getKey());
            ywMaterial.getMultifile().setObjId(ywMaterial.getId());
            multifileMapper.insert(ywMaterial.getMultifile());
        }
        return ywMaterial.getId();
    }
    @Override
    public void deleteById(Integer id) {
        ywMaterialMapper.deleteById(id);
        if(ywOutinboundRecordMapper.selectCount(new QueryWrapper<YwOutinboundRecord>().lambda().eq(YwOutinboundRecord::getMaterialId,id))>Constants.ZERO){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前资产已有出入库记录,不可删除");
        }
        ywMaterialMapper.update(new UpdateWrapper<YwMaterial>().lambda().set(YwMaterial::getIsdeleted,Constants.ONE).eq(YwMaterial::getId,id));
    }
    @Override
@@ -53,8 +124,36 @@
    }
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void updateById(YwMaterial ywMaterial) {
        //TODO rk 所属项目/房间需求问题
        if(Objects.isNull(ywMaterial)
                || StringUtils.isBlank(ywMaterial.getName())
                || StringUtils.isBlank(ywMaterial.getCode())
                || StringUtils.isBlank(ywMaterial.getQrcode())
                || Objects.isNull(ywMaterial.getCateId())
                || Objects.isNull(ywMaterial.getId())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        ywMaterial.setCode(null);
        LoginUserInfo loginUserInfo = ywMaterial.getLoginUserInfo();
        ywMaterial.setEditor(loginUserInfo.getId());
        ywMaterial.setEditDate(new Date());
        ywMaterialMapper.updateById(ywMaterial);
        multifileMapper.delete(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjType,Constants.MultiFile.MATERIAL_FILE.getKey()).eq(Multifile::getObjId,ywMaterial.getId()));
        if(Objects.nonNull(ywMaterial.getMultifile())){
            if(org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getFileurl())
                    || org.apache.commons.lang3.StringUtils.isBlank(ywMaterial.getMultifile().getName())){
                throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"附件信息错误");
            }
            ywMaterial.getMultifile().setCreator(loginUserInfo.getId());
            ywMaterial.getMultifile().setCreateDate(new Date());
            ywMaterial.getMultifile().setIsdeleted(Constants.ZERO);
            ywMaterial.getMultifile().setObjType(Constants.MultiFile.MATERIAL_FILE.getKey());
            ywMaterial.getMultifile().setObjId(ywMaterial.getId());
            multifileMapper.insert(ywMaterial.getMultifile());
        }
    }
    @Override
@@ -68,8 +167,34 @@
    }
    @Override
    public void updateStatus(YwMaterial ywMaterials) {
       if(Objects.isNull(ywMaterials)
           || Objects.isNull(ywMaterials.getId())
           || Objects.isNull(ywMaterials.getStatus())){
           throw new BusinessException(ResponseStatus.BAD_REQUEST);
       }
        ywMaterialMapper.update(new UpdateWrapper<YwMaterial>().lambda().eq(YwMaterial::getId,ywMaterials.getId()).set(YwMaterial::getStatus,ywMaterials.getStatus()));
    }
    @Override
    public YwMaterial findById(Integer id) {
        return ywMaterialMapper.selectById(id);
    }
    @Override
    public YwMaterial getDetail(Integer id) {
        YwMaterial ywMaterial = ywMaterialMapper.selectById(id);
        if(Objects.isNull(ywMaterial)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        Multifile multifile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda().eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.MATERIAL_FILE.getKey()));
        if(Objects.nonNull(multifile)){
            String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_RESOURCE_PATH).getCode()
                    +systemDictDataBiz.queryByCode(Constants.FTP,Constants.YW_CONTRACT_BILL).getCode();
            multifile.setFileurlFull(path + multifile.getFileurl());
            ywMaterial.setMultifile(multifile);
        }
        return ywMaterial;
    }
    @Override
@@ -87,79 +212,21 @@
    @Override
    public PageData<YwMaterial> findPage(PageWrap<YwMaterial> pageWrap) {
        IPage<YwMaterial> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<YwMaterial> queryWrapper = new QueryWrapper<>();
        MPJLambdaWrapper<YwMaterial> queryWrapper = new MPJLambdaWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        if (pageWrap.getModel().getId() != null) {
            queryWrapper.lambda().eq(YwMaterial::getId, pageWrap.getModel().getId());
        }
        if (pageWrap.getModel().getCreator() != null) {
            queryWrapper.lambda().eq(YwMaterial::getCreator, pageWrap.getModel().getCreator());
        }
        if (pageWrap.getModel().getCreateDate() != null) {
            queryWrapper.lambda().ge(YwMaterial::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
            queryWrapper.lambda().le(YwMaterial::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
        }
        if (pageWrap.getModel().getEditor() != null) {
            queryWrapper.lambda().eq(YwMaterial::getEditor, pageWrap.getModel().getEditor());
        }
        if (pageWrap.getModel().getEditDate() != null) {
            queryWrapper.lambda().ge(YwMaterial::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
            queryWrapper.lambda().le(YwMaterial::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
        }
        if (pageWrap.getModel().getIsdeleted() != null) {
            queryWrapper.lambda().eq(YwMaterial::getIsdeleted, pageWrap.getModel().getIsdeleted());
        }
        if (pageWrap.getModel().getRemark() != null) {
            queryWrapper.lambda().eq(YwMaterial::getRemark, pageWrap.getModel().getRemark());
        }
        if (pageWrap.getModel().getName() != null) {
            queryWrapper.lambda().ge(YwMaterial::getName, Utils.Date.getStart(pageWrap.getModel().getName()));
            queryWrapper.lambda().le(YwMaterial::getName, Utils.Date.getEnd(pageWrap.getModel().getName()));
        }
        if (pageWrap.getModel().getStatus() != null) {
            queryWrapper.lambda().eq(YwMaterial::getStatus, pageWrap.getModel().getStatus());
        }
        if (pageWrap.getModel().getCode() != null) {
            queryWrapper.lambda().eq(YwMaterial::getCode, pageWrap.getModel().getCode());
        }
        if (pageWrap.getModel().getParentCateId() != null) {
            queryWrapper.lambda().eq(YwMaterial::getParentCateId, pageWrap.getModel().getParentCateId());
        }
        if (pageWrap.getModel().getCateId() != null) {
            queryWrapper.lambda().eq(YwMaterial::getCateId, pageWrap.getModel().getCateId());
        }
        if (pageWrap.getModel().getQrcode() != null) {
            queryWrapper.lambda().eq(YwMaterial::getQrcode, pageWrap.getModel().getQrcode());
        }
        if (pageWrap.getModel().getSortnum() != null) {
            queryWrapper.lambda().eq(YwMaterial::getSortnum, pageWrap.getModel().getSortnum());
        }
        if (pageWrap.getModel().getBrand() != null) {
            queryWrapper.lambda().eq(YwMaterial::getBrand, pageWrap.getModel().getBrand());
        }
        if (pageWrap.getModel().getAttr() != null) {
            queryWrapper.lambda().eq(YwMaterial::getAttr, pageWrap.getModel().getAttr());
        }
        if (pageWrap.getModel().getMinStock() != null) {
            queryWrapper.lambda().eq(YwMaterial::getMinStock, pageWrap.getModel().getMinStock());
        }
        if (pageWrap.getModel().getMaxStock() != null) {
            queryWrapper.lambda().eq(YwMaterial::getMaxStock, pageWrap.getModel().getMaxStock());
        }
        if (pageWrap.getModel().getUnitName() != null) {
            queryWrapper.lambda().eq(YwMaterial::getUnitName, pageWrap.getModel().getUnitName());
        }
        if (pageWrap.getModel().getRoomId() != null) {
            queryWrapper.lambda().eq(YwMaterial::getRoomId, pageWrap.getModel().getRoomId());
        }
        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                queryWrapper.orderByDesc(sortData.getProperty());
            } else {
                queryWrapper.orderByAsc(sortData.getProperty());
            }
        }
        return PageData.from(ywMaterialMapper.selectPage(page, queryWrapper));
        YwMaterial model = pageWrap.getModel();
        queryWrapper.selectAll(YwMaterial.class)
                .leftJoin(YwRoom.class,YwRoom::getId,YwMaterial::getRoomId)
                .and(StringUtils.isNotBlank(model.getCode()),i->i.like(YwMaterial::getCode,model.getCode()).or().like(YwMaterial::getName,model.getCode()))
                .like(StringUtils.isNotBlank(model.getAttr()),YwMaterial::getAttr,model.getAttr())
                .eq(Objects.nonNull(model.getProjectId()),YwRoom::getProjectId,model.getProjectId())
                .eq(Objects.nonNull(model.getRoomId()),YwMaterial::getRoomId,model.getRoomId())
                .eq(YwMaterial::getIsdeleted,Constants.ZERO)
                .orderByAsc(YwMaterial::getCode)
        ;
        IPage iPage = ywMaterialMapper.selectJoinPage(page,YwMaterial.class,queryWrapper);
        return PageData.from(iPage);
    }
    @Override
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwOutinboundServiceImpl.java
@@ -126,8 +126,6 @@
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"资产信息存在异常,请检查数据!");
        }
        return recordList;
    }
    public void dealStockData(YwOutinbound ywOutinbound,List<YwOutinboundRecord> recordList,Integer inOut){
@@ -168,9 +166,6 @@
            }
        }
    }
    @Override
    public void deleteById(Integer id) {
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwProblemServiceImpl.java
@@ -1,20 +1,29 @@
package com.doumee.service.business.impl;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.YwProblemMapper;
import com.doumee.dao.business.model.YwProblem;
import com.doumee.dao.system.MultifileMapper;
import com.doumee.dao.system.model.Multifile;
import com.doumee.service.business.YwProblemService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
 * 运维问题上报信息表Service实现
@@ -27,9 +36,44 @@
    @Autowired
    private YwProblemMapper ywProblemMapper;
    @Autowired
    private MultifileMapper multifileMapper;
    @Override
    public Integer create(YwProblem ywProblem) {
        if(Objects.isNull(ywProblem)
            || Objects.isNull(ywProblem.getSubmitDate())
            || StringUtils.isBlank(ywProblem.getContent())
            || StringUtils.isBlank(ywProblem.getPhone())
            || StringUtils.isBlank(ywProblem.getName())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        ywProblem.setCreateDate(new Date());
        ywProblem.setIsdeleted(Constants.ZERO);
        ywProblem.setStatus(Constants.ZERO);
        ywProblem.setDealStatus(Constants.ZERO);
        ywProblemMapper.insert(ywProblem);
        List<Multifile> fileList = new ArrayList<>();
        if(ywProblem.getFileList()!=null && ywProblem.getFileList().size()>0){
            for (int i = 0; i <  ywProblem.getFileList().size(); i++) {
                Multifile multifile =  ywProblem.getFileList().get(i);
                if(StringUtils.isBlank(multifile.getFileurl())){
                    continue;
                }
                multifile.setCreateDate(ywProblem.getCreateDate());
                multifile.setIsdeleted(Constants.ZERO);
                multifile.setObjId(ywProblem.getId());
                multifile.setObjType(Constants.MultiFile.PROBLEM_FILE.getKey());
                multifile.setSortnum(i+1);
                fileList.add(multifile);
            }
        }
        if(fileList.size()>0){
            multifileMapper.insert(fileList);
        }
        return ywProblem.getId();
    }
@@ -120,10 +164,6 @@
        }
        if (pageWrap.getModel().getContent() != null) {
            queryWrapper.lambda().eq(YwProblem::getContent, pageWrap.getModel().getContent());
        }
        if (pageWrap.getModel().getName() != null) {
            queryWrapper.lambda().ge(YwProblem::getName, Utils.Date.getStart(pageWrap.getModel().getName()));
            queryWrapper.lambda().le(YwProblem::getName, Utils.Date.getEnd(pageWrap.getModel().getName()));
        }
        if (pageWrap.getModel().getPhone() != null) {
            queryWrapper.lambda().eq(YwProblem::getPhone, pageWrap.getModel().getPhone());
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingRecordServiceImpl.java
@@ -1,20 +1,32 @@
package com.doumee.service.business.impl;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.YwStocktakingMapper;
import com.doumee.dao.business.YwStocktakingRecordMapper;
import com.doumee.dao.business.model.YwStocktakingRecord;
import com.doumee.dao.business.model.*;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.YwStocktakingRecordService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
/**
 * 运维盘点明细记录表Service实现
@@ -26,6 +38,10 @@
    @Autowired
    private YwStocktakingRecordMapper ywStocktakingRecordMapper;
    @Autowired
    private YwStocktakingMapper ywStocktakingMapper;
    @Override
    public Integer create(YwStocktakingRecord ywStocktakingRecord) {
@@ -72,6 +88,31 @@
        return ywStocktakingRecordMapper.selectById(id);
    }
    @Override
    public YwStocktakingRecord getDetail(Integer id) {
        MPJLambdaWrapper<YwStocktakingRecord> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(YwStocktakingRecord.class)
                .selectAs(YwWarehouse::getName, YwStocktakingRecord::getWarehouseName)
                .selectAs(YwMaterial::getCode,YwStocktakingRecord::getMaterialCode)
                .selectAs(YwMaterial::getName,YwStocktakingRecord::getMaterialName)
                .selectAs(YwMaterial::getQrcode,YwStocktakingRecord::getMaterialQrcode)
                .selectAs(YwMaterial::getBrand,YwStocktakingRecord::getMaterialBrand)
                .selectAs(YwMaterial::getUnitName,YwStocktakingRecord::getMaterialUnitName)
                .selectAs(YwMaterial::getAttr,YwStocktakingRecord::getMaterialAttr)
                .selectAs(Company::getName,YwStocktakingRecord::getCompanyName)
                .selectAs(SystemUser::getRealname,YwStocktakingRecord::getUserName)
                .leftJoin(YwStocktaking.class,YwStocktaking::getId,YwStocktakingRecord::getStocktakingId)
                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
                .leftJoin(YwMaterial.class,YwMaterial::getId,YwStocktakingRecord::getMaterialId)
                .leftJoin(SystemUser.class,SystemUser::getId,YwStocktakingRecord::getUserId)
                .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
                .eq(YwStocktakingRecord::getId,id)
                .last(" limit 1 ");
        ;
        return ywStocktakingRecordMapper.selectOne(queryWrapper);
    }
    @Override
    public YwStocktakingRecord findOne(YwStocktakingRecord ywStocktakingRecord) {
        QueryWrapper<YwStocktakingRecord> wrapper = new QueryWrapper<>(ywStocktakingRecord);
@@ -87,67 +128,26 @@
    @Override
    public PageData<YwStocktakingRecord> findPage(PageWrap<YwStocktakingRecord> pageWrap) {
        IPage<YwStocktakingRecord> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<YwStocktakingRecord> queryWrapper = new QueryWrapper<>();
        MPJLambdaWrapper<YwStocktakingRecord> queryWrapper = new MPJLambdaWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        if (pageWrap.getModel().getId() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getId, pageWrap.getModel().getId());
        }
        if (pageWrap.getModel().getCreator() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getCreator, pageWrap.getModel().getCreator());
        }
        if (pageWrap.getModel().getCreateDate() != null) {
            queryWrapper.lambda().ge(YwStocktakingRecord::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
            queryWrapper.lambda().le(YwStocktakingRecord::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
        }
        if (pageWrap.getModel().getEditor() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getEditor, pageWrap.getModel().getEditor());
        }
        if (pageWrap.getModel().getEditDate() != null) {
            queryWrapper.lambda().ge(YwStocktakingRecord::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
            queryWrapper.lambda().le(YwStocktakingRecord::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
        }
        if (pageWrap.getModel().getIsdeleted() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getIsdeleted, pageWrap.getModel().getIsdeleted());
        }
        if (pageWrap.getModel().getRemark() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getRemark, pageWrap.getModel().getRemark());
        }
        if (pageWrap.getModel().getStatus() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getStatus, pageWrap.getModel().getStatus());
        }
        if (pageWrap.getModel().getUserId() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getUserId, pageWrap.getModel().getUserId());
        }
        if (pageWrap.getModel().getPlanDate() != null) {
            queryWrapper.lambda().ge(YwStocktakingRecord::getPlanDate, Utils.Date.getStart(pageWrap.getModel().getPlanDate()));
            queryWrapper.lambda().le(YwStocktakingRecord::getPlanDate, Utils.Date.getEnd(pageWrap.getModel().getPlanDate()));
        }
        if (pageWrap.getModel().getCode() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getCode, pageWrap.getModel().getCode());
        }
        if (pageWrap.getModel().getMaterialId() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getMaterialId, pageWrap.getModel().getMaterialId());
        }
        if (pageWrap.getModel().getStock() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getStock, pageWrap.getModel().getStock());
        }
        if (pageWrap.getModel().getActStock() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getActStock, pageWrap.getModel().getActStock());
        }
        if (pageWrap.getModel().getType() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getType, pageWrap.getModel().getType());
        }
        if (pageWrap.getModel().getStocktakingId() != null) {
            queryWrapper.lambda().eq(YwStocktakingRecord::getStocktakingId, pageWrap.getModel().getStocktakingId());
        }
        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                queryWrapper.orderByDesc(sortData.getProperty());
            } else {
                queryWrapper.orderByAsc(sortData.getProperty());
            }
        }
        return PageData.from(ywStocktakingRecordMapper.selectPage(page, queryWrapper));
        YwStocktakingRecord model = pageWrap.getModel() ;
        queryWrapper.selectAll(YwStocktakingRecord.class)
                .selectAs(YwWarehouse::getName, YwStocktakingRecord::getWarehouseName)
                .selectAs(YwMaterial::getCode,YwStocktakingRecord::getMaterialCode)
                .selectAs(YwMaterial::getName,YwStocktakingRecord::getMaterialName)
                .selectAs(YwMaterial::getQrcode,YwStocktakingRecord::getMaterialQrcode)
                .selectAs(YwMaterial::getBrand,YwStocktakingRecord::getMaterialBrand)
                .selectAs(YwMaterial::getUnitName,YwStocktakingRecord::getMaterialUnitName)
                .selectAs(YwMaterial::getAttr,YwStocktakingRecord::getMaterialAttr)
                .leftJoin(YwStocktaking.class,YwStocktaking::getId,YwStocktakingRecord::getStocktakingId)
                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
                .leftJoin(YwMaterial.class,YwMaterial::getId,YwStocktakingRecord::getMaterialId)
                .eq(Objects.nonNull(model.getStocktakingId()),YwStocktakingRecord::getStocktakingId,model.getStocktakingId())
                .and(StringUtils.isNotBlank(model.getMaterialCode()),i->i.like(YwMaterial::getCode,model.getMaterialCode()).or().like(YwMaterial::getName,model.getMaterialCode()))
                .eq(Objects.nonNull(model.getType()),YwStocktakingRecord::getType,model.getType())
                .eq(Objects.nonNull(model.getStatus()),YwStocktakingRecord::getStatus,model.getStatus());
        IPage iPage = ywStocktakingRecordMapper.selectJoinPage(page, YwStocktakingRecord.class,queryWrapper);
        return PageData.from(iPage);
    }
    @Override
@@ -155,4 +155,51 @@
        QueryWrapper<YwStocktakingRecord> wrapper = new QueryWrapper<>(ywStocktakingRecord);
        return ywStocktakingRecordMapper.selectCount(wrapper);
    }
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void takingData(YwStocktakingRecord ywStocktakingRecord) {
        if(Objects.isNull(ywStocktakingRecord)
            || Objects.isNull(ywStocktakingRecord.getId())
            || Objects.isNull(ywStocktakingRecord.getActStock())
            || ywStocktakingRecord.getActStock().compareTo(BigDecimal.ZERO) < 0
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        LoginUserInfo loginUserInfo = ywStocktakingRecord.getLoginUserInfo();
        YwStocktakingRecord model = ywStocktakingRecordMapper.selectById(ywStocktakingRecord.getId());
        if(Objects.nonNull(model)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        YwStocktaking ywStocktaking = ywStocktakingMapper.selectById(ywStocktakingRecord.getStocktakingId());
        if(Objects.isNull(ywStocktaking)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        if(!Constants.equalsInteger(loginUserInfo.getId(),ywStocktaking.getUserId())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非您的盘点单无法进行操作");
        }
        if(!Constants.equalsInteger(ywStocktaking.getStatus(),Constants.ONE)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"盘点订状态已流转,无法进行该操作");
        }
        if(ywStocktakingRecord.getActStock().compareTo(model.getStock())==Constants.ZERO){
            ywStocktakingRecord.setType(Constants.ZERO);
        }else if(ywStocktakingRecord.getActStock().compareTo(model.getStock())>Constants.ZERO){
            ywStocktakingRecord.setType(Constants.TWO);
        }else{
            ywStocktakingRecord.setType(Constants.ONE);
        }
        ywStocktakingRecordMapper.update(new UpdateWrapper<YwStocktakingRecord>().lambda()
                .set(YwStocktakingRecord::getStatus,Constants.ONE)
                .set(YwStocktakingRecord::getType,ywStocktakingRecord.getType())
                .set(YwStocktakingRecord::getActStock,ywStocktakingRecord.getActStock())
                .set(YwStocktakingRecord::getUserId,loginUserInfo.getId())
                .set(YwStocktakingRecord::getPlanDate, DateUtil.getCurrDateTime())
                .eq(YwStocktakingRecord::getId,ywStocktakingRecord.getId())
        );
    }
}
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwStocktakingServiceImpl.java
@@ -1,20 +1,38 @@
package com.doumee.service.business.impl;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.core.utils.redis.RedisUtil;
import com.doumee.dao.business.YwStockMapper;
import com.doumee.dao.business.YwStocktakingMapper;
import com.doumee.dao.business.model.YwStocktaking;
import com.doumee.dao.business.YwStocktakingRecordMapper;
import com.doumee.dao.business.YwWarehouseMapper;
import com.doumee.dao.business.model.*;
import com.doumee.service.business.YwStocktakingService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * 运维盘点信息表Service实现
@@ -27,15 +45,172 @@
    @Autowired
    private YwStocktakingMapper ywStocktakingMapper;
    @Autowired
    private YwStockMapper ywStockMapper;
    @Autowired
    private YwStocktakingRecordMapper ywStocktakingRecordMapper;
    @Autowired
    private YwWarehouseMapper ywWarehouseMapper;
    @Autowired
    private RedisTemplate<String, Object> redisTemplate;
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public Integer create(YwStocktaking ywStocktaking) {
        if(Objects.isNull(ywStocktaking)
                || StringUtils.isBlank(ywStocktaking.getName())
                || Objects.isNull(ywStocktaking.getPlanDate())
                || Objects.isNull(ywStocktaking.getWarehouseId())
                || Objects.isNull(ywStocktaking.getUserId())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        YwWarehouse ywWarehouse = ywWarehouseMapper.selectById(ywStocktaking.getWarehouseId());
        if(Objects.isNull(ywWarehouse)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到仓库数据");
        }
        //判断当前仓库当前日期是否存在盘点单
        if(ywStocktakingMapper.selectCount(new QueryWrapper<YwStocktaking>().lambda().eq(YwStocktaking::getIsdeleted,Constants.ZERO).eq(YwStocktaking::getStatus,Constants.ZERO)
                .eq(YwStocktaking::getWarehouseId,ywStocktaking.getWarehouseId()).apply(" DATE(PLAN_DATE) = '" + DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd") +"'" ))>0){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"["+DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd")+"]["+ywWarehouse.getName()+"]已有盘点单,不可重复发起盘点");
        }
        LoginUserInfo loginUserInfo = ywStocktaking.getLoginUserInfo();
        ywStocktaking.setCreator(loginUserInfo.getId());
        ywStocktaking.setCreateDate(new Date());
        ywStocktaking.setIsdeleted(Constants.ZERO);
        ywStocktaking.setStatus(Constants.ZERO);
        ywStocktaking.setCode(getNextCode());
        ywStocktakingMapper.insert(ywStocktaking);
        return ywStocktaking.getId();
    }
    @Override
    public void deleteById(Integer id) {
        ywStocktakingMapper.deleteById(id);
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void deleteById(Integer id, LoginUserInfo loginUserInfo) {
        YwStocktaking model = ywStocktakingMapper.selectById(id);
        if(Objects.isNull(model)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到盘点单数据");
        }
        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)||Constants.equalsInteger(model.getStatus(),Constants.THREE)){
            ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
                    .set(YwStocktaking::getIsdeleted,Constants.ONE)
                    .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
                    .eq(YwStocktaking::getId,id)
            );
        }else{
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"盘点单状态已流转,无法进行该操作");
        }
    }
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void cancelById(Integer id, LoginUserInfo loginUserInfo) {
        YwStocktaking model = ywStocktakingMapper.selectById(id);
        if(Objects.isNull(model)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到盘点单数据");
        }
        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)||Constants.equalsInteger(model.getStatus(),Constants.ONE)){
            ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
                    .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
                    .set(YwStocktaking::getCancelDate,DateUtil.getCurrDateTime())
                    .set(YwStocktaking::getCancelUserId,loginUserInfo.getId())
                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
                    .set(YwStocktaking::getStatus,Constants.THREE).eq(YwStocktaking::getId,id));
        }else{
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"盘点单状态已流转,无法进行该操作");
        }
    }
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void beginById(Integer id, LoginUserInfo loginUserInfo) {
        YwStocktaking model = ywStocktakingMapper.selectById(id);
        if(Objects.isNull(model)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到盘点单数据");
        }
        if(model.getPlanDate().getTime()<System.currentTimeMillis()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未到开始时间,无法进行该操作");
        }
        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)&&Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
            ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
                    .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
                    .set(YwStocktaking::getDealDate,DateUtil.getCurrDateTime())
                    .set(YwStocktaking::getDealUserId,loginUserInfo.getId())
                    .set(YwStocktaking::getEditor,loginUserInfo.getId())
                    .set(YwStocktaking::getStatus,Constants.ONE)
                    .eq(YwStocktaking::getId,model.getId()));
            //生成当前仓库下所有的资产信息
            List<YwStock> stockList = ywStockMapper.selectList(new QueryWrapper<YwStock>().lambda().eq(YwStock::getIsdeleted,Constants.ZERO).eq(YwStock::getWarehouseId,model.getWarehouseId()));
            if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(stockList)){
                List<YwStocktakingRecord> ywStocktakingRecordList = new ArrayList<>();
                for (YwStock ywStock:stockList) {
                    YwStocktakingRecord ywStocktakingRecord = new YwStocktakingRecord();
                    ywStocktakingRecord.setCreator(loginUserInfo.getId());
                    ywStocktakingRecord.setCreateDate(new Date());
                    ywStocktakingRecord.setIsdeleted(Constants.ZERO);
                    ywStocktakingRecord.setStatus(Constants.ZERO);
                    ywStocktakingRecord.setMaterialId(ywStock.getMaterialId());
                    ywStocktakingRecord.setStock(ywStock.getStock());
                    ywStocktakingRecord.setStocktakingId(model.getId());
                    ywStocktakingRecordList.add(ywStocktakingRecord);
                }
                ywStocktakingRecordMapper.insert(ywStocktakingRecordList);
            }
        }else{
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"盘点单状态已流转,无法进行该操作");
        }
    }
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public void finishById(Integer id, LoginUserInfo loginUserInfo) {
        YwStocktaking model = ywStocktakingMapper.selectById(id);
        if(Objects.isNull(model)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到盘点单数据");
        }
        if(!Constants.equalsInteger(model.getStatus(),Constants.ONE)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"盘点单状态已流转,无法进行该操作!");
        }
        if(!Constants.equalsInteger(loginUserInfo.getId(),model.getUserId())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非您的盘点单无法进行操作");
        }
        List<YwStocktakingRecord> recordList = ywStocktakingRecordMapper.selectList(new QueryWrapper<YwStocktakingRecord>().lambda()
                .eq(YwStocktakingRecord::getStocktakingId,id).eq(YwStocktakingRecord::getIsdeleted,Constants.ZERO));
        for (YwStocktakingRecord ywStocktakingRecord:recordList) {
            //提交时 未进行盘点的明细数据
            if(Constants.equalsInteger(ywStocktakingRecord.getStatus(),Constants.ZERO)){
                ywStocktakingRecordMapper.update(new UpdateWrapper<YwStocktakingRecord>().lambda()
                        .set(YwStocktakingRecord::getStatus,Constants.TWO)
                        .set(YwStocktakingRecord::getUserId,loginUserInfo.getId())
                        .eq(YwStocktakingRecord::getId,ywStocktakingRecord.getId())
                );
            }
            //查询库存信息 进行库存更新
            YwStock ywStock = ywStockMapper.selectOne(new QueryWrapper<YwStock>().lambda().eq(YwStock::getMaterialId,ywStocktakingRecord.getMaterialId())
                    .eq(YwStock::getWarehouseId,model.getWarehouseId()).eq(YwStock::getStock,ywStocktakingRecord.getStock()));
            if(Objects.isNull(ywStock)){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"库存信息异常,请联系管理员");
            }
            if(ywStocktakingRecord.getActStock().compareTo(BigDecimal.ZERO)==Constants.ZERO){
                ywStockMapper.deleteById(ywStock.getId());
            }else {
                ywStockMapper.update(new UpdateWrapper<YwStock>().lambda().set(YwStock::getStock,ywStocktakingRecord.getActStock()).eq(YwStock::getId,ywStock.getId()));
            }
        }
        ywStocktakingMapper.update(new UpdateWrapper<YwStocktaking>().lambda()
                .set(YwStocktaking::getEditDate,DateUtil.getCurrDateTime())
                .set(YwStocktaking::getDoneDate,DateUtil.getCurrDateTime())
                .set(YwStocktaking::getDoneUserId,loginUserInfo.getId())
                .set(YwStocktaking::getEditor,loginUserInfo.getId())
                .set(YwStocktaking::getStatus,Constants.TWO)
                .eq(YwStocktaking::getId,model.getId()));
    }
    @Override
@@ -54,6 +229,32 @@
    @Override
    public void updateById(YwStocktaking ywStocktaking) {
        if(Objects.isNull(ywStocktaking)
                || StringUtils.isBlank(ywStocktaking.getName())
                || Objects.isNull(ywStocktaking.getId())
                || Objects.isNull(ywStocktaking.getPlanDate())
                || Objects.isNull(ywStocktaking.getWarehouseId())
                || Objects.isNull(ywStocktaking.getUserId())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        YwStocktaking model = ywStocktakingMapper.selectById(ywStocktaking.getId());
        if(Objects.isNull(model)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到盘点单数据");
        }
        YwWarehouse ywWarehouse = ywWarehouseMapper.selectById(ywStocktaking.getWarehouseId());
        if(Objects.isNull(ywWarehouse)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到仓库数据");
        }
        //判断当前仓库当前日期是否存在盘点单
        if(ywStocktakingMapper.selectCount(new QueryWrapper<YwStocktaking>().lambda().ne(YwStocktaking::getId,ywStocktaking.getId()).eq(YwStocktaking::getIsdeleted,Constants.ZERO).eq(YwStocktaking::getStatus,Constants.ZERO)
                .eq(YwStocktaking::getWarehouseId,ywStocktaking.getWarehouseId()).apply(" DATE(PLAN_DATE) = '" + DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd") +"'" ))>0){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"["+DateUtil.formatDate(ywStocktaking.getPlanDate(),"yyyy-MM-dd")+"]["+ywWarehouse.getName()+"]已有盘点单,不可重复发起盘点");
        }
        LoginUserInfo loginUserInfo = ywStocktaking.getLoginUserInfo();
        ywStocktaking.setEditor(loginUserInfo.getId());
        ywStocktaking.setEditDate(new Date());
        ywStocktaking.setCode(null);
        ywStocktakingMapper.updateById(ywStocktaking);
    }
@@ -73,6 +274,31 @@
    }
    @Override
    public YwStocktaking getDetail(Integer id) {
        MPJLambdaWrapper<YwStocktaking> queryWrapper = new MPJLambdaWrapper<>();
        queryWrapper.selectAll(YwStocktaking.class)
                .select(" s.name ", YwStocktaking::getUserName)
                .select(" s1.name ",YwStocktaking::getCreateName)
                .selectAs(YwWarehouse::getName,YwStocktaking::getWarehouseName)
                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
                .leftJoin("system_user s on t.user_id = s.id")
                .leftJoin("system_user s1 on t.creator = s1.id")
                .eq(YwStocktaking::getId,id)
                .last("limit 1");
        YwStocktaking ywStocktaking = ywStocktakingMapper.selectOne(queryWrapper);
        List<YwStocktakingRecord> recordList = ywStocktakingRecordMapper.selectList(new QueryWrapper<YwStocktakingRecord>().lambda().eq(YwStocktakingRecord::getStocktakingId,id).eq(YwStocktakingRecord::getIsdeleted,Constants.ZERO));
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(recordList)){
            //合计盘点数据
            ywStocktaking.setFinishAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)).collect(Collectors.toList()).size());
            ywStocktaking.setUnFinishAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ZERO)).collect(Collectors.toList()).size());
            ywStocktaking.setEqualAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)&&Constants.equalsInteger(i.getType(),Constants.ZERO)).collect(Collectors.toList()).size());
            ywStocktaking.setLossAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)&&Constants.equalsInteger(i.getType(),Constants.ONE)).collect(Collectors.toList()).size());
            ywStocktaking.setProfitAmount(recordList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.ONE)&&Constants.equalsInteger(i.getType(),Constants.TWO)).collect(Collectors.toList()).size());
        }
        return ywStocktaking;
    }
    @Override
    public YwStocktaking findOne(YwStocktaking ywStocktaking) {
        QueryWrapper<YwStocktaking> wrapper = new QueryWrapper<>(ywStocktaking);
        return ywStocktakingMapper.selectOne(wrapper);
@@ -87,103 +313,25 @@
    @Override
    public PageData<YwStocktaking> findPage(PageWrap<YwStocktaking> pageWrap) {
        IPage<YwStocktaking> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<YwStocktaking> queryWrapper = new QueryWrapper<>();
        MPJLambdaWrapper<YwStocktaking> queryWrapper = new MPJLambdaWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        if (pageWrap.getModel().getId() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getId, pageWrap.getModel().getId());
        }
        if (pageWrap.getModel().getCreator() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getCreator, pageWrap.getModel().getCreator());
        }
        if (pageWrap.getModel().getCreateDate() != null) {
            queryWrapper.lambda().ge(YwStocktaking::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
            queryWrapper.lambda().le(YwStocktaking::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
        }
        if (pageWrap.getModel().getEditor() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getEditor, pageWrap.getModel().getEditor());
        }
        if (pageWrap.getModel().getEditDate() != null) {
            queryWrapper.lambda().ge(YwStocktaking::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
            queryWrapper.lambda().le(YwStocktaking::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
        }
        if (pageWrap.getModel().getIsdeleted() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getIsdeleted, pageWrap.getModel().getIsdeleted());
        }
        if (pageWrap.getModel().getPosition() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getPosition, pageWrap.getModel().getPosition());
        }
        if (pageWrap.getModel().getRemark() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getRemark, pageWrap.getModel().getRemark());
        }
        if (pageWrap.getModel().getStatus() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getStatus, pageWrap.getModel().getStatus());
        }
        if (pageWrap.getModel().getUserId() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getUserId, pageWrap.getModel().getUserId());
        }
        if (pageWrap.getModel().getPlanDate() != null) {
            queryWrapper.lambda().ge(YwStocktaking::getPlanDate, Utils.Date.getStart(pageWrap.getModel().getPlanDate()));
            queryWrapper.lambda().le(YwStocktaking::getPlanDate, Utils.Date.getEnd(pageWrap.getModel().getPlanDate()));
        }
        if (pageWrap.getModel().getCode() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getCode, pageWrap.getModel().getCode());
        }
        if (pageWrap.getModel().getDealUserId() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getDealUserId, pageWrap.getModel().getDealUserId());
        }
        if (pageWrap.getModel().getDealDate() != null) {
            queryWrapper.lambda().ge(YwStocktaking::getDealDate, Utils.Date.getStart(pageWrap.getModel().getDealDate()));
            queryWrapper.lambda().le(YwStocktaking::getDealDate, Utils.Date.getEnd(pageWrap.getModel().getDealDate()));
        }
        if (pageWrap.getModel().getDealInfo() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getDealInfo, pageWrap.getModel().getDealInfo());
        }
        if (pageWrap.getModel().getDoneNum() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getDoneNum, pageWrap.getModel().getDoneNum());
        }
        if (pageWrap.getModel().getWaitNum() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getWaitNum, pageWrap.getModel().getWaitNum());
        }
        if (pageWrap.getModel().getTotalNum() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getTotalNum, pageWrap.getModel().getTotalNum());
        }
        if (pageWrap.getModel().getProfitNum() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getProfitNum, pageWrap.getModel().getProfitNum());
        }
        if (pageWrap.getModel().getLossNum() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getLossNum, pageWrap.getModel().getLossNum());
        }
        if (pageWrap.getModel().getEqualNum() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getEqualNum, pageWrap.getModel().getEqualNum());
        }
        if (pageWrap.getModel().getDoneUserId() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getDoneUserId, pageWrap.getModel().getDoneUserId());
        }
        if (pageWrap.getModel().getDoneDate() != null) {
            queryWrapper.lambda().ge(YwStocktaking::getDoneDate, Utils.Date.getStart(pageWrap.getModel().getDoneDate()));
            queryWrapper.lambda().le(YwStocktaking::getDoneDate, Utils.Date.getEnd(pageWrap.getModel().getDoneDate()));
        }
        if (pageWrap.getModel().getDoneInfo() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getDoneInfo, pageWrap.getModel().getDoneInfo());
        }
        if (pageWrap.getModel().getCancelUserId() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getCancelUserId, pageWrap.getModel().getCancelUserId());
        }
        if (pageWrap.getModel().getCancelDate() != null) {
            queryWrapper.lambda().ge(YwStocktaking::getCancelDate, Utils.Date.getStart(pageWrap.getModel().getCancelDate()));
            queryWrapper.lambda().le(YwStocktaking::getCancelDate, Utils.Date.getEnd(pageWrap.getModel().getCancelDate()));
        }
        if (pageWrap.getModel().getCancelInfo() != null) {
            queryWrapper.lambda().eq(YwStocktaking::getCancelInfo, pageWrap.getModel().getCancelInfo());
        }
        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
                queryWrapper.orderByDesc(sortData.getProperty());
            } else {
                queryWrapper.orderByAsc(sortData.getProperty());
            }
        }
        return PageData.from(ywStocktakingMapper.selectPage(page, queryWrapper));
        YwStocktaking model = pageWrap.getModel();
        queryWrapper.selectAll(YwStocktaking.class)
                .select(" s.name ", YwStocktaking::getUserName)
                .select(" s1.name ",YwStocktaking::getCreateName)
                .selectAs(YwWarehouse::getName,YwStocktaking::getWarehouseName)
                .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwStocktaking::getWarehouseId)
                .leftJoin("system_user s on t.user_id = s.id")
                .leftJoin("system_user s1 on t.creator = s1.id")
                .eq(YwStocktaking::getIsdeleted,Constants.ZERO)
                .like(StringUtils.isNotBlank(model.getName()),YwStocktaking::getName,model.getName())
                .eq(Objects.nonNull(model.getStatus()),YwStocktaking::getStatus,model.getStatus())
                .orderByAsc(YwStocktaking::getStatus)
                .orderByDesc(YwStocktaking::getPlanDate)
        ;
        IPage iPage = ywStocktakingMapper.selectJoinPage(page, YwStocktaking.class,queryWrapper);
        return PageData.from(iPage);
    }
    @Override
@@ -191,4 +339,19 @@
        QueryWrapper<YwStocktaking> wrapper = new QueryWrapper<>(ywStocktaking);
        return ywStocktakingMapper.selectCount(wrapper);
    }
    public synchronized String  getNextCode(){
        String prefix =  "PD-" + DateUtil.getDate(new Date(),"yyyyMMdd") +"-";
        Integer countNum  = RedisUtil.getObject(redisTemplate,
                Constants.RedisKeys.COM_OUTBOUND_TAKING_KEY,
                Integer.class);
        countNum = Constants.formatIntegerNum(countNum)+1;
        //更新缓存
        RedisUtil.addObject(redisTemplate, Constants.RedisKeys.COM_OUTBOUND_TAKING_KEY,countNum);
        String nextIndex =Integer.toString( countNum );
        return prefix + org.apache.commons.lang3.StringUtils.leftPad(nextIndex,4,"0");
    }
}