Merge remote-tracking branch 'origin/master'

This commit is contained in:
syruan 2024-08-13 13:14:52 +08:00
commit 9a5dc2a35a
21 changed files with 392 additions and 36 deletions

View File

@ -1,5 +1,6 @@
package com.bonus.base.api.domain;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -17,31 +18,35 @@ public class BmCustomer extends BaseEntity implements Serializable {
/**
*
*/
@ApiModelProperty(value = "")
@ApiModelProperty(value = "主键id")
private Integer id;
/**
* 往来单位名称
*/
@ApiModelProperty(value = "往来单位名称")
@Excel(name = "单位名称")
private String name;
/**
* 往来单位类型
*/
@ApiModelProperty(value = "往来单位类型")
@Excel(name = "单位类型")
private Integer typeId;
/**
* 所属分公司
*/
@ApiModelProperty(value = "所属分公司")
@Excel(name = "所属分公司")
private Integer companyId;
/**
* 往来单位名称
*/
@ApiModelProperty(value = "往来单位名称")
private String name;
/**
* 材料员
*/
@ApiModelProperty(value = "材料员")
@Excel(name = "材料员")
private String materialClerk;
/**
@ -54,6 +59,7 @@ public class BmCustomer extends BaseEntity implements Serializable {
* 联系方式
*/
@ApiModelProperty(value = "联系方式")
@Excel(name = "联系电话")
private String phone;
/**
@ -86,5 +92,9 @@ public class BmCustomer extends BaseEntity implements Serializable {
@ApiModelProperty(value = "组织分公司id")
private String company;
@ApiModelProperty(value = "状态名称")
@Excel(name = "状态")
private String statusName;
private static final long serialVersionUID = 1L;
}

View File

@ -1,5 +1,6 @@
package com.bonus.base.api.domain;
import com.bonus.common.core.annotation.Excel;
import com.bonus.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -27,8 +28,13 @@ public class BmCustomerType extends BaseEntity implements Serializable {
* 往来单位类型
*/
@ApiModelProperty(value="往来单位类型")
@Excel(name = "单位类型")
private String name;
@ApiModelProperty(value = "状态名称")
@Excel(name = "状态")
private String statusName;
/**
* 数据所属组织

View File

@ -81,7 +81,7 @@ public class BmAgreementController extends BaseController {
* @param id 主键
* @return 删除是否成功
*/
@PostMapping(value = "/delete/{id}")
@DeleteMapping(value = "/{id}")
public ResultBean<String> deleteById(@PathVariable("id") Integer id) {
return ResultBean.toIsSuccess(this.bmAgreementService.deleteByPrimaryKey(id), "删除成功");
}

View File

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 往来单位 信息操作处理
@ -131,6 +132,9 @@ public class BmCustomerController extends BaseController {
public void export(HttpServletResponse response, BmCustomer bmCustomer)
{
List<BmCustomer> list = customerService.selectCustomerList(bmCustomer);
list.forEach(item->{
item.setStatusName(Objects.equals(item.getIsActive(), "1") ? "启用":"不启用");
});
ExcelUtil<BmCustomer> util = new ExcelUtil<>(BmCustomer.class);
util.exportExcel(response, list, "往来单位列表数据");
}

View File

@ -3,15 +3,19 @@ package com.bonus.base.controller;
import com.bonus.base.api.domain.BmCustomerType;
import com.bonus.base.service.BmCustomerTypeService;
import com.bonus.base.utils.ResultBean;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.RequiresPermissions;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Objects;
/**
* (bm_customer_type)往来单位类型表控制层
@ -33,7 +37,7 @@ public class BmCustomerTypeController extends BaseController {
@SysLog(title = "往来单位类型", businessType = OperaType.QUERY, logType = 1, module = "往来单位类型->分页查询", details = "往来单位类型列表")
public TableDataInfo list(BmCustomerType bmCustomerType) {
startPage();
List<BmCustomerType> bmCustomerTypeList = bmCustomerTypeService.selectAll();
List<BmCustomerType> bmCustomerTypeList = bmCustomerTypeService.selectAll(bmCustomerType);
return getDataTable(bmCustomerTypeList);
}
@ -81,10 +85,25 @@ public class BmCustomerTypeController extends BaseController {
* @param id 主键
* @return 删除是否成功
*/
@PostMapping(value = "/del/{id}")
@DeleteMapping(value = "/{id}")
@RequiresPermissions("base:customerType:remove")
public ResultBean<Boolean> deleteById(@PathVariable("id") Integer id) {
this.bmCustomerTypeService.deleteByPrimaryKey(id);
return ResultBean.success(true);
}
/**
* 导出单位类型列表
*/
@ApiOperation(value = "导出单位类型列表")
@PostMapping("/export")
public void export(HttpServletResponse response, BmCustomerType bmCustomerType)
{
List<BmCustomerType> list = bmCustomerTypeService.selectAll(bmCustomerType);
list.forEach(item->{
item.setStatusName(Objects.equals(item.getIsActive(), "1") ? "启用":"不启用");
});
ExcelUtil<BmCustomerType> util = new ExcelUtil<>(BmCustomerType.class);
util.exportExcel(response, list, "单位类型列表数据");
}
}

View File

@ -65,11 +65,10 @@ public class BmSupplierController extends BaseController {
*/
@ApiOperation(value = "新增供应商管理数据")
@PostMapping("/add")
public ResultBean<Boolean> add(@RequestBody BmSupplier bmSupplier) {
public ResultBean add(@RequestBody BmSupplier bmSupplier) {
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
bmSupplier.setCompanyId(Integer.parseInt(companyId.toString()));
int result = bmSupplierService.insert(bmSupplier);
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "新增失败");
return bmSupplierService.insert(bmSupplier);
}
/**
@ -80,9 +79,8 @@ public class BmSupplierController extends BaseController {
*/
@ApiOperation(value = "编辑供应商管理数据")
@PutMapping("/update")
public ResultBean<Boolean> edit(@RequestBody BmSupplier bmSupplier) {
int result = bmSupplierService.update(bmSupplier);
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "修改失败");
public ResultBean edit(@RequestBody BmSupplier bmSupplier) {
return bmSupplierService.update(bmSupplier);
}
/**
@ -92,7 +90,7 @@ public class BmSupplierController extends BaseController {
* @return 删除是否成功
*/
@ApiOperation(value = "删除供应商管理数据")
@PostMapping(value = "/delete/{ids}")
@PostMapping(value = "/{ids}")
public ResultBean<Boolean> deleteById(@PathVariable("ids") Long[] ids) {
int result = bmSupplierService.deleteById(ids);
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "删除失败");

View File

@ -60,7 +60,7 @@ public interface BmCustomerTypeMapper {
*/
int updateByPrimaryKey(BmCustomerType record);
List<BmCustomerType> selectAll();
List<BmCustomerType> selectAll(BmCustomerType bmCustomerType);
int updateById(@Param("updated") BmCustomerType updated, @Param("id") Integer id);
}

View File

@ -55,5 +55,12 @@ public interface BmSupplierMapper {
*/
int deleteById(@Param("array") Long[] ids);
/**
* 通过名称查询单条数据
*
* @param name 名称
* @return 实例对象
*/
BmSupplier queryByName(String name);
}

View File

@ -60,8 +60,8 @@ public class BmCustomerTypeService{
}
public List<BmCustomerType> selectAll() {
return bmCustomerTypeMapper.selectAll();
public List<BmCustomerType> selectAll(BmCustomerType bmCustomerType) {
return bmCustomerTypeMapper.selectAll(bmCustomerType);
}

View File

@ -1,6 +1,7 @@
package com.bonus.base.service;
import com.bonus.base.api.domain.BmSupplier;
import com.bonus.base.utils.ResultBean;
import java.util.List;
@ -34,7 +35,7 @@ public interface BmSupplierService {
* @param bmSupplier 实例对象
* @return 实例对象
*/
int insert(BmSupplier bmSupplier);
ResultBean insert(BmSupplier bmSupplier);
/**
* 修改数据
@ -42,7 +43,7 @@ public interface BmSupplierService {
* @param bmSupplier 实例对象
* @return 实例对象
*/
int update(BmSupplier bmSupplier);
ResultBean update(BmSupplier bmSupplier);
/**
* 通过主键删除数据

View File

@ -3,6 +3,7 @@ package com.bonus.base.service.impl;
import com.bonus.base.api.domain.BmSupplier;
import com.bonus.base.mapper.BmSupplierMapper;
import com.bonus.base.service.BmSupplierService;
import com.bonus.base.utils.ResultBean;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -48,8 +49,14 @@ public class BmSupplierServiceImpl implements BmSupplierService {
* @return 实例对象
*/
@Override
public int insert(BmSupplier bmSupplier) {
return bmSupplierDao.insert(bmSupplier);
public ResultBean insert(BmSupplier bmSupplier) {
//根据供应商名称去表中查询判重
BmSupplier supplier = bmSupplierDao.queryByName(bmSupplier.getName());
if (supplier != null) {
return ResultBean.error("供应商名称重复");
}
int result = bmSupplierDao.insert(bmSupplier);
return result > 0 ? ResultBean.success("添加成功") : ResultBean.error("添加失败");
}
/**
@ -59,8 +66,14 @@ public class BmSupplierServiceImpl implements BmSupplierService {
* @return 实例对象
*/
@Override
public int update(BmSupplier bmSupplier) {
return bmSupplierDao.update(bmSupplier);
public ResultBean update(BmSupplier bmSupplier) {
//根据供应商名称去表中查询判重
BmSupplier supplier = bmSupplierDao.queryByName(bmSupplier.getName());
if (supplier != null && !supplier.getId().equals(bmSupplier.getId())) {
return ResultBean.error("供应商名称重复");
}
int result = bmSupplierDao.update(bmSupplier);
return result > 0 ? ResultBean.success("修改成功") : ResultBean.error("修改失败");
}
/**

View File

@ -72,7 +72,7 @@
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from bm_agreement
update bm_agreement set is_active = 0
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.bonus.base.api.domain.BmAgreement">

View File

@ -28,12 +28,11 @@
select
<include refid="Base_Column_List" />
from bm_customer
<where>
where
is_active = 1
<if test="name != null and name != ''">
AND name like concat('%', #{name}, '%')
</if>
</where>
</select>
@ -81,7 +80,7 @@
<delete id="deleteCustomerByIds">
delete from bm_customer where ID in
update bm_customer set is_active = 0 where ID in
<foreach item="customerId" collection="array" open="(" separator="," close=")">
#{customerId}
</foreach>

View File

@ -25,7 +25,7 @@
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from bm_customer_type
update bm_customer_type set is_active = 0
where ID = #{id,jdbcType=INTEGER}
</delete>
@ -93,6 +93,9 @@
<include refid="Base_Column_List"/>
from bm_customer_type
where IS_ACTIVE = '1'
<if test="name != null and name != ''">
and `NAME` like concat('%',#{name},'%')
</if>
</select>
<update id="updateById">

View File

@ -49,6 +49,11 @@
</if>
ORDER BY id DESC
</select>
<select id="queryByName" resultType="com.bonus.base.api.domain.BmSupplier">
select id, name, address, company_man, main_person, phone, scope_business, notes, pic_url, is_active, company_id
from bm_supplier
where name = #{name} and is_active = 1
</select>
<insert id="insert">
insert into bm_supplier(

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>bonus-modules</artifactId>
<groupId>com.bonus</groupId>
<version>24.7.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bonus-material</artifactId>
<description>
bonus-modules-base物资管理模块
</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- bonus Common DataSource -->
<dependency>
<groupId>com.bonus</groupId>
<artifactId>bonus-common-datasource</artifactId>
</dependency>
<!-- bonus Common DataScope -->
<dependency>
<groupId>com.bonus</groupId>
<artifactId>bonus-common-datascope</artifactId>
</dependency>
<!-- bonus Common Log -->
<dependency>
<groupId>com.bonus</groupId>
<artifactId>bonus-common-log</artifactId>
</dependency>
<!-- bonus Common Swagger -->
<dependency>
<groupId>com.bonus</groupId>
<artifactId>bonus-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
<scope>compile</scope>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,33 @@
package com.bonus.material;
import com.bonus.common.security.annotation.EnableCustomConfig;
import com.bonus.common.security.annotation.EnableRyFeignClients;
import com.bonus.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
* 物资管理模块
* @author ma_sh
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
public class BonusMaterialApplication {
public static void main(String[] args) {
SpringApplication.run(BonusMaterialApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ bonus-material物资管理模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -0,0 +1,9 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_
| |
| |__ ___ _ __ _ _ ___
| '_ \ / _ \ | '_ \ | | | | / __|
| |_) | | (_) | | | | | | |_| | \__ \
|_.__/ \___/ |_| |_| \__,_| |___/

View File

@ -0,0 +1,54 @@
# Tomcat
server:
port: 18089
# Spring
spring:
redis:
host: 192.168.0.56
port: 6379
datasource:
druid:
stat-view-servlet:
enabled: true
loginUsername: admin
loginPassword: Bonus@Max2024
dynamic:
strict: false
primary: master
datasource:
master:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.56:3306/bns-smartwh?allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: Bonus@git
password: Passw0rd!
two:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql:///192.168.0.56:3306/bns-smartwh?allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false
username: Bonus@git
password: Passw0rd!
servlet:
multipart:
max-file-size: 5GB
max-request-size: 5GB
application:
# 应用名称
name: bonus-material
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: 693e01a9-1dc4-4858-b1ae-439da3d35f66
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: 693e01a9-1dc4-4858-b1ae-439da3d35f66
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/bonus-material" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.bonus" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

View File

@ -17,6 +17,7 @@
<module>bonus-obs</module>
<module>bonus-mongodb</module>
<module>bonus-base</module>
<module>bonus-material</module>
</modules>
<artifactId>bonus-modules</artifactId>