| | |
| | | ## 补贴é
ç½® |
| | | drop table if exists subsidy_configuration; |
| | | create table subsidy_configuration |
| | | ( |
| | |
| | | add night_days decimal(16, 4) default 0 not null comment 'å¤ç天æ°', |
| | | add meal_amount decimal(16, 4) default 0 not null comment 'é¤è¡¥', |
| | | add night_amount decimal(16, 4) default 0 not null comment 'å¤ç补贴'; |
| | | |
| | | ## ç产åå |
| | | drop table if exists manufacturer; |
| | | create table manufacturer |
| | | ( |
| | | id bigint auto_increment |
| | | primary key, |
| | | name varchar(255) not null default '' comment 'åååç§°', |
| | | taxpayer_identification_num varchar(128) not null default '' comment '纳ç¨äººè¯å«å·', |
| | | company_address varchar(255) not null default '' comment 'ååå°å', |
| | | type varchar(25) not null default '' comment 'ååç±»å', |
| | | company_phone varchar(64) not null default '' comment 'ååçµè¯', |
| | | bank_account_name varchar(128) not null default '' comment 'é¶è¡è´¦æ·åç§°', |
| | | bank_account_num varchar(128) not null default '' comment 'é¶è¡è´¦æ·å·ç ', |
| | | contact_user_name varchar(255) not null default '' comment 'è系人å§å', |
| | | contact_user_phone varchar(128) not null default '' comment 'è系人çµè¯', |
| | | maintain_user_id bigint not null default 0 comment 'ç»´æ¤äººID', |
| | | maintain_time datetime null comment 'ç»´æ¤æ¶é´', |
| | | create_time datetime null comment 'å建æ¶é´', |
| | | create_user bigint not null default 0 comment 'å建人ID', |
| | | update_time datetime null comment 'æ´æ°æ¶é´', |
| | | update_user bigint not null default 0 comment 'æ´æ°äººID', |
| | | tenant_id bigint not null default 0 comment 'ç§æ·ID', |
| | | is_white bigint not null default 0 comment 'æ¯å¦ç½åå' |
| | | ); |
| | | |
| | | alter table stock_inventory |
| | | add manufacturer_id bigint not null default 0 comment 'åå®¶id', |
| | | add source varchar(255) not null default '' comment 'æ¥æº'; |
| | | alter table stock_in_record |
| | | add manufacturer_id bigint not null default 0 comment 'åå®¶id', |
| | | add source varchar(255) not null default '' comment 'æ¥æº'; |
| | | alter table stock_uninventory |
| | | add manufacturer_id bigint not null default 0 comment 'åå®¶id', |
| | | add source varchar(255) not null default '' comment 'æ¥æº'; |
| | |
| | | STOCK_UNINVENTORY("stock_uninventory"), |
| | | STOCK_INVENTORY("stock_inventory"), |
| | | STOCK_IN_RECORD("stock_in_record"), |
| | | MANUFACTURER("manufacturer"), |
| | | // Staff |
| | | STAFF_WORK_EXPERIENCE("staff_work_experience"), |
| | | STAFF_SALARY_MAIN("staff_salary_main"), |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.controller; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.R; |
| | | import com.ruoyi.stock.dto.ManufacturerDto; |
| | | import com.ruoyi.stock.execl.ManufacturerExcelDto; |
| | | import com.ruoyi.stock.pojo.Manufacturer; |
| | | import com.ruoyi.stock.service.ManufacturerService; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * åå®¶å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-28 09:52:35 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/stock/manufacturer") |
| | | @AllArgsConstructor |
| | | @Tag(name = "å家管ç") |
| | | public class ManufacturerController { |
| | | |
| | | private ManufacturerService manufacturerService; |
| | | |
| | | /** |
| | | * åå®¶æ°å¢ |
| | | * @param manufacturer |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | @Log(title = "åå®¶-æ°å¢", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢åå®¶") |
| | | public R add(@RequestBody Manufacturer manufacturer) { |
| | | manufacturerService.saveManufacturer(manufacturer); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * åå®¶å é¤ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | @Log(title = "åå®¶-å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤åå®¶") |
| | | public R delManufacturer(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)){ |
| | | return R.fail("è¯·éæ©è³å°ä¸æ¡æ°æ®"); |
| | | } |
| | | manufacturerService.delManufacturer(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å家详æ
|
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/{id}") |
| | | @Log(title = "åå®¶-详æ
", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "å家详æ
") |
| | | public R manufacturerDetail(@PathVariable("id") Long id) { |
| | | return R.ok(manufacturerService.manufacturerDetail(id)); |
| | | } |
| | | |
| | | /** |
| | | * åå®¶ä¿®æ¹ |
| | | * @param manufacturer |
| | | * @return |
| | | */ |
| | | @PostMapping("/update") |
| | | @Log(title = "åå®¶-ä¿®æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹åå®¶") |
| | | public R update(@RequestBody Manufacturer manufacturer) { |
| | | manufacturerService.manufacturerUpdate(manufacturer); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * å家管çå页æ¥è¯¢ |
| | | * @param page |
| | | * @param manufacturerDto |
| | | * @return |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @Log(title = "åå®¶-å页æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "åå®¶å页æ¥è¯¢") |
| | | public R manufacturerListPage(Page page, ManufacturerDto manufacturerDto) { |
| | | return R.ok(manufacturerService.manufacturerListPage(page, manufacturerDto)); |
| | | } |
| | | |
| | | /** |
| | | * åå®¶å¯¼åº |
| | | * @param response |
| | | * @param manufacturerDto |
| | | */ |
| | | @PostMapping("/export") |
| | | @Log(title = "åå®¶-导åº", businessType = BusinessType.EXPORT) |
| | | @Operation(summary = "å家导åº") |
| | | public void manufacturerExport(HttpServletResponse response, ManufacturerDto manufacturerDto) { |
| | | manufacturerService.manufacturerExport(response, manufacturerDto); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æ¨¡æ¿ |
| | | * @param response |
| | | */ |
| | | @PostMapping("/downloadTemplate") |
| | | @Log(title = "åå®¶-ä¸è½½æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | @Operation(summary = "ä¸è½½å家模æ¿") |
| | | public void downloadTemplate(HttpServletResponse response) { |
| | | ExcelUtil<ManufacturerExcelDto> util = new ExcelUtil<>(ManufacturerExcelDto.class); |
| | | util.importTemplateExcel(response, "åå®¶æ¡£æ¡æ¨¡æ¿"); |
| | | } |
| | | |
| | | /** |
| | | * å家导å
¥ |
| | | */ |
| | | @PostMapping("/import") |
| | | @Log(title = "åå®¶-导å
¥", businessType = BusinessType.IMPORT) |
| | | @Operation(summary = "导å
¥åå®¶") |
| | | public R importData(MultipartFile file) { |
| | | return manufacturerService.importData(file); |
| | | } |
| | | |
| | | /** |
| | | * åå®¶é项æ¥å£ |
| | | * @return |
| | | */ |
| | | @GetMapping("/getOptions") |
| | | @Log(title = "åå®¶-é项æ¥å£", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "è·ååå®¶é项") |
| | | public R getOptions() { |
| | | return R.ok(manufacturerService.list()); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.dto; |
| | | |
| | | import com.ruoyi.stock.pojo.Manufacturer; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ManufacturerDto extends Manufacturer { |
| | | |
| | | @Schema(description = "ç»´æ¤äººååç§°") |
| | | private String maintainUserName; |
| | | } |
| | |
| | | |
| | | @Schema(description = "产åid") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "åæ ¼åºåæ¥æº") |
| | | private String qualifiedSource; |
| | | |
| | | @Schema(description = "åæ ¼åºåæ¥æºææ¬") |
| | | private String qualifiedSourceText; |
| | | |
| | | @Schema(description = "ä¸åæ ¼åºåæ¥æº") |
| | | private String unQualifiedSource; |
| | | |
| | | @Schema(description = "ä¸åæ ¼åºåæ¥æºææ¬") |
| | | private String unQualifiedSourceText; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.enums; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.EnumValue; |
| | | import com.fasterxml.jackson.annotation.JsonCreator; |
| | | import com.ruoyi.common.enums.BaseEnum; |
| | | import lombok.Getter; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author buhuazhen |
| | | * @date 2026/3/9 |
| | | * @email 3038525872@qq.com |
| | | */ |
| | | @Getter |
| | | public enum StockInventorySourceEnum implements BaseEnum<String>, Serializable { |
| | | PURCHASE_RECEIPT("purchaseReceipt", "éè´å
¥åº"), |
| | | PRODUCTION_RECEIPT("productionReceipt", "ç产å
¥åº"), |
| | | OUTSOURCED_RECEIPT("outsourcedReceipt", "å¤åå
¥åº"), |
| | | REPAIR_RECEIPT("repairReceipt", "ä¿®å¤å
¥åº"), |
| | | PROD_GENERATED("prodGenerated", "ç产产ç"), |
| | | TRANS_GENERATED("transGenerated", "è¿è¾äº§ç"), |
| | | CUTTING_GENERATED("cuttingGenerated", "è£åªäº§ç"), |
| | | CUSTOM("custom", "èªå®ä¹"); |
| | | |
| | | @EnumValue |
| | | private final String code; |
| | | |
| | | private final String value; |
| | | |
| | | StockInventorySourceEnum(String code, String value) { |
| | | this.code = code; |
| | | this.value = value; |
| | | } |
| | | |
| | | @JsonCreator |
| | | public static StockInventorySourceEnum fromCode(String code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | for (StockInventorySourceEnum e : StockInventorySourceEnum.values()) { |
| | | if (e.getCode().equals(code)) { |
| | | return e; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.execl; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ManufacturerExcelDto { |
| | | |
| | | @Excel(name = "åå®¶åç§°") |
| | | private String name; |
| | | |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNum; |
| | | |
| | | @Excel(name = "å
¬å¸å°å") |
| | | private String companyAddress; |
| | | |
| | | @Excel(name = "å
¬å¸çµè¯") |
| | | private String companyPhone; |
| | | |
| | | @Excel(name = "弿·è¡") |
| | | private String bankAccountName; |
| | | |
| | | @Excel(name = "è´¦å·") |
| | | private String bankAccountNum; |
| | | |
| | | @Excel(name = "è系人") |
| | | private String contactUserName; |
| | | |
| | | @Excel(name = "èç³»çµè¯") |
| | | private String contactUserPhone; |
| | | |
| | | @Excel(name = "ç»´æ¤äºº") |
| | | private String maintainUserName; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.SupplierManageDto; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.stock.dto.ManufacturerDto; |
| | | import com.ruoyi.stock.execl.ManufacturerExcelDto; |
| | | import com.ruoyi.stock.pojo.Manufacturer; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-28 09:52:35 |
| | | */ |
| | | @Mapper |
| | | public interface ManufacturerMapper extends BaseMapper<Manufacturer> { |
| | | IPage<Manufacturer> manufacturerListPage(Page page, @Param("manufacturerDto") ManufacturerDto manufacturerDto); |
| | | |
| | | List<ManufacturerExcelDto> manufacturerExportList(@Param("manufacturerDto") ManufacturerDto manufacturerDto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-28 09:52:35 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @ToString |
| | | @TableName("manufacturer") |
| | | @ApiModel(value = "Manufacturer对象", description = "") |
| | | public class Manufacturer implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * åå®¶åç§° |
| | | */ |
| | | @ApiModelProperty("åå®¶åç§°") |
| | | @Excel(name = "åå®¶åç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * 纳ç¨äººè¯å«å· |
| | | */ |
| | | @ApiModelProperty("纳ç¨äººè¯å«å·") |
| | | @Excel(name = "纳ç¨äººè¯å«å·") |
| | | private String taxpayerIdentificationNum; |
| | | |
| | | /** |
| | | * åå®¶å°å |
| | | */ |
| | | @ApiModelProperty("åå®¶å°å") |
| | | @Excel(name = "å
¬å¸å°å") |
| | | private String companyAddress; |
| | | |
| | | /** |
| | | * åå®¶ç±»å |
| | | */ |
| | | @ApiModelProperty("åå®¶ç±»å") |
| | | private String type; |
| | | |
| | | /** |
| | | * åå®¶çµè¯ |
| | | */ |
| | | @ApiModelProperty("å
¬å¸çµè¯") |
| | | @Excel(name = "å
¬å¸çµè¯") |
| | | private String companyPhone; |
| | | |
| | | /** |
| | | * é¶è¡è´¦æ·åç§° |
| | | */ |
| | | @ApiModelProperty("é¶è¡è´¦æ·åç§°") |
| | | @Excel(name = "弿·è¡") |
| | | private String bankAccountName; |
| | | |
| | | /** |
| | | * é¶è¡è´¦æ·å·ç |
| | | */ |
| | | @ApiModelProperty("é¶è¡è´¦æ·å·ç ") |
| | | @Excel(name = "è´¦å·") |
| | | private String bankAccountNum; |
| | | |
| | | /** |
| | | * è系人å§å |
| | | */ |
| | | @ApiModelProperty("è系人å§å") |
| | | @Excel(name = "è系人") |
| | | private String contactUserName; |
| | | |
| | | /** |
| | | * è系人çµè¯ |
| | | */ |
| | | @ApiModelProperty("è系人çµè¯") |
| | | @Excel(name = "èç³»çµè¯") |
| | | private String contactUserPhone; |
| | | |
| | | /** |
| | | * ç»´æ¤äººID |
| | | */ |
| | | @ApiModelProperty("ç»´æ¤äººID") |
| | | @Excel(name = "ç»´æ¤äºº") |
| | | private Long maintainUserId; |
| | | |
| | | /** |
| | | * ç»´æ¤æ¶é´ |
| | | */ |
| | | @ApiModelProperty("ç»´æ¤æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate maintainTime; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | | */ |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * å建人ID |
| | | */ |
| | | @ApiModelProperty("å建人ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | /** |
| | | * æ´æ°æ¶é´ |
| | | */ |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | /** |
| | | * æ´æ°äººID |
| | | */ |
| | | @ApiModelProperty("æ´æ°äººID") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @ApiModelProperty("ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | /** |
| | | * æ¯å¦ç½åå |
| | | */ |
| | | @ApiModelProperty("æ¯å¦ç½åå") |
| | | @Excel(name = "æ¯å¦ç½åå") |
| | | private Long isWhite; |
| | | } |
| | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "åå®¶ID") |
| | | private Long manufacturerId; |
| | | |
| | | @Schema(description = "æ¥æº") |
| | | private String source; |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "ååid") |
| | | private Long manufacturerId; |
| | | |
| | | @Schema(description = "æ¥æº") |
| | | private String source; |
| | | } |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "åå®¶ID") |
| | | private Long manufacturerId; |
| | | |
| | | @Schema(description = "æ¥æº") |
| | | private String source; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service; |
| | | |
| | | 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.stock.dto.ManufacturerDto; |
| | | import com.ruoyi.stock.pojo.Manufacturer; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * ååæå¡æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-28 09:52:35 |
| | | */ |
| | | public interface ManufacturerService extends IService<Manufacturer> { |
| | | |
| | | /** |
| | | * ååæ°å¢ |
| | | * @param manufacturer |
| | | */ |
| | | void saveManufacturer(Manufacturer manufacturer); |
| | | |
| | | /** |
| | | * ååå é¤ |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | int delManufacturer(List<Long> ids); |
| | | |
| | | /** |
| | | * åå详æ
|
| | | * @param id |
| | | * @return |
| | | */ |
| | | Manufacturer manufacturerDetail(Long id); |
| | | |
| | | /** |
| | | * ååä¿®æ¹ |
| | | * @param manufacturer |
| | | * @return |
| | | */ |
| | | int manufacturerUpdate(Manufacturer manufacturer); |
| | | |
| | | /** |
| | | * ååå页æ¥è¯¢ |
| | | * @param page |
| | | * @param manufacturerDto |
| | | * @return |
| | | */ |
| | | IPage<Manufacturer> manufacturerListPage(Page page, ManufacturerDto manufacturerDto); |
| | | |
| | | /** |
| | | * ååå¯¼åº |
| | | * @param response |
| | | * @param manufacturerDto |
| | | */ |
| | | void manufacturerExport(HttpServletResponse response, ManufacturerDto manufacturerDto); |
| | | |
| | | /** |
| | | * åå导å
¥ |
| | | * @param file |
| | | * @return |
| | | */ |
| | | R importData(MultipartFile file); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.stock.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.excel.SupplierManageExcelDto; |
| | | import com.ruoyi.basic.pojo.SupplierManage; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | 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.stock.dto.ManufacturerDto; |
| | | import com.ruoyi.stock.execl.ManufacturerExcelDto; |
| | | import com.ruoyi.stock.mapper.ManufacturerMapper; |
| | | import com.ruoyi.stock.mapper.StockInventoryMapper; |
| | | import com.ruoyi.stock.pojo.Manufacturer; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.service.ManufacturerService; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * ååæå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author è¯å¯¼è½¯ä»¶ï¼æ±èï¼æéå
¬å¸ |
| | | * @since 2026-05-28 09:52:35 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ManufacturerServiceImpl extends ServiceImpl<ManufacturerMapper, Manufacturer> implements ManufacturerService { |
| | | |
| | | private final StockInventoryMapper stockInventoryMapper; |
| | | private final ManufacturerMapper manufacturerMapper; |
| | | private final SysUserMapper sysUserMapper; |
| | | |
| | | /** |
| | | * ååæ°å¢ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public void saveManufacturer(Manufacturer manufacturer) { |
| | | LambdaQueryWrapper<Manufacturer> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Manufacturer::getName,manufacturer.getName()); |
| | | if (baseMapper.selectCount(queryWrapper) > 0) { |
| | | throw new RuntimeException("åå®¶å·²åå¨"); |
| | | } |
| | | |
| | | baseMapper.insert(manufacturer); |
| | | } |
| | | |
| | | /** |
| | | * ååå é¤ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int delManufacturer(List<Long> ids) { |
| | | // æ¹éæ£æ¥æ¯å¦å
³èåºå |
| | | LambdaQueryWrapper<StockInventory> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(StockInventory::getManufacturerId, ids); |
| | | List<StockInventory> inventoryList = stockInventoryMapper.selectList(queryWrapper); |
| | | |
| | | if (!inventoryList.isEmpty()) { |
| | | throw new RuntimeException("ååå·²å
³èåºåï¼æ æ³å é¤"); |
| | | } |
| | | |
| | | return baseMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * åå详æ
|
| | | */ |
| | | @Override |
| | | public Manufacturer manufacturerDetail(Long id) { |
| | | return baseMapper.selectById(id); |
| | | } |
| | | |
| | | /** |
| | | * ååä¿®æ¹ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int manufacturerUpdate(Manufacturer manufacturer) { |
| | | return baseMapper.updateById(manufacturer); |
| | | } |
| | | |
| | | /** |
| | | * ååå页æ¥è¯¢ |
| | | */ |
| | | @Override |
| | | public IPage<Manufacturer> manufacturerListPage(Page page, ManufacturerDto manufacturerDto) { |
| | | return manufacturerMapper.manufacturerListPage(page,manufacturerDto); |
| | | } |
| | | |
| | | /** |
| | | * ååå¯¼åº |
| | | */ |
| | | @Override |
| | | public void manufacturerExport(HttpServletResponse response, ManufacturerDto manufacturerDto) { |
| | | List<ManufacturerExcelDto> list = manufacturerMapper.manufacturerExportList(manufacturerDto); |
| | | ExcelUtil<ManufacturerExcelDto> util = new ExcelUtil<>(ManufacturerExcelDto.class); |
| | | util.exportExcel(response, list, "åå®¶æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * åå导å
¥ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public R importData(MultipartFile file) { |
| | | try { |
| | | ExcelUtil<ManufacturerExcelDto> util = new ExcelUtil<>(ManufacturerExcelDto.class); |
| | | List<ManufacturerExcelDto> list = util.importExcel(file.getInputStream()); |
| | | ArrayList<Manufacturer> manufacturers = new ArrayList<>(); |
| | | list.stream().forEach(dto -> { |
| | | Manufacturer manufacturer = new Manufacturer(); |
| | | BeanUtils.copyProperties(dto, manufacturer); |
| | | manufacturer.setMaintainTime(LocalDate.now()); |
| | | |
| | | // æ£æ¥åå®¶åç§°æ¯å¦éå¤ |
| | | LambdaQueryWrapper<Manufacturer> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(Manufacturer::getName, manufacturer.getName()); |
| | | if (baseMapper.selectCount(queryWrapper) > 0) { |
| | | throw new RuntimeException("åå®¶åç§°å·²åå¨: " + manufacturer.getName()); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(dto.getMaintainUserName())) { |
| | | manufacturer.setMaintainUserId(SecurityUtils.getLoginUser().getUser().getUserId()); |
| | | } else { |
| | | SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getNickName, dto.getMaintainUserName())); |
| | | if (sysUser == null) { |
| | | throw new RuntimeException("ç»´æ¤äººä¸åå¨: " + dto.getMaintainUserName()); |
| | | } |
| | | manufacturer.setMaintainUserId(sysUser.getUserId()); |
| | | } |
| | | manufacturers.add(manufacturer); |
| | | }); |
| | | this.saveOrUpdateBatch(manufacturers); |
| | | return R.ok("导å
¥æå"); |
| | | } catch (Exception e) { |
| | | log.error("导å
¥å¤±è´¥", e); |
| | | return R.fail("导å
¥å¤±è´¥: " + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.jspecify.annotations.NonNull; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | if ("0".equals(stockInRecord.getType())) { |
| | | // åæ ¼å
¥åº -> å
æ¥åºåï¼åå¨åæ´æ°ï¼ä¸åå¨åæ°å¢ |
| | | StockInventory stockInventory = getStockInventory(stockInRecord.getProductModelId(), stockInRecord.getBatchNo()); |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setProductModelId(stockInRecord.getProductModelId()); |
| | | stockInventoryDto.setBatchNo(stockInRecord.getBatchNo()); |
| | | stockInventoryDto.setQualitity(stockInRecord.getStockInNum()); |
| | | stockInventoryDto.setRemark(stockInRecord.getRemark()); |
| | | StockInventoryDto stockInventoryDto = getStockInventoryDto(stockInRecord); |
| | | if (stockInventory == null) { |
| | | stockInventoryMapper.insert(new StockInventory() {{ |
| | | setProductModelId(stockInRecord.getProductModelId()); |
| | |
| | | setBatchNo(stockInRecord.getBatchNo()); |
| | | setRemark(stockInRecord.getRemark()); |
| | | setWarnNum(stockInRecord.getWarnNum()); |
| | | setManufacturerId(stockInRecord.getManufacturerId()); |
| | | setSource(stockInRecord.getSource()); |
| | | setVersion(1); |
| | | }}); |
| | | } else { |
| | |
| | | stockUninventoryDto.setBatchNo(stockInRecord.getBatchNo()); |
| | | stockUninventoryDto.setQualitity(stockInRecord.getStockInNum()); |
| | | stockUninventoryDto.setRemark(stockInRecord.getRemark()); |
| | | stockUninventoryDto.setManufacturerId(stockInRecord.getManufacturerId()); |
| | | stockUninventoryDto.setSource(stockInRecord.getSource()); |
| | | if (stockUninventory == null) { |
| | | stockUninventoryMapper.insert(new StockUninventory() {{ |
| | | setProductModelId(stockInRecord.getProductModelId()); |
| | | setQualitity(stockInRecord.getStockInNum()); |
| | | setBatchNo(stockInRecord.getBatchNo()); |
| | | setRemark(stockInRecord.getRemark()); |
| | | setManufacturerId(stockInRecord.getManufacturerId()); |
| | | setSource(stockInRecord.getSource()); |
| | | setVersion(1); |
| | | }}); |
| | | } else { |
| | |
| | | return ids.size(); |
| | | } |
| | | |
| | | private static @NonNull StockInventoryDto getStockInventoryDto(StockInRecord stockInRecord) { |
| | | StockInventoryDto stockInventoryDto = new StockInventoryDto(); |
| | | stockInventoryDto.setProductModelId(stockInRecord.getProductModelId()); |
| | | stockInventoryDto.setBatchNo(stockInRecord.getBatchNo()); |
| | | stockInventoryDto.setQualitity(stockInRecord.getStockInNum()); |
| | | stockInventoryDto.setRemark(stockInRecord.getRemark()); |
| | | stockInventoryDto.setManufacturerId(stockInRecord.getManufacturerId()); |
| | | stockInventoryDto.setSource(stockInRecord.getSource()); |
| | | return stockInventoryDto; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int batchReAudit(List<Long> ids) { |
| | |
| | | import com.ruoyi.basic.pojo.ProductModel; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.stock.enums.StockInventorySourceEnum; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> pageListCombinedStockInventory(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.pageListCombinedStockInventory(page, stockInventoryDto); |
| | | IPage<StockInventoryDto> result = stockInventoryMapper.pageListCombinedStockInventory(page, stockInventoryDto); |
| | | // è½¬æ¢æ¥æºç¼ç ä¸ºæ¥æºåç§° |
| | | for (StockInventoryDto dto : result.getRecords()) { |
| | | // åæ ¼åºåæ¥æº |
| | | if (StringUtils.isNotBlank(dto.getQualifiedSource())) { |
| | | StockInventorySourceEnum qualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getQualifiedSource()); |
| | | if (qualifiedSourceEnum != null) { |
| | | dto.setQualifiedSourceText(qualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | // ä¸åæ ¼åºåæ¥æº |
| | | if (StringUtils.isNotBlank(dto.getUnQualifiedSource())) { |
| | | StockInventorySourceEnum unQualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getUnQualifiedSource()); |
| | | if (unQualifiedSourceEnum != null) { |
| | | dto.setUnQualifiedSourceText(unQualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | //å
¥åºè°ç¨ |
| | |
| | | stockInRecordDto.setType("0"); |
| | | stockInRecordDto.setRemark(stockInventoryDto.getRemark()); |
| | | stockInRecordDto.setWarnNum(stockInventoryDto.getWarnNum()); |
| | | stockInRecordDto.setManufacturerId(stockInventoryDto.getManufacturerId()); |
| | | stockInRecordDto.setSource(stockInventoryDto.getSource()); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | return true; |
| | | } |
| | |
| | | |
| | | @Override |
| | | public IPage<StockInventoryDto> getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) { |
| | | return stockInventoryMapper.getBatchNoQty(page, stockInventoryDto); |
| | | IPage<StockInventoryDto> resultPage = stockInventoryMapper.getBatchNoQty(page, stockInventoryDto); |
| | | |
| | | // éåç»æï¼è®¾ç½®æ¥æºä¸æå |
| | | resultPage.getRecords().forEach(dto -> { |
| | | // è®¾ç½®åæ ¼åºåæ¥æºä¸æå |
| | | if (StringUtils.isNotEmpty(dto.getQualifiedSource())) { |
| | | System.out.println("åæ ¼åºåæ¥æºï¼" + dto.getQualifiedSource()); |
| | | StockInventorySourceEnum qualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getQualifiedSource()); |
| | | if (qualifiedSourceEnum != null) { |
| | | dto.setQualifiedSourceText(qualifiedSourceEnum.getValue()); |
| | | System.out.println("åæ ¼åºåæ¥æºå¼ï¼" + qualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | |
| | | // 设置ä¸åæ ¼åºåæ¥æºä¸æå |
| | | if (StringUtils.isNotEmpty(dto.getUnQualifiedSource())) { |
| | | StockInventorySourceEnum unQualifiedSourceEnum = StockInventorySourceEnum.fromCode(dto.getUnQualifiedSource()); |
| | | if (unQualifiedSourceEnum != null) { |
| | | dto.setUnQualifiedSourceText(unQualifiedSourceEnum.getValue()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return resultPage; |
| | | } |
| | | } |
| | |
| | | stockInRecordDto.setBatchNo(stockUninventoryDto.getBatchNo()); |
| | | stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockInRecordDto.setType("1"); |
| | | stockInRecordDto.setManufacturerId(stockUninventoryDto.getManufacturerId()); |
| | | stockInRecordDto.setSource(stockUninventoryDto.getSource()); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | //审æ¹åæ·»å |
| | | return 1; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.stock.mapper.ManufacturerMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.stock.pojo.Manufacturer"> |
| | | <id column="id" property="id" /> |
| | | <result column="name" property="name" /> |
| | | <result column="taxpayer_identification_num" property="taxpayerIdentificationNum" /> |
| | | <result column="company_address" property="companyAddress" /> |
| | | <result column="type" property="type" /> |
| | | <result column="company_phone" property="companyPhone" /> |
| | | <result column="bank_account_name" property="bankAccountName" /> |
| | | <result column="bank_account_num" property="bankAccountNum" /> |
| | | <result column="contact_user_name" property="contactUserName" /> |
| | | <result column="contact_user_phone" property="contactUserPhone" /> |
| | | <result column="maintain_user_id" property="maintainUserId" /> |
| | | <result column="maintain_time" property="maintainTime" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | <result column="tenant_id" property="tenantId" /> |
| | | <result column="is_white" property="isWhite" /> |
| | | </resultMap> |
| | | |
| | | <select id="manufacturerListPage" resultType="com.ruoyi.stock.dto.ManufacturerDto"> |
| | | SELECT |
| | | T1.id, |
| | | T1.name, |
| | | T1.taxpayer_identification_num, |
| | | T1.company_address, |
| | | T1.company_phone, |
| | | T1.bank_account_name, |
| | | T1.bank_account_num, |
| | | T1.contact_user_name, |
| | | T1.contact_user_phone, |
| | | T1.maintain_user_id, |
| | | T1.maintain_time, |
| | | T1.create_time, |
| | | T1.create_user, |
| | | T1.update_time, |
| | | T1.update_user, |
| | | T1.tenant_id, |
| | | T1.is_white, |
| | | T2.nick_name AS maintainUserName, |
| | | T1.type |
| | | FROM manufacturer T1 |
| | | LEFT JOIN sys_user T2 ON T1.maintain_user_id = T2.user_id |
| | | <where> |
| | | <if test="manufacturerDto.name != null and manufacturerDto.name != '' "> |
| | | AND T1.name LIKE CONCAT('%',#{manufacturerDto.name},'%') |
| | | </if> |
| | | <if test="manufacturerDto.isWhite != null"> |
| | | AND T1.is_white = #{manufacturerDto.isWhite} |
| | | </if> |
| | | </where> |
| | | order by T1.create_time desc |
| | | </select> |
| | | |
| | | <select id="manufacturerExportList" resultType="com.ruoyi.stock.execl.ManufacturerExcelDto"> |
| | | SELECT |
| | | T1.id, |
| | | T1.name, |
| | | T1.type, |
| | | T1.taxpayer_identification_num, |
| | | T1.company_address, |
| | | T1.company_phone, |
| | | T1.bank_account_name, |
| | | T1.bank_account_num, |
| | | T1.contact_user_name, |
| | | T1.contact_user_phone, |
| | | T1.maintain_user_id, |
| | | T1.maintain_time, |
| | | T1.create_time, |
| | | T1.create_user, |
| | | T1.update_time, |
| | | T1.update_user, |
| | | T1.tenant_id, |
| | | T1.is_white, |
| | | T2.nick_name AS maintainUserName |
| | | FROM manufacturer T1 |
| | | LEFT JOIN sys_user T2 ON T1.maintain_user_id = T2.user_id |
| | | <where> |
| | | <if test="manufacturerDto.name != null and manufacturerDto.name != '' "> |
| | | AND T1.name LIKE CONCAT('%',#{manufacturerDto.name},'%') |
| | | </if> |
| | | <if test="manufacturerDto.isWhite != null"> |
| | | AND T1.is_white = #{manufacturerDto.isWhite} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | unit, |
| | | product_name, |
| | | product_id, |
| | | MAX(manufacturer_id) as manufacturer_id, |
| | | MAX(manufacturer_name) as manufacturerName, |
| | | MAX(qualifiedSource) as qualifiedSource, |
| | | MAX(unQualifiedSource) as unQualifiedSource, |
| | | |
| | | MAX(create_time) as create_time, |
| | | MAX(update_time) as update_time, |
| | |
| | | pm.unit, |
| | | p.product_name, |
| | | p.id as product_id, |
| | | si.manufacturer_id, |
| | | m.name as manufacturer_name, |
| | | si.source as qualifiedSource, |
| | | null as unQualifiedSource, |
| | | |
| | | si.create_time, |
| | | si.update_time, |
| | |
| | | from stock_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join manufacturer m on si.manufacturer_id = m.id |
| | | |
| | | union all |
| | | |
| | |
| | | pm.unit, |
| | | p.product_name, |
| | | p.id as product_id, |
| | | su.manufacturer_id, |
| | | m.name as manufacturer_name, |
| | | null as qualifiedSource, |
| | | su.source as unQualifiedSource, |
| | | |
| | | su.create_time, |
| | | su.update_time, |
| | |
| | | from stock_uninventory su |
| | | left join product_model pm on su.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join manufacturer m on su.manufacturer_id = m.id |
| | | ) as combined |
| | | <where> |
| | | <if test="ew.productModelId != null and ew.productModelId > 0"> |
| | |
| | | model, |
| | | unit, |
| | | product_name, |
| | | product_id |
| | | product_id, |
| | | manufacturer_id, |
| | | manufacturer_name |
| | | order by |
| | | batch_no |
| | | </select> |