提交 11cd6b1c 作者: 苗卫卫

项目初始化

父级
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="nbd-wios-manage" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="central" />
<option name="url" value="https://maven.aliyun.com/nexus/content/groups/public" />
</remote-repository>
<remote-repository>
<option name="id" value="cams-releases" />
<option name="name" value="cams-releases" />
<option name="url" value="https://packages.aliyun.com/maven/repository/2105436-release-W8f7J2/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="rdc-snapshots" />
<option name="name" value="rdc-snapshots" />
<option name="url" value="https://repo.rdc.aliyun.com/repository/42378-snapshot-SzMM2B/" />
</remote-repository>
<remote-repository>
<option name="id" value="snapshots" />
<option name="name" value="snapshots" />
<option name="url" value="https://maven.aliyun.com/nexus/content/groups/public" />
</remote-repository>
<remote-repository>
<option name="id" value="cams-snapshots" />
<option name="name" value="cams-snapshots" />
<option name="url" value="https://packages.aliyun.com/maven/repository/2105436-snapshot-QhOZhi/" />
</remote-repository>
<remote-repository>
<option name="id" value="rdc-releases" />
<option name="name" value="rdc-releases" />
<option name="url" value="https://repo.rdc.aliyun.com/repository/42378-release-YWUwgn/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="18" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/warehouse.iml" filepath="$PROJECT_DIR$/.idea/warehouse.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
datasource:
def:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.12.1.17:3306/wios?useSSL=false&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
username: root
password: Boco@123
#type:
filters: stat
maxActive: 20
initialSize: 1
maxWait: 30000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 90000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-test-query: SELECT 1 FROM DUAL
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
extdb:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.12.1.17:3306/warehouse?useSSL=false&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
username: root
password: Boco@123
#type:
filters: stat
maxActive: 20
initialSize: 1
maxWait: 30000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 90000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-test-query: SELECT 1 FROM DUAL
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
spring:
redis:
timeout: 10s
host: 10.12.1.17
port: 6379
password: Boco1234
database: 0
lettuce:
pool:
max-active: 8
max-wait: 1000
max-idle: 100
min-idle: 0
jasypt.encryptor.password: 6dc19871-5299-4603-9b7a-2d7fa78defea
swagger:
enable: true #系统默认为false
serviceUrl: http://127.0.0.1:30350
version: v2.0
basePackage: com.boco.nbd.cams.*.controller,com.boco.nbd.wios.*.controller,com.boco.nbd.wios.export
app:
title: 开迈斯WIOS服务
desc: 开迈斯WIOS服务
#流程数据源配置
activiti:
#是否采用业务数据源
useDefDataSource: true
#是否创建表
database-schema-update: true
auth:
allowRepeatLogin: true
support:
limit:
pageSize: 10
api:
v2:
compatible: true
log: false
url:
api:
wios: http://wios.api.dev.ccchong.com:8086
push: http://push-gateway.test.k8s.star-charge.com/mts
warehouse: http://wios-warehouse.dev.k8s.star-charge.com/
#warehouse: http://10.8.9.86:8056/
invoice: http://47.111.208.192:8028/mts
h5: http://wios.2ust.com
FILE_UPLOAD_DEFAULT_URL: https://oss-cams.oss-cn-hangzhou.aliyuncs.com/wios/
appkey:
warehouse: MA1YDN61X
invoice: MA1YDN61X
mina:
appId: wxcc364b1431128ad7
appSecret: 2cc67ec6811ccb7dbdd57c2eadb627a5
weixin:
appId: wxe343c909cc459c6a
appSecret: d4624c36b6795d1d99dcf0547af5443d
sms:
aliyun:
enable: true
weight: 1
endpoint: cn-hangzhou
access-key-id: LTAI5tFo5PHXPUEGP7zrbSGe
access-key-secret: jU3mM34HWPdPKLnao9aF1ZFURt5sj3
sign-name: FC100000118866049
templates:
appointmentUser: SMS_255885013
businessRefused: SMS_256115007
appointmentTimeConfirm: SMS_256040012
appointmentTimeNotify: SMS_256030017
sap:
url: https://dev-user-vqgd2we1.it-cpi010-rt.cpi.cn40.apps.platform.sapcloud.cn
username: sb-ed7ae553-63c3-41cb-93e7-6d9eddd35998!b904|it-rt-dev-user-vqgd2we1!b39
password: 3bc40402-dd4b-4400-bf61-29db7a5e9968$Ly2NGHzyxV6QJ1rphkrmHAy6nBSflaLEcEFAQLCQSUI=
# flowCode 流程标识,flowSuperGroupId:流程超级用户组(存在配置)
flow:
flowCode: CamsOrder
flowSuperGroupId: 836764183768485111
\ No newline at end of file
datasource:
def:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1n0a3b0vegq27qjzm.mysql.rds.aliyuncs.com:3306/wios-nbd?useUnicode=true&characterEncoding=utf8
username: cams_warehouse
password: Dj3yVPttY
#type:
filters: stat
maxActive: 20
initialSize: 1
maxWait: 30000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 90000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-test-query: SELECT 1 FROM DUAL
#filters: stat,wall,log4j2
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
extdb:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1n0a3b0vegq27qjzm.mysql.rds.aliyuncs.com:3306/warehouse?useUnicode=true&characterEncoding=utf8
username: cams_warehouse
password: Dj3yVPttY
#type:
filters: stat
maxActive: 20
initialSize: 1
maxWait: 30000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 90000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-test-query: SELECT 1 FROM DUAL
#filters: stat,wall,log4j2
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
spring:
redis:
timeout: 2000
host: r-bp1chof5rigpzj6kcx.redis.rds.aliyuncs.com
port: 6379
password: DVazx5wuv
database: 0
lettuce:
pool:
max-active: 8
max-wait: 1000
max-idle: 100
min-idle: 0
jasypt.encryptor.password: 6dc19871-5299-4603-9b7a-2d7fa78defea
swagger:
enable: true #系统默认为false
serviceUrl: http://127.0.0.1:30350
version: v2.0
basePackage: com.boco.nbd.wios.*.controller,com.boco.nbd.wios.export
app:
title: 开迈斯WIOS服务
desc: 开迈斯WIOS服务
#流程数据源配置
activiti:
#是否采用业务数据源
useDefDataSource: true
#是否创建表
database-schema-update: true
auth:
allowRepeatLogin: true
support:
limit:
pageSize: 10
api:
v2:
compatible: true
log: false
url:
api:
wios: http://wios.api.dev.ccchong.com:8086
push: http://push-gateway.test.k8s.star-charge.com/mts
warehouse: http://wios-warehouse.dev.k8s.star-charge.com/
#warehouse: http://10.8.9.86:8056/
invoice: http://47.111.208.192:8028/mts
h5: http://wios.2ust.com
FILE_UPLOAD_DEFAULT_URL: https://oss-cams.oss-cn-hangzhou.aliyuncs.com/wios/
appkey:
warehouse: MA1YDN61X
invoice: MA1YDN61X
mina:
appId: wxcc364b1431128ad7
appSecret: 2cc67ec6811ccb7dbdd57c2eadb627a5
weixin:
appId: wxe343c909cc459c6a
appSecret: d4624c36b6795d1d99dcf0547af5443d
sms:
aliyun:
enable: true
weight: 1
endpoint: cn-hangzhou
access-key-id: LTAI5tFo5PHXPUEGP7zrbSGe
access-key-secret: jU3mM34HWPdPKLnao9aF1ZFURt5sj3
sign-name: FC100000118866049
templates:
appointmentUser: SMS_255885013
businessRefused: SMS_256115007
appointmentTimeConfirm: SMS_256040012
appointmentTimeNotify: SMS_256030017
sap:
url: https://dev-user-vqgd2we1.it-cpi010-rt.cpi.cn40.apps.platform.sapcloud.cn
username: sb-ed7ae553-63c3-41cb-93e7-6d9eddd35998!b904|it-rt-dev-user-vqgd2we1!b39
password: 3bc40402-dd4b-4400-bf61-29db7a5e9968$Ly2NGHzyxV6QJ1rphkrmHAy6nBSflaLEcEFAQLCQSUI=
# flowCode 流程标识,flowSuperGroupId:流程超级用户组(存在配置)
flow:
flowCode: CamsOrder
flowSuperGroupId: 836764183768485111
\ No newline at end of file
datasource:
def:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1n0a3b0vegq27qjzm.mysql.rds.aliyuncs.com:3306/wios-nbd?useUnicode=true&characterEncoding=utf8
username: cams_warehouse
password: Dj3yVPttY
#type:
filters: stat
maxActive: 20
initialSize: 1
maxWait: 30000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 90000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-test-query: SELECT 1 FROM DUAL
#filters: stat,wall,log4j2
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
extdb:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://rm-bp1n0a3b0vegq27qjzm.mysql.rds.aliyuncs.com:3306/warehouse?useUnicode=true&characterEncoding=utf8
username: cams_warehouse
password: Dj3yVPttY
#type:
filters: stat
maxActive: 20
initialSize: 1
maxWait: 30000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 90000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-test-query: SELECT 1 FROM DUAL
#filters: stat,wall,log4j2
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
spring:
redis:
timeout: 2000
host: r-bp1chof5rigpzj6kcx.redis.rds.aliyuncs.com
port: 6379
password: DVazx5wuv
database: 0
lettuce:
pool:
max-active: 8
max-wait: 1000
max-idle: 100
min-idle: 0
jasypt.encryptor.password: 6dc19871-5299-4603-9b7a-2d7fa78defea
swagger:
enable: true #系统默认为false
serviceUrl: http://127.0.0.1:30350
version: v2.0
basePackage: com.boco.nbd.wios.*.controller,com.boco.nbd.wios.export
app:
title: 开迈斯WIOS服务
desc: 开迈斯WIOS服务
#流程数据源配置
activiti:
#是否采用业务数据源
useDefDataSource: true
#是否创建表
database-schema-update: true
auth:
allowRepeatLogin: true
support:
limit:
pageSize: 10
api:
v2:
compatible: true
log: false
url:
api:
wios: http://wios.api.dev.ccchong.com:8086
push: http://push-gateway.test.k8s.star-charge.com/mts
warehouse: http://wios-warehouse.dev.k8s.star-charge.com/
#warehouse: http://10.8.9.86:8056/
invoice: http://47.111.208.192:8028/mts
h5: http://wios.2ust.com
FILE_UPLOAD_DEFAULT_URL: https://oss-cams.oss-cn-hangzhou.aliyuncs.com/wios/
appkey:
warehouse: MA1YDN61X
invoice: MA1YDN61X
mina:
appId: wxcc364b1431128ad7
appSecret: 2cc67ec6811ccb7dbdd57c2eadb627a5
weixin:
appId: wxe343c909cc459c6a
appSecret: d4624c36b6795d1d99dcf0547af5443d
sms:
aliyun:
enable: true
weight: 1
endpoint: cn-hangzhou
access-key-id: LTAI5tFo5PHXPUEGP7zrbSGe
access-key-secret: jU3mM34HWPdPKLnao9aF1ZFURt5sj3
sign-name: FC100000118866049
templates:
appointmentUser: SMS_255885013
businessRefused: SMS_256115007
appointmentTimeConfirm: SMS_256040012
appointmentTimeNotify: SMS_256030017
sap:
url: https://dev-user-vqgd2we1.it-cpi010-rt.cpi.cn40.apps.platform.sapcloud.cn
username: sb-ed7ae553-63c3-41cb-93e7-6d9eddd35998!b904|it-rt-dev-user-vqgd2we1!b39
password: 3bc40402-dd4b-4400-bf61-29db7a5e9968$Ly2NGHzyxV6QJ1rphkrmHAy6nBSflaLEcEFAQLCQSUI=
# flowCode 流程标识,flowSuperGroupId:流程超级用户组(存在配置)
flow:
flowCode: CamsOrder
flowSuperGroupId: 836764183768485111
\ No newline at end of file
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.boco.nbd.framework</groupId>
<artifactId>framework-parent-microservice-pom</artifactId>
<version>2.0.0</version>
</parent>
<groupId>com.boco.nbd</groupId>
<artifactId>nbd-wios-manage</artifactId>
<name>nbd-wios-manage</name>
<packaging>jar</packaging>
<version>2.0.0</version>
<description>wios project</description>
<dependencies>
<dependency>
<groupId>com.boco.nbd</groupId>
<artifactId>nbd-cams-core</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.boco.nbd.framework</groupId>
<artifactId>framework-flow-core</artifactId>
<version>${boco.framework.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.starcharge</groupId>
<artifactId>scit-api</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.4.4</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>2.2.1</version>
</dependency>
<!-- jxl -->
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<!--poi-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>com.deepoove</groupId>
<artifactId>poi-tl</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.13.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.2</version>
</dependency>
<!--hutool生成二维码依赖此包-->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.2.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<printFailingErrors>true</printFailingErrors>
<excludes>
<exclude>**/call/*</exclude>
<exclude>**/entity/**</exclude>
<exclude>**/service/**</exclude>
<exclude>**/downloadfile/**</exclude>
<exclude>**/export/**</exclude>
<exclude>**/OrderImport.java</exclude>
<exclude>**/wx/**</exclude>
<exclude>**/app/**</exclude>
<exclude>**/ScheduleTask.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.boco.nbd.wios.core.config;
import com.boco.nbd.cams.core.entity.config.ConfigDic;
import com.boco.nbd.cams.core.entity.config.ConfigIntDic;
import com.boco.nbd.wios.core.entity.AlgorithmDic;
import com.boco.nbd.wios.core.entity.ReportEntry;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.List;
/**
* @author:cao hai
* @date:2022/7/11 9:18
* @version:V1.0
* @description:ConfigDicProperties
* @modify:
*/
@Data
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(ConfigDicProperties.class)
@ConfigurationProperties("cams")
public class ConfigDicProperties {
private String name;
/**
* 数值类枚举
*/
private List<ConfigDic> enumNumberConfig;
/**
* 字符值类枚举
*/
private List<ConfigDic> enumStringConfig;
/**
* 处理时限
*/
private List<ConfigIntDic> dueDate;
/**
* 评分自动计算算法
*/
private List<AlgorithmDic> scoreAlgorithm;
/**
* 报告配置实体
*/
private List<ReportEntry> reportEntry;
}
package com.boco.nbd.wios.core.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author:cao hai
* @date:2022/10/11 18:48
* @version:V1.0
* @description:AlgorithmDic
* @modify:
*/
@Data
public class AlgorithmDic {
@ApiModelProperty("键")
private Integer key;
@ApiModelProperty("父建")
private Integer parentKey;
@ApiModelProperty("描述")
private String describe;
@ApiModelProperty("目标")
private String target;
@ApiModelProperty("计算方法")
private String algorithm;
}
package com.boco.nbd.wios.core.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
/**
* 基础java bean
*
* @author lilin
* @version [版本号, 2018年11月15日]
*/
@SuppressWarnings("serial")
public abstract class BaseBean implements Serializable {
/**
* 重写toString
*
* @return String
*/
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
package com.boco.nbd.wios.core.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author:cao hai
* @date:2022/10/25 10:53
* @version:V1.0
* @description:ReportEntry
* @modify:
*/
@Data
public class ReportEntry {
@ApiModelProperty("键")
private Integer key;
@ApiModelProperty("父建")
private Integer parentKey;
@ApiModelProperty("描述")
private String name;
@ApiModelProperty("描述")
private String describe;
}
package com.boco.nbd.wios.core.enums;
/**
* @author:cao hai
* @date:2022/11/9 14:12
* @version:V1.0
* @description:RoleEnum
* @modify:
*/
public enum RoleEnum {
/**
* 角色枚举
* 1,超级管理员,不可删除
* 2,主机厂管理员,不可删除
* 3,经销商管理员,不可删除
* 4,服务商管理员,不可删除
* 5,区域工程经理,不可删除
* 6,CAMS管理员,不可删除
*/
SUPPER(1), OEM(2), OEM_AGENT(3), SUPPLIER(4), REGION_MANAGER(5), CAMS(6);
RoleEnum(Integer key) {
this.key = key;
}
public Integer getKey() {
return key;
}
public void setKey(Integer key) {
this.key = key;
}
/**
* 枚举
*/
private Integer key;
}
package com.boco.nbd.wios.downloadfile.fileio;
import com.boco.nbd.wios.downloadfile.mapper.def.CptDataInfoMapper;
import com.boco.nbd.wios.downloadfile.model.CptDataInfo;
import com.boco.nbd.wios.downloadfile.service.DataStoreService;
import com.ihidea.core.support.exception.ServiceException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* 存储数据库IO(不推荐使用)
*/
@Component
class FileIoDb implements IFileIo {
private Log logger = LogFactory.getLog(FileIoDb.class);
@Autowired
private DataStoreService dataStoreService;
@Autowired
private CptDataInfoMapper dataInfoDao;
@Autowired
private JdbcTemplate jdbcTemplate;
/**
* 保存到存储路径
*/
@Override
public void save(FileIoEntity entity) {
saveFile(entity.getDataInfo().getId(), entity.getContent(), dataStoreService.getInfoByName(entity.getDataInfo().getStoreName()).getPath());
}
/**
* 保存到备份存储路径
*/
@Override
public void saveBak(FileIoEntity entity) {
saveFile(entity.getDataInfo().getId(), entity.getContent(), dataStoreService.getInfoByName(entity.getDataInfo().getStoreName()).getBakPath());
}
/**
* 持久化
*/
private void saveFile(final String id, final byte[] content, String storePath) {
//TODO 序列化后存入数据库
}
@Override
public boolean remove(FileIoEntity entity) {
String storePath = dataStoreService.getInfoByName(entity.getDataInfo().getStoreName()).getPath();
try {
jdbcTemplate.update("delete from " + storePath + " where id = ?", new Object[] { entity.getDataInfo().getId() });
} catch (Exception e) {
logger.error(e.getMessage(), e);
return false;
}
return true;
}
@Override
@SuppressWarnings("unchecked")
public byte[] get(String id) {
CptDataInfo dataInfo = dataInfoDao.selectByPrimaryKey(id);
String storePath = dataStoreService.getInfoByName(dataInfo.getStoreName()).getPath();
final List<byte[]> byteBody = new ArrayList<>(8);
return byteBody.get(0);
}
@Override
public void updateContent(final String id, final byte[] content) {
CptDataInfo dataInfo = dataInfoDao.selectByPrimaryKey(id);
String storePath = dataStoreService.getInfoByName(dataInfo.getStoreName()).getPath();
try {
//TODo 序列化后更新
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
@Override
public void execute(FileIoEntity fileIoEntity, IFileInputStream fileInputStreamImpl) {
throw new ServiceException("未实现");
}
}
package com.boco.nbd.wios.downloadfile.fileio;
import com.boco.nbd.wios.downloadfile.model.CptDataInfo;
public class FileIoEntity {
private CptDataInfo dataInfo;
private byte[] content;
public FileIoEntity() {
}
public FileIoEntity(CptDataInfo dataInfo) {
this.dataInfo = dataInfo;
}
public CptDataInfo getDataInfo() {
return dataInfo;
}
public void setDataInfo(CptDataInfo dataInfo) {
this.dataInfo = dataInfo;
}
public byte[] getContent() {
return content;
}
public void setContent(byte[] content) {
this.content = content;
}
}
package com.boco.nbd.wios.downloadfile.fileio;
import com.boco.nbd.wios.downloadfile.model.CptDataStore;
import com.boco.nbd.wios.downloadfile.model.DataStoreTypeEnum;
import com.boco.nbd.wios.downloadfile.service.DataStoreService;
import com.ihidea.core.support.SpringContextLoader;
import com.ihidea.core.support.exception.ServiceException;
/**
* @author yong
*/
public class FileIoFactory {
public static IFileIo getInstance(String dataStoreName) {
IFileIo fileIo;
DataStoreService dataStoreService = SpringContextLoader.getBean(DataStoreService.class);
CptDataStore cptDataStore = dataStoreService.getInfoByName(dataStoreName);
if (DataStoreTypeEnum.DB.getKey().equals(cptDataStore.getType())) {
fileIo = SpringContextLoader.getBean(FileIoDb.class);
} else if (DataStoreTypeEnum.LOCAL.getKey().equals(cptDataStore.getType())) {
fileIo = SpringContextLoader.getBean(FileIoLocal.class);
} else if (DataStoreTypeEnum.OSS.getKey().equals(cptDataStore.getType())) {
fileIo = SpringContextLoader.getBean(FileIoOSS.class);
} else {
throw new ServiceException("没有找到类型为:" + cptDataStore.getType() + "的数据存储方式!");
}
return fileIo;
}
}
package com.boco.nbd.wios.downloadfile.fileio;
import com.boco.nbd.wios.downloadfile.mapper.def.CptDataInfoMapper;
import com.boco.nbd.wios.downloadfile.model.CptDataInfo;
import com.boco.nbd.wios.downloadfile.service.DataStoreService;
import com.ihidea.core.support.exception.ServiceException;
import com.ihidea.core.util.DateUtilsEx;
import org.apache.catalina.connector.ClientAbortException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Date;
/**
* 存储本地文件IO
* @author TYOTANN
*/
@Component
public class FileIoLocal implements IFileIo {
private final Log logger = LogFactory.getLog(FileIoLocal.class);
@Autowired
private DataStoreService dataStoreService;
@Resource
private CptDataInfoMapper dataInfoDao;
/**
* 保存到存储路径
*/
@Override
public void save(FileIoEntity entity) {
saveFile(entity.getDataInfo().getId(), entity.getContent(),
getPath(entity.getDataInfo().getStoreName(), entity.getDataInfo().getCreateTime()));
}
/**
* 保存到备份存储路径
*/
@Override
public void saveBak(FileIoEntity entity) {
saveFile(entity.getDataInfo().getId(), entity.getContent(),
getBakPath(entity.getDataInfo().getStoreName(), entity.getDataInfo().getCreateTime()));
}
/**
* 持久化
*/
private void saveFile(String id, byte[] content, String storePath) {
File file = new File(storePath + File.separator + id);
if (file.exists()) {
throw new ServiceException("文件:" + file.getPath() + "已经存在!");
}
// 文件夹不存在的话则创建
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
try {
FileUtils.writeByteArrayToFile(file, content);
} catch (IOException e) {
throw new ServiceException(e);
}
}
@Override
public boolean remove(FileIoEntity entity) {
String path = getPath(entity.getDataInfo().getStoreName(), entity.getDataInfo().getCreateTime());
File file = new File(path + File.separator + entity.getDataInfo().getId());
// file.exists()==true?file.delete():true;
return file.delete();
}
@Override
public byte[] get(String id) {
CptDataInfo dataInfo = dataInfoDao.selectByPrimaryKey(id);
String path = getPath(dataInfo.getStoreName(), dataInfo.getCreateTime());
try {
File downloadFile = new File(path + File.separator + id);
if (downloadFile.exists()) {
return FileUtils.readFileToByteArray(downloadFile);
} else {
return null;
}
} catch (IOException e) {
throw new ServiceException(e);
}
}
@Override
public void execute(FileIoEntity fileIoEntity, IFileInputStream fileInputStreamImpl) throws Exception {
String filePath = getPath(fileIoEntity.getDataInfo().getStoreName(), fileIoEntity.getDataInfo().getCreateTime()) + File.separator
+ fileIoEntity.getDataInfo().getId();
File downloadFile = new File(filePath);
if (downloadFile.exists()) {
FileInputStream fis = null;
try {
fis = FileUtils.openInputStream(downloadFile);
fileInputStreamImpl.execute(fileIoEntity, fis);
} catch (ClientAbortException e) {
} catch (IOException e) {
throw new ServiceException(e);
} finally {
if (fis == null) {
IOUtils.closeQuietly(fis);
}
}
} else {
logger.info("文件不存在:" + filePath);
fileInputStreamImpl.execute(null, null);
}
}
private String getPath(String storeName, Date createDate) {
String storePath = dataStoreService.getInfoByName(storeName).getPath();
return storePath + DateUtilsEx.formatToString(createDate, DateUtilsEx.DATE_FORMAT_DAY).replace(".", File.separator);
}
private String getBakPath(String storeName, Date createDate) {
String storePath = dataStoreService.getInfoByName(storeName).getBakPath();
return storePath + DateUtilsEx.formatToString(createDate, DateUtilsEx.DATE_FORMAT_DAY).replace(".", File.separator);
}
@Override
public void updateContent(String id, byte[] content) {
CptDataInfo dataInfo = dataInfoDao.selectByPrimaryKey(id);
String path = getPath(dataInfo.getStoreName(), dataInfo.getCreateTime());
File file = new File(path + File.separator + id);
file.deleteOnExit();
try {
FileUtils.writeByteArrayToFile(file, content);
} catch (IOException e) {
throw new ServiceException(e);
}
}
}
package com.boco.nbd.wios.downloadfile.fileio;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.*;
import com.boco.nbd.wios.downloadfile.mapper.def.CptDataInfoMapper;
import com.boco.nbd.wios.downloadfile.model.CptDataInfo;
import com.boco.nbd.wios.downloadfile.model.CptDataStore;
import com.boco.nbd.wios.downloadfile.service.DataStoreService;
import com.ihidea.core.support.exception.ServiceException;
import com.ihidea.core.util.JSONUtilsEx;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 阿里云存储对象OSS
* @author wenhao
*/
@Component
@Lazy
public class FileIoOSS implements IFileIo {
private static Map<String, Map<String, String>> bucketMap = new HashMap<>(8);
private static OSS ossClient = null;
@Autowired
private DataStoreService dataStoreService;
@Autowired
private CptDataInfoMapper dataInfoDao;
@SuppressWarnings("unchecked")
private synchronized Map<String, String> initBucketInfo(String storeName) {
CptDataStore cptDataStore = dataStoreService.getInfoByName(storeName);
Map<String, String> bucketInfo = JSONUtilsEx.deserialize(cptDataStore.getPath(), Map.class);
bucketMap.put(storeName, bucketInfo);
return bucketInfo;
}
private synchronized void initOssClient(Map<String, String> bucketInfo) {
// ossClient = new OSSClient(bucketInfo.get("endpoint"), bucketInfo.get("accessKeyId"), bucketInfo.get("accessKeySecret"));
ossClient = new OSSClientBuilder().build(bucketInfo.get("endpoint"), bucketInfo.get("accessKeyId"), bucketInfo.get("accessKeySecret"));
}
public Map<String, String> getBucketInfo(String storeName){
Map<String, String> bucketInfo = bucketMap.get(storeName);
// 根据storeName得到参数
if (bucketInfo == null) {
bucketInfo = initBucketInfo(storeName);
}
if(ossClient == null){
initOssClient(bucketInfo);
}
return bucketInfo;
}
/**
* 保存到OSS
*/
@Override
public void save(FileIoEntity entity) {
String id= StringUtils.isNotBlank(entity.getDataInfo().getPrefix()) ? entity.getDataInfo().getPrefix()+"/"+entity.getDataInfo().getId() : entity.getDataInfo().getId();
saveFile(id, entity.getDataInfo().getFileName(), entity.getContent(), entity.getDataInfo().getStoreName());
}
/**
* 保存到备份存储OSS
*/
@Override
public void saveBak(FileIoEntity entity) {
throw new ServiceException("未实现");
}
private void saveFile(String id, String name, byte[] content, String storeName) {
try{
Map<String, String> bucketInfo = getBucketInfo(storeName);
ossClient.putObject(bucketInfo.get("bucketName"), bucketInfo.get("key") + id, new ByteArrayInputStream(content));
}catch (Exception e) {
throw new ServiceException("阿里云存储对象OSS上传出现异常:" + e.getMessage(), e);
}
}
@Override
public boolean remove(FileIoEntity entity) {
throw new ServiceException("未实现");
}
@Override
public byte[] get(String id) {
byte[] data = null;
CptDataInfo dataInfo = dataInfoDao.selectByPrimaryKey(id);
if(dataInfo != null){
Map<String, String> bucketInfo = getBucketInfo(dataInfo.getStoreName());
OSSObject ossObject = ossClient.getObject(bucketInfo.get("bucketName"), bucketInfo.get("key") + id);
try {
InputStream inputStream = ossObject.getObjectContent();
data=toByteArray(inputStream);
inputStream.close();
} catch (IOException e) {
throw new ServiceException("阿里云存储对象OSS获得对象出现异常:" + e.getMessage());
}
}
return data;
}
@Override
public void execute(FileIoEntity fileIoEntity, IFileInputStream fileInputStreamImpl) throws Exception {
throw new ServiceException("未实现");
}
@Override
public void updateContent(String id, byte[] content) {
throw new ServiceException("未实现");
}
private static byte[] toByteArray(InputStream in) throws IOException {
ByteArrayOutputStream out=new ByteArrayOutputStream();
byte[] buffer=new byte[1024*4];
int n=0;
while ( (n=in.read(buffer)) !=-1) {
out.write(buffer,0,n);
}
return out.toByteArray();
}
public void deleteFile(String id, String storeName, String prefix) {
try{
Map<String, String> bucketInfo = getBucketInfo(storeName);
ossClient.deleteObject(bucketInfo.get("bucketName"), bucketInfo.get("key") +(StringUtils.isNotBlank(prefix) ? prefix+"/"+id : id));
}catch (Exception e) {
throw new ServiceException("阿里云OSS批量删除文件出现异常:" + e.getMessage(), e);
}
}
public void deleteFileBatch(List<String> idList, String storeName, String prefix) {
try{
Map<String, String> bucketInfo = getBucketInfo(storeName);
List<String> keys=new ArrayList<>();
for (String id : idList) {
keys.add(bucketInfo.get("key") + (StringUtils.isNotBlank(prefix) ? prefix+"/"+id : id));
}
DeleteObjectsResult deleteObjectsResult = ossClient.deleteObjects(new DeleteObjectsRequest(bucketInfo.get("bucketName")).withKeys(keys));
List<String> deletedObjects = deleteObjectsResult.getDeletedObjects();
System.out.println("成功删除:"+deletedObjects.toString());
}catch (Exception e) {
throw new ServiceException("阿里云OSS批量删除文件出现异常:" + e.getMessage(), e);
}
}
public void copyFile(String sourceFileName, String destFileName, String storeName) {
try{
Map<String, String> bucketInfo = getBucketInfo(storeName);
CopyObjectRequest copyObjectRequest = new CopyObjectRequest(bucketInfo.get("bucketName"), bucketInfo.get("key") + sourceFileName, bucketInfo.get("bucketName"), bucketInfo.get("key") +destFileName);
ossClient.copyObject(copyObjectRequest);
}catch (Exception e) {
throw new ServiceException("阿里云OSS复制文件出现异常:" + e.getMessage(), e);
}
}
public boolean exist(String id, String storeName, String prefix) {
try{
Map<String, String> bucketInfo = getBucketInfo(storeName);
return ossClient.doesObjectExist(bucketInfo.get("bucketName"), bucketInfo.get("key") + (StringUtils.isNotBlank(prefix) ? prefix+"/"+id : id));
}catch (Exception e) {
throw new ServiceException("阿里云检查文件是否存在出现异常:" + e.getMessage(), e);
}
}
/**
* 获取文件列表,最多100个
* @param prefix
* @param storeName
* @return
*/
public List<String> list(String prefix, String storeName) {
try{
Map<String, String> bucketInfo = getBucketInfo(storeName);
ObjectListing objectListing = ossClient.listObjects(bucketInfo.get("bucketName"), bucketInfo.get("key")+prefix);
List<String> fileIdList=new ArrayList<>();
List<OSSObjectSummary> sums = objectListing.getObjectSummaries();
for (OSSObjectSummary s : sums) {
fileIdList.add(s.getKey());
}
return fileIdList;
}catch (Exception e) {
throw new ServiceException("阿里云列举文件出现异常:" + e.getMessage(), e);
}
}
}
package com.boco.nbd.wios.downloadfile.fileio;
import java.io.InputStream;
/**
* @author haica
*/
public interface IFileInputStream {
/**
* execute
* @param entity
* @param is
* @throws Exception
*/
void execute(FileIoEntity entity, InputStream is) throws Exception;
}
package com.boco.nbd.wios.downloadfile.fileio;
/**
* @author haica
*/
public interface IFileIo {
/**
* save
* @param entity
*/
void save(FileIoEntity entity);
/**
* saveBak
* @param entity
*/
void saveBak(FileIoEntity entity);
/**
* updateContent
* @param id
* @param content
*/
void updateContent(String id, final byte[] content);
/**
* remove
* @param entity
* @return
*/
boolean remove(FileIoEntity entity);
/**
* get
* @param id
* @return
*/
byte[] get(String id);
/**
* execute
* @param fileIoEntity
* @param fileInputStreamImpl
* @throws Exception
*/
void execute(FileIoEntity fileIoEntity, IFileInputStream fileInputStreamImpl) throws Exception;
}
package com.boco.nbd.wios.downloadfile.mapper.def;
import com.boco.nbd.wios.downloadfile.model.CptDataInfo;
import com.boco.nbd.wios.downloadfile.model.CptDataInfoCriteria;
import com.ihidea.core.base.CoreDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author haica
*/
public interface CptDataInfoMapper extends CoreDao {
/**
* count
* @param example
* @return
*/
int countByExample(CptDataInfoCriteria example);
/**
* delete
* @param example
* @return
*/
int deleteByExample(CptDataInfoCriteria example);
/**
* deleteByPrimaryKey
* @param id
* @return
*/
int deleteByPrimaryKey(String id);
/**
* insert
* @param record
* @return
*/
int insert(CptDataInfo record);
/**
* insertSelective
* @param record
* @return
*/
int insertSelective(CptDataInfo record);
/**
* selectByExample
* @param example
* @return
*/
List<CptDataInfo> selectByExample(CptDataInfoCriteria example);
/**
* selectByPrimaryKey
* @param id
* @return
*/
CptDataInfo selectByPrimaryKey(String id);
/**
* updateByExampleSelective
* @param record
* @param example
* @return
*/
int updateByExampleSelective(@Param("record") CptDataInfo record, @Param("example") CptDataInfoCriteria example);
/**
* updateByExample
* @param record
* @param example
* @return
*/
int updateByExample(@Param("record") CptDataInfo record, @Param("example") CptDataInfoCriteria example);
/**
* updateByPrimaryKeySelective
* @param record
* @return
*/
int updateByPrimaryKeySelective(CptDataInfo record);
/**
* updateByPrimaryKey
* @param record
* @return
*/
int updateByPrimaryKey(CptDataInfo record);
}
\ No newline at end of file
package com.boco.nbd.wios.downloadfile.mapper.def;
import com.boco.nbd.wios.downloadfile.model.CptDataStore;
import com.boco.nbd.wios.downloadfile.model.CptDataStoreCriteria;
import com.ihidea.core.base.CoreDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author haica
*/
public interface CptDataStoreMapper extends CoreDao {
/**
* countByExample
* @param example
* @return
*/
int countByExample(CptDataStoreCriteria example);
/**
* deleteByExample
* @param example
* @return
*/
int deleteByExample(CptDataStoreCriteria example);
/**
* deleteByPrimaryKey
* @param id
* @return
*/
int deleteByPrimaryKey(String id);
/**
* insert
* @param record
* @return
*/
int insert(CptDataStore record);
/**
* insertSelective
* @param record
* @return
*/
int insertSelective(CptDataStore record);
/**
* selectByExample
* @param example
* @return
*/
List<CptDataStore> selectByExample(CptDataStoreCriteria example);
/**
* selectByPrimaryKey
* @param id
* @return
*/
CptDataStore selectByPrimaryKey(String id);
/**
* updateByExampleSelective
* @param record
* @param example
* @return
*/
int updateByExampleSelective(@Param("record") CptDataStore record, @Param("example") CptDataStoreCriteria example);
/**
* updateByExample
* @param record
* @param example
* @return
*/
int updateByExample(@Param("record") CptDataStore record, @Param("example") CptDataStoreCriteria example);
/**
* updateByPrimaryKeySelective
* @param record
* @return
*/
int updateByPrimaryKeySelective(CptDataStore record);
/**
* updateByPrimaryKey
* @param record
* @return
*/
int updateByPrimaryKey(CptDataStore record);
}
\ No newline at end of file
package com.boco.nbd.wios.downloadfile.model;
import com.ihidea.core.base.CoreEntity;
import java.util.Date;
/**
* @author haica
*/
public class CptDataInfo extends CoreEntity {
private String id;
private String storeName;
private String description;
private String fileName;
private Integer fileSize;
private Integer status;
private String createAccount;
private Date createTime;
private String prefix;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName == null ? null : storeName.trim();
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName == null ? null : fileName.trim();
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getCreateAccount() {
return createAccount;
}
public void setCreateAccount(String createAccount) {
this.createAccount = createAccount == null ? null : createAccount.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getPrefix() {
return prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix == null ? null : prefix.trim();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
CptDataInfo other = (CptDataInfo) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getStoreName() == null ? other.getStoreName() == null : this.getStoreName().equals(other.getStoreName()))
&& (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
&& (this.getFileName() == null ? other.getFileName() == null : this.getFileName().equals(other.getFileName()))
&& (this.getFileSize() == null ? other.getFileSize() == null : this.getFileSize().equals(other.getFileSize()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCreateAccount() == null ? other.getCreateAccount() == null : this.getCreateAccount().equals(other.getCreateAccount()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getPrefix() == null ? other.getPrefix() == null : this.getPrefix().equals(other.getPrefix()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getStoreName() == null) ? 0 : getStoreName().hashCode());
result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
result = prime * result + ((getFileName() == null) ? 0 : getFileName().hashCode());
result = prime * result + ((getFileSize() == null) ? 0 : getFileSize().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCreateAccount() == null) ? 0 : getCreateAccount().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getPrefix() == null) ? 0 : getPrefix().hashCode());
return result;
}
}
\ No newline at end of file
package com.boco.nbd.wios.downloadfile.model;
import com.ihidea.core.base.CoreEntity;
/**
* @author haica
*/
public class CptDataStore extends CoreEntity {
private String id;
private String name;
private String type;
private String path;
private String bakPath;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type == null ? null : type.trim();
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path == null ? null : path.trim();
}
public String getBakPath() {
return bakPath;
}
public void setBakPath(String bakPath) {
this.bakPath = bakPath == null ? null : bakPath.trim();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
CptDataStore other = (CptDataStore) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getPath() == null ? other.getPath() == null : this.getPath().equals(other.getPath()))
&& (this.getBakPath() == null ? other.getBakPath() == null : this.getBakPath().equals(other.getBakPath()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getPath() == null) ? 0 : getPath().hashCode());
result = prime * result + ((getBakPath() == null) ? 0 : getBakPath().hashCode());
return result;
}
}
\ No newline at end of file
package com.boco.nbd.wios.downloadfile.model;
/**
* @author:cao hai
* @date:2022/9/29 9:29
* @version:V1.0
* @description:CptDataStoreType
* @modify:
*/
public enum DataStoreTypeEnum {
/**
* Cpt存储类型 1 存储数据库IO; 2 存储本地文件IO 3 阿里云存储对象OSS
*/
DB("1"), LOCAL("2"), OSS("3");
DataStoreTypeEnum(String key) {
this.key = key;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
/**
* 枚举
*/
private String key;
}
package com.boco.nbd.wios.downloadfile.service;
import com.boco.nbd.wios.downloadfile.mapper.def.CptDataStoreMapper;
import com.boco.nbd.wios.downloadfile.model.CptDataStore;
import com.boco.nbd.wios.downloadfile.model.CptDataStoreCriteria;
import com.boco.nbd.wios.downloadfile.model.DataStoreTypeEnum;
import com.ihidea.core.base.CoreService;
import com.ihidea.core.support.exception.ServiceException;
import com.ihidea.core.support.orm.mybatis3.util.IbatisServiceUtils;
import com.ihidea.core.util.FileUtilsEx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service("fileStoreService")
public class DataStoreService extends CoreService {
@Resource
private CptDataStoreMapper dao;
@Autowired
private JdbcTemplate jdbcTemplate;
private static Map<String, CptDataStore> dataStoreMap = new HashMap<>();
/**
* 添加
* @param record
* @return
*/
public int insertDataStore(CptDataStore record) {
if (DataStoreTypeEnum.LOCAL.getKey().equals(record.getType())) {
if (!isExists(record.getPath())) {
throw new ServiceException("文件路径不存在");
}
record.setPath(FileUtilsEx.filterPath(record.getPath()));
// 备份
if (!isExists(record.getBakPath())) {
throw new ServiceException("备份文件路径不存在");
}
record.setBakPath(FileUtilsEx.filterPath(record.getBakPath()));
}
return dao.insert(record);
}
/**
* 文件路径是否存在
* @param path
* @return
*/
private boolean isExists(String path) {
File file = new File(path);
return file.exists();
}
/**
* 删除
* @param id
* @return
*/
public int deleteDataStore(String id) {
return dao.deleteByPrimaryKey(id);
}
/**
* 更新
* @param record
* @return
*/
public int updateDataStore(CptDataStore record) {
if (DataStoreTypeEnum.LOCAL.getKey().equals(record.getType())) {
record.setPath(FileUtilsEx.filterPath(record.getPath()));
record.setBakPath(FileUtilsEx.filterPath(record.getBakPath()));
}
return dao.updateByPrimaryKey(record);
}
/**
* 查询
* @param record
* @return
* @throws Exception
*/
public List<CptDataStore> selectDataStores(CptDataStore record) throws Exception {
CptDataStoreCriteria example = new CptDataStoreCriteria();
CptDataStoreCriteria.Criteria criteria = example.createCriteria();
IbatisServiceUtils.createCriteriaByEntity(criteria, record);
example.setOrderByClause("id");
return dao.selectByExample(example);
}
/**
* 查询
* @param id
* @return
*/
public CptDataStore selectDataStore(String id) {
return dao.selectByPrimaryKey(id);
}
/**
* 通过存储名称得到存储信息
* @param name
* @return
*/
public CptDataStore getInfoByName(String name) {
CptDataStore result = dataStoreMap.get("DataStoreService.getInfoByName:"+name);
if (result == null) {
result = jdbcTemplate.queryForObject("select id, name, type, path, type, bak_path from cpt_datastore where name = ?",
new Object[] { name }, new BeanPropertyRowMapper<>(CptDataStore.class));
dataStoreMap.put("DataStoreService.getInfoByName:"+name, result);
}
return result;
}
}
package com.boco.nbd.wios.export;
import io.swagger.annotations.ApiModelProperty;
/**
* @author yong
*/
public class Contants {
public static final String export_visitOrder_title =
"车企单号,来源,您的姓名:,您的手机号码:,1. 请您对勘测及安装人员在为您提供服务时的服务态度进行评价?,1.1 请问您给出上一题分数的原因是什么呢?,2. 请您对家充墙盒安装服务周期进行评价?,2.1 请问您给出上一题分数的原因是什么呢?,3. 请您对家充墙盒安装的整体效果进行评价?,3.1 请问您给出上一题分数的原因是什么呢?,4. 请您对家充墙盒安装后的充电体验进行评价?,4.1 请问您给出上一题分数的原因是什么呢?,5. 请您对家充墙盒安装后,安装人员的使用指导培训进行评价?,5.1请问您给出上一题分数的原因是什么呢?,6. 请问您是否了解墙盒售后问题的反馈渠道?,7. 关于家庭充电方面,您还有哪些方面的诉求?,8. 请问您墙盒线缆的安装长度?,总分";
public static final String export_visitOrder_field = "outOrderId,source,userName,userPhone,score,knowAfterSalesChannel,installLength,scoreName1,score1,description1,scoreName2,score2,description2,scoreName3,score3,description3,scoreName4,score4,description4,scoreName5,score5,description5";
public static final String export_order_title =
"序号,安装单号,车企安装单号,创建时间,主机厂,经销商信息,车型,区域,省份,城市,地址,车主姓名,车辆底盘号,增盒品牌,增盒型号,设备编号,安装服务商,是否为售车前预勘测,订单状态,电工,是否报装,报装状态,电缆长度,室内/室外,是否立柱,增项收款金额,客户评分,登记时间,派单时间,预约勘测时间,勘测完成时间,提交勘测审核时间,勘测审核通过时间,预约安装时间,安装完成时间,提交安装审核时间,安装审核通过时间,回访时间,订单关闭时间,下次更新时间,状态标签,备注,勘测审核不通过次数,安装审核不通过次数,发票号,经度,纬度";
public static final String export_order_field =
"no,id,outOrderId,createTimeStr,oemName,oemAgentInfo,vehicleModel,area,province,city,address,userName,vehicleChassisNo,wallboxModelStr,installItemModelStr,wallboxNo,supplierName,surveyBeforeSaleEnableStr,statusStr,installStaffName,electricExpandStr,expandStatusStr,realCableMeter,installPositionStr,needErectPileStr,predictTotalFee,score,registerTimeStr,dispatchTimeStr,surveyReserveTimeStr,surveyFinishTimeStr,surveySubmitExamineTimeStr,surveyApproveTimeStr,installReserveTimeStr,installFinishTimeStr,installSubmitExamineTimeStr,installApproveTimeStr,returnVisitTimeStr,closeTimeStr,nextTime,tag,remark,surveyCheckFailNum,installCheckFailNum,invoiceNumber,longitude,latitude";
public static final String export_oem_title = "序号,编码,简称,联系人,全称,社会统一信用代码,管理账户,是否需要人工派单";
public static final String export_oem_field = "no,code,shortName,contactName,name,organizationCode,accountName,manualDispatchOrderStr";
public static final String export_agent_title = "编码,名称,联系人,社会统一信用代码,所属主机厂,是否需要人工派单,管理账户";
public static final String export_agent_field =
"code,name,contactName,organizationCode,parentOemName,manualDispatchOrderStr,accountName";
public static final String export_supplier_title = "序号,编码,服务商名称,社会统一信用代码,地址,联系人,联系方式,日接单能力,管理账户";
public static final String export_supplier_field =
"no,code,name,organizationCode,address,contactName,contactPhone,maxOrderQuantity,accountName";
public static final String export_oemContract_title = "序号,合同编号,主机厂/经销商,设备结算方,安装服务结算方,合同开始时间,合同结束时间,销售员,结算周期(月),质保期(月),是否使用cams设备,状态";
public static final String export_oemContract_field =
"no,code,oemName,deviceSettlementName,installSettlementName,startDateStr,endDateStr,saleAccount,settleInterval,guaranteePeriod,camsDeviceEnableStr,statusStr";
public static final String export_supplierContract_title = "序号,协议编号,服务商,联系人,联系方式,地区,地址,签约时间,结算周期(月),协议开始时间,协议结束时间,状态";
public static final String export_supplierContract_field =
"no,code,supplierName,contactName,contactPhone,regionName,address,signDateStr,settleInterval,startDateStr,endDateStr,statusStr";
public static final String export_oemSettlementDetail_title =
"安装单号,车主,车主联系电话,设备价格(元)不含税,设备价格(元)含税,安装服务费(元)不含税,安装服务费(元)含税,订单总价(元)不含税,订单总价(元)含税,安装完成时间";
public static final String export_oemSettlementDetail_field =
"orderId,userName,userPhone,deviceFee,deviceFeeWithTax,installServiceFee,installServiceFeeWithTax,totalFee,totalFeeWithTax,installFinishTimeStr";
public static final String export_supplierSettlementDetail_title =
"安装单号,车主,车主联系电话,勘察价格,勘察价格(含税),增项价格(元),增项价格(含税),安装价格(元),安装价格(含税),报装价格,订单总价(元),订单总价(含税),安装完成时间";
public static final String export_supplierSettlementDetail_field =
"orderId,userName,userPhone,surveyFee,surveyFeeWithTax,itemFee,itemFeeWithTax,installFee,installFeeWithTax,expandFee,totalFee,totalFeeWithTax,finishTimeStr";
public static final String export_score_supplier_title = "安装服务商,所属区域,评价月份,综合评分,采购评分(xx%),总分,线上评分,线下评分,客户评分,扣分";
public static final String export_score_supplier_field =
"supplierName,regionName,month,finalScore,finalPurchasing,finalEngineering,online,offline,customer,finalDeduct";
public static final String export_warrantyOrder_title = "序号,订单号,车主姓名,车主电话,电桩编号/二维码,维保开始时间,维保到期时间";
public static final String export_warrantyOrder_field = "no,orderId,userName,userPhone,wallboxNo,startTimeStr,endTimeStr";
public static final String export_wareHouse_title = "仓库名称,仓库级别,所属区域,仓库归属,所属服务商,描述";
public static final String export_wareHouse_field = "name,pathName,areaName,attributionName,providerName,msg";
public static final String export_single_title = "调拨单号,创建时间,创建人,说明,调拨类型,调入仓库,调出仓库";
public static final String export_single_field = "id,createTime,createAccount,info,typeStr,transferInName,transferOutName";
public static final String export_materialInventory_title = "仓库,物料名称,物料编码,单位,库存数量,已占用数量,待使用数量";
public static final String export_materialInventory_field =
"warehouseName,materialsName,materialsCode,unit,remainingNumber,hasNumber,stayWithNumber";
public static final String export_supplierStaff_title = "序号,用户姓名,登录账号,是否有保险,电工证,证件有效期,角色";
public static final String export_supplierStaff_field = "no,name,loginAccount,insureStr,certFiles,certExpireStr,roleName";
public static final String export_operateLog_title = "序号,操作,记录事项,人员,时间";
public static final String export_operateLog_field = "no,value,desc,createAccountName,createTimeStr";
public static final String export_installDataTable_title = "区域,安装服务商,订单总量,待安装量,安装完成量,安装失败量";
public static final String export_installDataTable_field =
"regionName,supplierName,countTotal,countUnfinished,countFinished,countClosed";
public static final String export_invoice_title = "抬头,开票总金额(元),申请开票时间,开票状态,发票类型,申请人账号,开票主体,出票方";
public static final String export_invoice_field =
"invoiceTitle,invoiceAmount,applyTime,statusStr,invoiceTypeStr,applyAccount,businessTypeStr,finalInvoiceCompanyName";
public static final String export_orderDetail_title = "订单号,服务商,订单类型,费用项目,车企类型,规格,物料号,计量单位,数量,单价,订单金额,是否支付,支付方名称,支付方式(微信/支付宝),支付时间,开票方式(线上/线下),开票抬头,开票时间,发票号码";
public static final String export_orderDetail_field =
"id,installType,orderType,itemName,itemBrand,itemModel,materialsCode,unit,qunatity,ratePrice,fee,hasPay,payName,payType,payTime,invoiceType,invoiceName,invoiceTime,invoiceNum";
}
package com.boco.nbd.wios.export;
import java.util.List;
/**
* @author haica
*/
public interface Export<E> {
/**
* getExportList
* @param json
* @return
* @throws Exception
*/
List<E> getExportList(String json) throws Exception;
}
package com.boco.nbd.wios.export;
import com.boco.nbd.cams.core.constant.CamsConstant;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import com.ihidea.core.util.DateUtilsEx;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springframework.core.io.ClassPathResource;
import javax.servlet.http.HttpServletResponse;
import java.beans.PropertyDescriptor;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* poi工具类
*
* @author xgl
* @version [v1.6, 2019年4月2日]
*/
public class PoiUtil {
public static HSSFWorkbook initExcel(String[][] titles, String fileName) {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFCellStyle ztStyle = wb.createCellStyle();
ztStyle.setAlignment(HorizontalAlignment.CENTER);
ztStyle.setVerticalAlignment(VerticalAlignment.CENTER);
Font ztFont = wb.createFont();
ztFont.setColor(Font.COLOR_NORMAL);
ztFont.setFontHeightInPoints((short)14);
ztFont.setBold(true);
ztStyle.setFont(ztFont);
HSSFSheet sheet = wb.createSheet();
sheet.setDefaultColumnWidth(20);
for (int j = 0; j < titles.length; j++) {
HSSFRow headRow = sheet.createRow(j);
for (int k = 0; k < titles[j].length; k++) {
HSSFCell headRowCell = headRow.createCell(k);
headRowCell.setCellStyle(ztStyle);
headRowCell.setCellValue(titles[j][k]);
}
}
if (fileName.startsWith("评价结果")) {
CellRangeAddress region = new CellRangeAddress(0, 1, 0, 0);
CellRangeAddress region1 = new CellRangeAddress(0, 1, 1, 1);
CellRangeAddress region2 = new CellRangeAddress(0, 1, 2, 2);
CellRangeAddress region3 = new CellRangeAddress(0, 1, 3, 3);
CellRangeAddress region4 = new CellRangeAddress(0, 1, 4, 4);
CellRangeAddress region5 = new CellRangeAddress(0, 0, 5, 8);
CellRangeAddress region9 = new CellRangeAddress(0, 1, 9, 9);
sheet.addMergedRegion(region);
sheet.addMergedRegion(region1);
sheet.addMergedRegion(region2);
sheet.addMergedRegion(region3);
sheet.addMergedRegion(region4);
sheet.addMergedRegion(region5);
// sheet.addMergedRegion(region6);
// sheet.addMergedRegion(region7);
// sheet.addMergedRegion(region8);
sheet.addMergedRegion(region9);
}
return wb;
}
public static void downloadExcelToWebSite(HSSFWorkbook wb, HttpServletResponse response, String fileName) throws IOException {
// response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setContentType("application/octet-stream;charset=ISO8859-1");
response.setHeader("Content-disposition",
"attachment; filename=" + new String(
(URLEncoder.encode(fileName, CamsConstant.UTF_8) + "-" + DateUtilsEx.formatToString(new Date(), "yyyyMMddHHmmss") + ".xls").getBytes(),
"ISO-8859-1"));
OutputStream os = null;
try {
os = response.getOutputStream();
wb.write(os);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (wb != null) {
// wb.dispose();
wb.close();
}
if (os != null) {
os.close();
}
}
}
public static void exportExcelToWebsite(HttpServletResponse response, String fileName, String[][] titles, String[] fields,
List<?> dataList) throws Exception {
// 初始化EXCEL
HSSFWorkbook wb = initExcel(titles, fileName);
exportExcel(response, fileName, titles, fields, dataList, wb);
}
public static void exportExcel(HttpServletResponse response, String fileName, String[][] titles, String[] fields, List<?> dataList,
HSSFWorkbook wb) throws Exception {
if (dataList != null) {
int sheetCount = wb.getNumberOfSheets();
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
for (int i = 0; i < sheetCount; i++) {
HSSFSheet eachSheet = wb.getSheetAt(i);
for (int row = 0; row < dataList.size(); row++) {
Object rowData = dataList.get(row);
HSSFRow eachDataRow = eachSheet.createRow(row + titles.length);
for (int col = 0; col < titles[0].length; col++) {
Object valueObj = null;
if (rowData instanceof Map<?, ?>) {
// map类型
valueObj = ((Map<?, ?>)rowData).get(fields[col]);
} else {
// 实体类
PropertyDescriptor pd = new PropertyDescriptor(fields[col], rowData.getClass());
valueObj = pd.getReadMethod().invoke(rowData);
}
// if (valueObj != null && valueObj.toString().startsWith("https://")) {
// ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
// URL url = new URL(valueObj.toString());
// RenderedImage bufferImg = ImageIO.read(url);
// ImageIO.write(bufferImg, "jpg", byteArrayOut);
//
// HSSFPatriarch patriarch = eachSheet.createDrawingPatriarch();
// // anchor主要用于设置图片的属性
// HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)col, row + 1, (short)(col +
// 1), (row + 2));
// anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE);
// // 插入图片
// patriarch.createPicture(anchor, wb.addPicture(byteArrayOut.toByteArray(),
// HSSFWorkbook.PICTURE_TYPE_JPEG));
// } else {
HSSFCell cell = eachDataRow.createCell(col);
cell.setCellStyle(cellStyle);
cell.setCellValue(valueObj == null ? "" : valueObj.toString());
// }
}
}
}
}
downloadExcelToWebSite(wb, response, fileName);
}
// @SuppressWarnings("unchecked")
// public static void dynamicExportExcelToWebsite(HttpServletResponse response, String fileName, Map<String,
// List<Object>> exportMap)
// throws Exception {
// List<Object> fieldsObjList = exportMap.get("fields");
// List<Object> dataObjList = exportMap.get("data");
// List<String> fields = new ArrayList<>();
// List<String> titles = new ArrayList<>();
// for (int i = 0; i < fieldsObjList.size(); i++) {
// Object obj = fieldsObjList.get(i);
// if (obj != null) {
// Map<String, String> map = (Map<String, String>)obj;
// fields.add(map.get("key"));
// titles.add(map.get("name"));
// }
// }
// String[] titlesArr = new String[titles.size()];
// String[] fieldsArr = new String[fields.size()];
// exportExcelToWebsite(response, fileName, titles.toArray(titlesArr), fields.toArray(fieldsArr), dataObjList);
// }
public static void exportOrderDocx(HttpServletResponse response, Map<String, Object> dataMap, String fileName,
String templateName) throws Exception {
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
Configure config = Configure.newBuilder().bind("picFiles", policy).build();
ClassPathResource resource = new ClassPathResource("static/templates/" + templateName + ".docx");
InputStream inputStream = resource.getInputStream();
response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("utf-8"), "iso8859-1"));
response.setContentType("application/octet-stream");
response.setCharacterEncoding("utf-8");
XWPFTemplate template = XWPFTemplate.compile(inputStream, config).render(dataMap);
OutputStream out = response.getOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(out);
template.write(bos);
template.close();
bos.flush();
bos.close();
out.flush();
out.close();
}
}
package com.boco.nbd.wios.export.bo;
import io.swagger.annotations.ApiModelProperty;
public class OrderInstallExportBo {
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "客户姓名")
private String userName;
@ApiModelProperty(value = "联系电话")
private String userPhone;
@ApiModelProperty(value = "施工人员")
private String installStaffName;
@ApiModelProperty(value = "施工人员联系电话")
private String installStaffPhone;
@ApiModelProperty(value = "经销商销售代码")
private String oemCode;
@ApiModelProperty(value = "经销商名称")
private String oemName;
@ApiModelProperty(value = "车辆底盘号")
private String vehicleChassisNumber;
@ApiModelProperty(value = "订单编号")
private String orderId;
@ApiModelProperty(value = "墙盒服务商名称")
private String wallboxModelName;
@ApiModelProperty(value = "墙盒设备编号")
private String wallboxNo;
@ApiModelProperty(value = "住宅类型")
private String houseTypeStr;
@ApiModelProperty(value = "车位类型")
private String parkingTypeStr;
@ApiModelProperty(value = "施工位置")
private String address;
@ApiModelProperty(value = "是否进行电力报装")
private String electricExpandStr;
@ApiModelProperty(value = "电源点类型")
private String installPowerTypeStr;
@ApiModelProperty(value = "电源接入点位置")
private String installPowerPosition;
@ApiModelProperty(value = "充电桩安装车位号")
private String parkingNo;
@ApiModelProperty(value = "实际安装方式")
private String realInstallTypeStr;
@ApiModelProperty(value = "实际长度线缆(米)")
private String realCableMeter;
@ApiModelProperty(value = "实际电缆规格")
private String realCableTypeStr;
@ApiModelProperty(value = "实际电缆敷设方式")
private String realCableInstallTypeStr;
@ApiModelProperty(value = "充电设施检查")
private String chargeCheck;
@ApiModelProperty(value = "电缆敷设检查")
private String cableCheck;
@ApiModelProperty(value = "现场培训内容")
private String trainContent;
@ApiModelProperty(value = "客户评价")
private String clientRate;
public String getUserName() {
return userName;
}
public String getUserPhone() {
return userPhone;
}
public String getOemCode() {
return oemCode;
}
public String getOemName() {
return oemName;
}
public String getVehicleChassisNumber() {
return vehicleChassisNumber;
}
public String getOrderId() {
return orderId;
}
public String getWallboxModelName() {
return wallboxModelName;
}
public String getWallboxNo() {
return wallboxNo;
}
public String getHouseTypeStr() {
return houseTypeStr;
}
public String getParkingTypeStr() {
return parkingTypeStr;
}
public String getAddress() {
return address;
}
public String getElectricExpandStr() {
return electricExpandStr;
}
public String getInstallPowerTypeStr() {
return installPowerTypeStr;
}
public String getInstallPowerPosition() {
return installPowerPosition;
}
public String getParkingNo() {
return parkingNo;
}
public String getRealInstallTypeStr() {
return realInstallTypeStr;
}
public String getRealCableMeter() {
return realCableMeter;
}
public String getRealCableTypeStr() {
return realCableTypeStr;
}
public String getRealCableInstallTypeStr() {
return realCableInstallTypeStr;
}
public String getChargeCheck() {
return chargeCheck;
}
public String getCableCheck() {
return cableCheck;
}
public String getTrainContent() {
return trainContent;
}
public String getClientRate() {
return clientRate;
}
public void setUserName(String userName) {
this.userName = userName;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public void setOemCode(String oemCode) {
this.oemCode = oemCode;
}
public void setOemName(String oemName) {
this.oemName = oemName;
}
public void setVehicleChassisNumber(String vehicleChassisNumber) {
this.vehicleChassisNumber = vehicleChassisNumber;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public void setWallboxModelName(String wallboxModelName) {
this.wallboxModelName = wallboxModelName;
}
public void setWallboxNo(String wallboxNo) {
this.wallboxNo = wallboxNo;
}
public void setHouseTypeStr(String houseTypeStr) {
this.houseTypeStr = houseTypeStr;
}
public void setParkingTypeStr(String parkingTypeStr) {
this.parkingTypeStr = parkingTypeStr;
}
public void setAddress(String address) {
this.address = address;
}
public void setElectricExpandStr(String electricExpandStr) {
this.electricExpandStr = electricExpandStr;
}
public void setInstallPowerTypeStr(String installPowerTypeStr) {
this.installPowerTypeStr = installPowerTypeStr;
}
public void setInstallPowerPosition(String installPowerPosition) {
this.installPowerPosition = installPowerPosition;
}
public void setParkingNo(String parkingNo) {
this.parkingNo = parkingNo;
}
public void setRealInstallTypeStr(String realInstallTypeStr) {
this.realInstallTypeStr = realInstallTypeStr;
}
public void setRealCableMeter(String realCableMeter) {
this.realCableMeter = realCableMeter;
}
public void setRealCableTypeStr(String realCableTypeStr) {
this.realCableTypeStr = realCableTypeStr;
}
public void setRealCableInstallTypeStr(String realCableInstallTypeStr) {
this.realCableInstallTypeStr = realCableInstallTypeStr;
}
public void setChargeCheck(String chargeCheck) {
this.chargeCheck = chargeCheck;
}
public void setCableCheck(String cableCheck) {
this.cableCheck = cableCheck;
}
public void setTrainContent(String trainContent) {
this.trainContent = trainContent;
}
public void setClientRate(String clientRate) {
this.clientRate = clientRate;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getInstallStaffName() {
return installStaffName;
}
public String getInstallStaffPhone() {
return installStaffPhone;
}
public void setInstallStaffName(String installStaffName) {
this.installStaffName = installStaffName;
}
public void setInstallStaffPhone(String installStaffPhone) {
this.installStaffPhone = installStaffPhone;
}
}
package com.boco.nbd.wios.export.bo;
import com.deepoove.poi.data.PictureRenderData;
/**
* @author haica
*/
public class UploadPic {
private PictureRenderData prd;
private String name;
private String time;
public PictureRenderData getPrd() {
return prd;
}
public String getName() {
return name;
}
public String getTime() {
return time;
}
public void setPrd(PictureRenderData prd) {
this.prd = prd;
}
public void setName(String name) {
this.name = name;
}
public void setTime(String time) {
this.time = time;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.OemBo;
import com.boco.nbd.wios.manage.entity.bo.OemVo;
import com.boco.nbd.wios.manage.service.impl.OemService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AgentExport implements Export<OemVo> {
@Autowired
private OemService oemService;
@Override
public List<OemVo> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
OemBo condition = mapper.readValue(json, OemBo.class);
List<OemVo> oemList = oemService.getList(condition);
int no = 1;
for (int i = 0; i < oemList.size(); i++) {
OemVo item = oemList.get(i);
item.setNo(no++);
if (item.getManualDispatchOrder() != null) {
item.setManualDispatchOrderStr(item.getManualDispatchOrder().intValue() == 0 ? "否" : "是");
}
}
return oemList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.Region;
import com.boco.nbd.wios.manage.entity.bo.ReportOrderBo;
import com.boco.nbd.wios.manage.entity.bo.ReportOrderDTO;
import com.boco.nbd.wios.manage.service.impl.RegionService;
import com.boco.nbd.wios.manage.service.impl.ReportService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class InstallDataTableExport implements Export<ReportOrderDTO> {
@Autowired
private ReportService reportService;
@Autowired
private RegionService regionService;
@Override
public List<ReportOrderDTO> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ReportOrderBo reportOrderBo = mapper.readValue(json, ReportOrderBo.class);
if (!StringUtils.isEmpty(reportOrderBo.getBeginTime())) {
reportOrderBo.setBeginTime(reportOrderBo.getBeginTime() + " 00:00:00");
}
if (!StringUtils.isEmpty(reportOrderBo.getEndTime())) {
reportOrderBo.setEndTime(reportOrderBo.getEndTime() + " 23:59:59");
}
String regionName = "";
if (reportOrderBo.getRegionId()!=null) {
Region region = regionService.getById(reportOrderBo.getRegionId().intValue());
reportOrderBo.setRegionIdTree(region.getIdTree());
regionName = region.getName();
}
List<ReportOrderDTO> reportOrderDTOS = reportService.installDataTable(reportOrderBo);
if (reportOrderBo.getRegionId()!=null) {
final String finalRegionName = regionName;
reportOrderDTOS.stream().forEach(item->{
item.setRegionId(reportOrderBo.getRegionId());
item.setRegionName(finalRegionName);
});
}
return reportOrderDTOS;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.InvoiceQueryBo;
import com.boco.nbd.wios.manage.entity.settlement.vo.InvoiceDTO;
import com.boco.nbd.wios.manage.service.impl.InvoiceService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class InvoiceExport implements Export<Map<String, Object>> {
@Autowired
private InvoiceService invoiceService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
InvoiceQueryBo invoiceQueryBo = mapper.readValue(json, InvoiceQueryBo.class);
List<InvoiceDTO> list = invoiceService.getList(invoiceQueryBo);
List<Map<String, Object>> returnList = new ArrayList<>();
for (InvoiceDTO dto : list) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(dto), Map.class);
if (dto.getStatus() != null) {
map.put("statusStr", dto.getStatus().intValue() == 0 ? "待开票" : (dto.getStatus().intValue() == 1 ? "已开票" : "已完成"));
}
if (dto.getInvoiceType() != null) {
String im = dto.getInvoiceMaterial() == 2?"电⼦发票-":"纸质发票-";
map.put("invoiceTypeStr", im + (dto.getInvoiceType().intValue() == 1 ? "增值税普通发票" : "增值税专⽤发票"));
}
if (dto.getBusinessType() != null) {
map.put("businessTypeStr", dto.getBusinessType().intValue()==1 ? "个⼈" : "企业");
}
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.dto.MaterialsDTO;
import com.boco.nbd.wios.manage.entity.dto.MaterialsQuery;
import com.boco.nbd.wios.manage.service.impl.WarehouseService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
/**
* 物料库存导出
*
* @author
* @version
*/
@Service
public class MaterialInventoryExport implements Export<MaterialsDTO> {
@Autowired
private WarehouseService warehouseService;
@Override
public List<MaterialsDTO> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
MaterialsQuery materialsQuery = mapper.readValue(json, MaterialsQuery.class);
List<MaterialsDTO> list = new ArrayList<>();
int page = 1;
int pagecount = 10;
while (true) {
materialsQuery.setPage(page);
materialsQuery.setPagecount(pagecount);
List<MaterialsDTO> list1 = warehouseService.qryStockMaterials(materialsQuery);
if (list1 == null || list1.isEmpty()) {
break;
}
list.addAll(list1);
if (list1.size() < pagecount) {
break;
}
page++;
}
list.stream().forEach(item -> {
if (item.getTotalNumber() != null) {
item.setTotalNumber(item.getTotalNumber().setScale(0, RoundingMode.HALF_DOWN));
}
if (item.getHasNumber() != null) {
item.setHasNumber(item.getHasNumber().setScale(0, RoundingMode.HALF_DOWN));
}
if (item.getRemainingNumber() != null) {
item.setRemainingNumber(item.getRemainingNumber().setScale(0, RoundingMode.HALF_DOWN));
}
if (item.getStayWithNumber() != null) {
item.setStayWithNumber(item.getStayWithNumber().setScale(0, RoundingMode.HALF_DOWN));
}
});
return list;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.OemContractBo2;
import com.boco.nbd.wios.manage.entity.bo.OemContractVo;
import com.boco.nbd.wios.manage.entity.cams.enums.ContractStatus;
import com.boco.nbd.wios.manage.service.impl.OemContractService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 主机厂合同导出
*
* @author
* @version
*/
@Service
public class OemContractExport implements Export<Map<String, Object>> {
@Autowired
private OemContractService oemContractService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
OemContractBo2 condition = mapper.readValue(json, OemContractBo2.class);
List<OemContractVo> contractList = oemContractService.getList(condition);
List<Map<String, Object>> returnList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
int no = 1;
for (OemContractVo contract : contractList) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(contract), Map.class);
map.put("no", no++);
if (contract.getStartTime() != null) {
map.put("startDateStr", sdf.format(contract.getStartTime()));
}
if (contract.getEndTime() != null) {
map.put("endDateStr", sdf.format(contract.getEndTime()));
}
if (contract.getCamsDeviceEnable() != null) {
map.put("camsDeviceEnableStr", contract.getCamsDeviceEnable().intValue() == 0 ? "否" : "是");
}
if (contract.getStatus() != null) {
map.put("statusStr", ContractStatus.getText(contract.getStatus().intValue()));
}
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.OemBo;
import com.boco.nbd.wios.manage.entity.bo.OemVo;
import com.boco.nbd.wios.manage.service.impl.OemService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 主机厂导出
*
* @author
* @version
*/
@Service
public class OemExport implements Export<OemVo> {
@Autowired
private OemService oemService;
@Override
public List<OemVo> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
OemBo condition = mapper.readValue(json, OemBo.class);
List<OemVo> oemList = oemService.getList(condition);
int no = 1;
for (int i = 0; i < oemList.size(); i++) {
OemVo item = oemList.get(i);
item.setNo(no++);
if (item.getManualDispatchOrder() != null) {
item.setManualDispatchOrderStr(item.getManualDispatchOrder().intValue() == 0 ? "否" : "是");
}
}
return oemList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.cams.core.constant.MessageConstant;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.settlement.po.SettlementDetail;
import com.boco.nbd.wios.manage.mapper.def.SettlementDetailDao;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ihidea.core.support.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 主机厂结算单详情导出
*
* @author
* @version
*/
@Service
public class OemSettlementDetailExport implements Export<Map<String, Object>> {
@Autowired
private SettlementDetailDao settlementDetailDao;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Map map = mapper.readValue(json, Map.class);
Object settlementId = map.get("settlementId");
if (settlementId == null) {
throw new ServiceException(MessageConstant.MISSING_PARAM);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
List<SettlementDetail> list = settlementDetailDao.selectBySettlementId(settlementId.toString());
for (SettlementDetail detail : list) {
Map<String, Object> m = mapper.readValue(mapper.writeValueAsString(detail), Map.class);
if (detail.getInstallFinishTime() != null)
m.put("installFinishTimeStr", sdf.format(detail.getInstallFinishTime()));
returnList.add(m);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.OperateLog;
import com.boco.nbd.wios.manage.entity.bo.OperateLogBo;
import com.boco.nbd.wios.manage.entity.cams.enums.OperateLogType;
import com.boco.nbd.wios.manage.service.impl.OperateLogService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class OperateLogExport implements Export<Map<String, Object>> {
@Autowired
private OperateLogService operateLogService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
OperateLogBo condition = mapper.readValue(json, OperateLogBo.class);
List<Map<String, Object>> returnList = new ArrayList<>();
if (StringUtils.isEmpty(condition.getTypes())) {
condition.setTypes(OperateLogType.ORDER_STATUS.getType() + "," + OperateLogType.STAFF_CHANGE.getType() + ","
+ OperateLogType.SUPPLIER_CHANGE.getType());
}
List<OperateLog> operateLogList = operateLogService.getList(condition);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int no = 1;
for (OperateLog log : operateLogList) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(log), Map.class);
map.put("no", no++);
if (log.getCreateTime() != null)
map.put("createTimeStr", sdf.format(log.getCreateTime()));
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import cn.hutool.core.date.DateUtil;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.flow.enums.LevelEnum;
import com.boco.nbd.wios.manage.entity.bo.*;
import com.boco.nbd.wios.manage.entity.cams.enums.OrderStatus;
import com.boco.nbd.wios.manage.entity.dto.MaterialsDTO;
import com.boco.nbd.wios.manage.entity.settlement.vo.InvoiceVo;
import com.boco.nbd.wios.manage.mapper.def.*;
import com.boco.nbd.wios.manage.service.impl.InvoiceService;
import com.boco.nbd.wios.manage.service.impl.OrderService;
import com.boco.nbd.wios.manage.service.impl.UserPayBillService;
import com.boco.nbd.wios.manage.service.impl.WarehouseService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 订单明细导出
*/
@Service
public class OrderDetailExport implements Export<Map<String, Object>> {
private static final Logger logger = LoggerFactory.getLogger(OrderDetailExport.class);
@Autowired
private OrderService orderService;
@Autowired
private SupplierDao supplierDao;
@Autowired
private OrderInstallItemDao orderInstallItemDao;
@Autowired
private WarehouseService warehouseService;
@Autowired
private UserPayBillService userPayBillService;
@Autowired
private InvoiceService invoiceService;
@Autowired
private OrderInstallDao orderInstallDao;
@Autowired
private RegionDao regionDao;
@Autowired
private OemContractDao oemContractDao;
@Autowired
private OemContractPriceDao oemContractPriceDao;
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
OrderBo condition = mapper.readValue(json, OrderBo.class);
List<OrderVo> orderList = orderService.getList(condition);
List<Map<String, Object>> returnList = new ArrayList<>(8);
for (OrderVo order : orderList) {
if(order.getStatus() >= OrderStatus.INSTALL_FINISH.getType() && order.getStatus() != OrderStatus.CLOSED.getType()){
Map<String, Object> map = new HashMap<>(8);
map.put("id",order.getId());
if(order.getInstallSupplierId() == null){
continue;
}
Supplier supplier = supplierDao.selectById(order.getInstallSupplierId());
if(supplier == null){
continue;
}
map.put("installType",supplier.getName());
//套包内
map.put("orderType","套包内");
map.put("itemName","安装服务费");
map.put("itemBrand",order.getOemName());
try{
OemContract contract = oemContractDao.selectById(order.getContractId());
if(contract != null){
List<OemContractPrice> prices = oemContractPriceDao.selectPureByContractId(contract.getId());
Region region = regionDao.selectById(Integer.valueOf(order.getRegionId()));
if(region != null){
String idTree = region.getIdTree();
String[] idTreeArr = idTree.split("_");
OemContractPrice contractPrice = null;
for (int i = idTreeArr.length - 1; i >= 0; i--) {
final int iFinal = i;
List<OemContractPrice> filterResult =
prices.stream().filter(item -> item.getRegionId().equals(idTreeArr[iFinal]))
.collect(Collectors.toList());
if (!filterResult.isEmpty()) {
contractPrice = filterResult.get(0);
break;
}
}
if (contractPrice != null) {
map.put("fee",contractPrice.getInstallationRatePrice().add(contractPrice.getSurveyRatePrice()));
}
}
}
}catch(Exception e){
logger.error(e.getMessage(), e);
}
returnList.add(map);
//增项费用
if(LevelEnum.A.getKey().equals(supplier.getLevel())){
List<OrderInstallItemVo> oiiList = orderInstallItemDao.selectByOrderIdAndType(order.getId(), 2);
for (OrderInstallItemVo installItemVo : oiiList) {
Map<String, Object> zxMap = new HashMap<>(8);
zxMap.put("id",order.getId());
zxMap.put("installType",supplier.getName());
zxMap.put("orderType","增项费用");
zxMap.put("itemBrand",order.getOemName());
zxMap.put("itemName",installItemVo.getItemName());
zxMap.put("itemModel",installItemVo.getItemModel());
MaterialsDTO material = warehouseService.getMaterialById(installItemVo.getItemId());
if(material != null){
zxMap.put("materialsCode",material.getMaterialsCode());
zxMap.put("unit",material.getUnit());
}
zxMap.put("qunatity",installItemVo.getQunatity());
zxMap.put("ratePrice",installItemVo.getRatePrice());
zxMap.put("fee",installItemVo.getFee());
UserPayBill payBill = userPayBillService.getByRefId(order.getId());
if(payBill != null && payBill.getStatus() == 1){
zxMap.put("hasPay","是");
zxMap.put("payName",payBill.getPayAccount());
zxMap.put("payType",(payBill.getPayType()!=null && payBill.getPayType() == 3)?"微信":((payBill.getPayType()!=null && payBill.getPayType() == 4)?"支付宝":"其它"));
zxMap.put("payTime",DateUtil.formatDateTime(payBill.getPayTime()));
InvoiceVo invoiceVo = null;
try {
invoiceVo = invoiceService.getInvoiceByBillId(payBill.getId());
}catch (Exception e){
}
if(invoiceVo != null && invoiceVo.getStatus() > 0){
zxMap.put("invoiceType",invoiceVo.getInvoiceMaterial() == 1?"线下":"线上");
zxMap.put("invoiceName",invoiceVo.getInvoiceTitle());
zxMap.put("invoiceTime", DateUtil.formatDateTime(invoiceVo.getInvoiceTime()));
zxMap.put("invoiceNum",invoiceVo.getInvoiceNumber());
}else{
zxMap.put("invoiceType","");
zxMap.put("invoiceName","");
zxMap.put("invoiceTime","");
zxMap.put("invoiceNum","");
}
}else{
zxMap.put("hasPay","否");
zxMap.put("payName","");
zxMap.put("payType","");
zxMap.put("payTime","");
}
returnList.add(zxMap);
}
}
}
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.ScoreSupplierDTO;
import com.boco.nbd.wios.manage.service.impl.ScoreSupplierService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 服务商评分主表记录的excel导出
* @author haica
*/
@Service("Score_supplierExport")
public class ScoreSupplierExport implements Export<ScoreSupplierDTO> {
@Autowired
private ScoreSupplierService scoreSupplierService;
@Override
public List<ScoreSupplierDTO> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ScoreSupplierDTO condition = mapper.readValue(json, ScoreSupplierDTO.class);
return scoreSupplierService.getList(condition);
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.dto.SingleDTO;
import com.boco.nbd.wios.manage.entity.dto.SingleQuery;
import com.boco.nbd.wios.manage.service.impl.WarehouseService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 单据导出
*
* @author
* @version
*/
@Service
public class SingleExport implements Export<Map<String, Object>> {
@Autowired
private WarehouseService warehouseService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
SingleQuery singleQuery = mapper.readValue(json, SingleQuery.class);
List<SingleDTO> list = new ArrayList<>();
int page = 1;
int pagecount = 10;
while (true) {
singleQuery.setPage(page);
singleQuery.setPagecount(pagecount);
List<SingleDTO> list1 = warehouseService.qrySingal(singleQuery);
if (list1 == null || list1.isEmpty()) {
break;
}
list.addAll(list1);
if (list1.size() < pagecount)
break;
page++;
}
List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
for (SingleDTO dto : list) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(dto), Map.class);
if (dto.getType() != null)
// map.put("typeStr", WarehouseSingleType.getText(dto.getType().intValue()));
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.SupplierContractBo;
import com.boco.nbd.wios.manage.entity.bo.SupplierContractVo;
import com.boco.nbd.wios.manage.entity.cams.enums.ContractStatus;
import com.boco.nbd.wios.manage.service.impl.SupplierContractService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 服务商合同导出
*
* @author
* @version
*/
@Service
public class SupplierContractExport implements Export<Map<String, Object>> {
@Autowired
private SupplierContractService supplierContractService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
SupplierContractBo condition = mapper.readValue(json, SupplierContractBo.class);
List<SupplierContractVo> contractList = supplierContractService.getList(condition);
List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
int no = 1;
for (SupplierContractVo contract : contractList) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(contract), Map.class);
map.put("no", no++);
if (contract.getStartTime() != null)
map.put("startDateStr", sdf.format(contract.getStartTime()));
if (contract.getEndTime() != null)
map.put("endDateStr", sdf.format(contract.getEndTime()));
if (contract.getSignDate() != null)
map.put("signDateStr", sdf.format(contract.getSignDate()));
if (contract.getStatus() != null)
map.put("statusStr", ContractStatus.getText(contract.getStatus().intValue()));
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.SupplierBo;
import com.boco.nbd.wios.manage.entity.bo.SupplierVo;
import com.boco.nbd.wios.manage.service.impl.SupplierService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 服务商导出
*
* @author
* @version
*/
@Service
public class SupplierExport implements Export<SupplierVo> {
@Autowired
private SupplierService supplierService;
@Override
public List<SupplierVo> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
SupplierBo condition = mapper.readValue(json, SupplierBo.class);
List<SupplierVo> list = supplierService.getList(condition);
int no = 1;
for (SupplierVo vo : list) {
vo.setNo(no++);
}
return list;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.cams.core.constant.MessageConstant;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.settlement.po.SettlementDetailSupplier;
import com.boco.nbd.wios.manage.mapper.def.SettlementDetailSupplierDao;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ihidea.core.support.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 服务商结算单详情导出
*
* @author
* @version
*/
@Service
public class SupplierSettlementDetailExport implements Export<Map<String, Object>> {
@Autowired
private SettlementDetailSupplierDao settlementDao;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Map map = mapper.readValue(json, Map.class);
Object settlementId = map.get("settlementId");
if (settlementId == null) {
throw new ServiceException(MessageConstant.MISSING_PARAM);
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
List<SettlementDetailSupplier> list = settlementDao.selectBySettlementId(settlementId.toString());
for (SettlementDetailSupplier detail : list) {
Map<String, Object> m = mapper.readValue(mapper.writeValueAsString(detail), Map.class);
if (detail.getFinishTime() != null)
m.put("finishTimeStr", sdf.format(detail.getFinishTime()));
returnList.add(m);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.SupplierStaffBo;
import com.boco.nbd.wios.manage.entity.bo.SupplierStaffVo;
import com.boco.nbd.wios.manage.service.impl.SupplierStaffService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 电工导出
*
* @author xgl
* @version [版本号, 2020年11月5日]
*/
@Service
public class SupplierStaffExport implements Export<Map<String, Object>> {
@Autowired
private SupplierStaffService supplierStaffService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
SupplierStaffBo condition = mapper.readValue(json, SupplierStaffBo.class);
List<SupplierStaffVo> staffList = supplierStaffService.getList(condition);
List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
int no = 1;
for (SupplierStaffVo staff : staffList) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(staff), Map.class);
map.put("no", no++);
if (staff.getIsInsure() != null)
map.put("insureStr", staff.getIsInsure().intValue() == 0 ? "否" : "是");
if (staff.getCertExpire() != null)
map.put("certExpireStr", sdf.format(staff.getCertExpire()));
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import cn.hutool.core.bean.BeanUtil;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.flow.entity.po.OrderPO;
import com.boco.nbd.wios.flow.entity.vo.VisitOrderVO;
import com.boco.nbd.wios.flow.service.IOrderService;
import com.boco.nbd.wios.manage.entity.bo.OrderBo;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author:cao hai
* @date:2022/11/23 16:35
* @version:V1.0
* @description:回访订单导出
* @modify:
*/
@Service
public class VisitOrderExport implements Export<Map<String, Object>> {
@Autowired
private IOrderService orderService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
OrderBo condition = mapper.readValue(json, OrderBo.class);
List<VisitOrderVO> orderList = orderService.getVisitOrderDate(condition);
List<Map<String, Object>> returnList = new ArrayList<>(8);
for (VisitOrderVO order : orderList) {
Map<String, Object> map = BeanUtil.beanToMap(order);
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.dto.WarehouseDTO2;
import com.boco.nbd.wios.manage.entity.dto.WarehouseQuery2;
import com.boco.nbd.wios.manage.service.impl.WarehouseService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 仓库导出
*
* @author xgl
* @version [版本号, 2020年10月28日]
*/
@Service("WareHouseExport")
public class WarehouseExport implements Export<Map<String, Object>> {
@Autowired
private WarehouseService warehouseService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WarehouseQuery2 warehouseQuery = mapper.readValue(json, WarehouseQuery2.class);
List<WarehouseDTO2> list = new ArrayList<>();
int page = 1;
int pagecount = 10;
while (true) {
warehouseQuery.setPage(page);
warehouseQuery.setPagecount(pagecount);
List<WarehouseDTO2> list1 = warehouseService.qryWarehouseDetailList(warehouseQuery);
if (list1 == null || list1.isEmpty()) {
break;
}
list.addAll(list1);
if (list1.size() < pagecount) {
break;
}
page++;
}
List<Map<String, Object>> returnList = new ArrayList<>(8);
for (WarehouseDTO2 dto : list) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(dto), Map.class);
if (!StringUtils.isEmpty(dto.getWarehouseAttribution())) {
map.put("attributionName", dto.getWarehouseAttribution().equals("1") ? "CAMS仓库" : "安装服务商仓库");
}
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.export.impl;
import com.boco.nbd.wios.export.Export;
import com.boco.nbd.wios.manage.entity.bo.WarrantyOrder;
import com.boco.nbd.wios.manage.entity.bo.WarrantyOrderBo;
import com.boco.nbd.wios.manage.service.impl.OrderService;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class WarrantyOrderExport implements Export<Map<String, Object>> {
@Autowired
private OrderService orderService;
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WarrantyOrderBo condition = mapper.readValue(json, WarrantyOrderBo.class);
List<WarrantyOrder> orderList = orderService.getWarrantyOrders(condition);
List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
int no = 1;
for (WarrantyOrder order : orderList) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(order), Map.class);
map.put("no", no++);
if (order.getStartTime() != null) {
map.put("startTimeStr", sdf.format(order.getStartTime()));
}
if (order.getEndTime() != null) {
map.put("endTimeStr", sdf.format(order.getEndTime()));
}
returnList.add(map);
}
return returnList;
}
}
package com.boco.nbd.wios.flow.controller;
import cn.hutool.core.lang.Assert;
import com.boco.nbd.wios.flow.entity.vo.AppOrderDetailVO;
import com.boco.nbd.wios.flow.entity.vo.AppOrderInstallVO;
import com.boco.nbd.wios.flow.entity.vo.AppOrderVO;
import com.boco.nbd.wios.flow.entity.vo.AppPayBillVO;
import com.boco.nbd.wios.flow.service.IAppOrderService;
import com.boco.nbd.wios.manage.entity.bo.MaterialConfig;
import com.boco.nbd.wios.manage.entity.bo.OrderScoreDTO;
import com.boco.nbd.wios.manage.service.impl.OrderScoreService;
import com.boco.nbd.wios.manage.service.impl.OrderService;
import com.ihidea.component.api.v2.BaseResponse;
import com.ihidea.core.support.exception.ServiceException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
/**
* @author:cao hai
* @date:2022/10/27 10:35
* @version:V1.0
* @description:CAMS APP 接口保留原先一期格式规范 也没需求,接口格式还不让调整,拷贝原先的代码实现
* @modify:
*/
@RestController
@Slf4j
@RequestMapping("/api2")
@Api(tags = "CamsApp接口")
public class AppOrderController {
@Autowired
private IAppOrderService appOrderService;
@Autowired
private OrderScoreService orderScoreService;
@Autowired
private OrderService orderService;
/**
* 查询订单评分
*
* @return
*/
@GetMapping(value = "orderScore/getOrderScoreByOrderId")
@ApiOperation(value = "查询订单评分")
@ApiImplicitParam(paramType = "query", name = "orderId", value = "订单表ID", required = true, dataType = "String")
public BaseResponse<Object> list(String orderId) {
return new BaseResponse<>(orderScoreService.getOrderScoreByOrderId(orderId));
}
/**
* 保存订单回访信息
* description
*
* @param list
*/
@PostMapping(value = "orderScore/save")
@ApiOperation(value = "保存订单回访信息")
@ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "visitContent", value = "意见或建议", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "files", value = "图片地址,多个逗号分割", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "list", value = "格式:[{\"id\":9,\"score\":70,\"description\":\"描述\"},{\"id\":12,\"score\":60,\"description\":\"描述\"}]", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "knowAfterSalesChannel", value = "是否了解墙盒售后问题反馈渠道:0-否,1:是", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "installLength", value = "墙盒线缆的安装长度", dataType = "int", paramType = "query", required = true),
})
public BaseResponse<Object> save(String orderId, String visitContent, String files, String list, Integer knowAfterSalesChannel, Integer installLength) {
return orderService.saveOrderScore(orderId, visitContent, files, list, knowAfterSalesChannel, installLength);
}
@GetMapping(value = "order/qryList")
@ApiOperation(value = "查询订单列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "camsPhone", value = "cams手机号", dataType = "String", paramType = "query", required = true),})
public BaseResponse<List<AppOrderVO>> getList(String camsPhone) {
Assert.notEmpty(camsPhone, "手机号不能为空");
return new BaseResponse<>(appOrderService.queryOrderList(camsPhone));
}
@GetMapping(value = "order/qryOrderDetail")
@ApiOperation(value = "查询订单详情")
@ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "工单号", dataType = "String", paramType = "query", required = true),})
public BaseResponse<AppOrderDetailVO> qryOrderDetail(String orderId) {
Assert.notEmpty(orderId, "工单号不能为空");
AppOrderDetailVO result = appOrderService.getOrderDetail(orderId);
return new BaseResponse<>(result);
}
@GetMapping(value = "order/qryInstallDetail")
@ApiOperation(value = "查询安装订单详情")
@ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "工单号", dataType = "String", paramType = "query", required = true),})
public BaseResponse<AppOrderInstallVO> qryInstallDetail(String orderId) {
Assert.notEmpty(orderId, "工单号不能为空");
AppOrderInstallVO orderInstallDTO = appOrderService.getInstallDetail(orderId);
return new BaseResponse<>(orderInstallDTO);
}
@GetMapping(value = "order/qryExpandIntro")
@ApiOperation(value = "查询报装说明")
@ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "工单号", dataType = "String", paramType = "query", required = true),})
public BaseResponse<String> getExpandIntro(String orderId) {
Assert.notEmpty(orderId, "缺少参数");
MaterialConfig mc = appOrderService.getExpandIntro(orderId);
if (mc != null) {
return new BaseResponse<>(mc.getContent());
} else {
return new BaseResponse<>();
}
}
/**
* 查询账单列表
*
* @param camsPhone
* @param orderId
* @param status
* @return
*/
@GetMapping(value = "order/qryBillList")
@ApiOperation(value = "查询账单列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "camsPhone", value = "cams手机号", dataType = "String", paramType = "query", required = false),
@ApiImplicitParam(name = "orderId", value = "工单号", dataType = "String", paramType = "query", required = false),
@ApiImplicitParam(name = "status", value = "状态 0-未支付 1-已支付", dataType = "int", paramType = "query", required = false),})
public BaseResponse<List<AppPayBillVO>> qryBillList(String camsPhone, String orderId, Integer status) {
if (!StringUtils.isEmpty(camsPhone) && !StringUtils.isEmpty(orderId)) {
throw new ServiceException("cams手机号和工单号不能同时为空");
}
List<AppPayBillVO> list = appOrderService.qryBill(camsPhone, orderId, status);
return new BaseResponse<>(list);
}
/**
* 报装
*
* @param orderId
* @param expandStatus
* @param expandFailReason
* @param expandFailOperate
*/
@PostMapping(value = "order/expand")
@ApiOperation(value = "报装")
@ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "expandStatus", value = "报装状态 1:通过 2:不通过", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "expandFailReason", value = "报装不通过原因", dataType = "String", paramType = "query", required = false),
@ApiImplicitParam(name = "expandFailOperate", value = "报装不通过后订单后续操作 1:换其他用电类型继续安装 2:不安装了", dataType = "int", paramType = "query", required = false),})
public BaseResponse<Object> expand(String orderId, Integer expandStatus, String expandFailReason, Integer expandFailOperate) {
if (StringUtils.isEmpty(orderId) || expandStatus == null) {
throw new ServiceException("缺少参数");
}
Integer[] items = {1, 2};
if (!Arrays.asList(items).contains(expandStatus)) {
throw new ServiceException("状态不合法");
}
appOrderService.expand(orderId, expandStatus, expandFailReason, expandFailOperate);
return new BaseResponse<>();
}
}
package com.boco.nbd.wios.flow.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.boco.nbd.framework.common.ResponseMessage2;
import com.boco.nbd.wios.export.PoiUtil;
import com.boco.nbd.wios.flow.entity.bo.ManualSapBo;
import com.boco.nbd.wios.flow.entity.po.OrderAbnormalPO;
import com.boco.nbd.wios.flow.entity.po.OrderPO;
import com.boco.nbd.wios.flow.enums.OrderInfoEnum;
import com.boco.nbd.wios.flow.service.IOrderAbnormalService;
import com.boco.nbd.wios.flow.service.IOrderService;
import com.boco.nbd.wios.flow.util.ProcessUtil;
import com.boco.nbd.wios.flow.util.ValidUtil;
import com.boco.nbd.wios.manage.contants.WiosConstant;
import com.boco.nbd.wios.flow.entity.pdf.BlockPairBo;
import com.boco.nbd.wios.manage.service.impl.OrderInvoiceService;
import com.ihidea.core.support.session.SessionInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
* @Description 订单管理处理类
* @Author Yu
* @Date 2022/7/11
*/
@RestController
@Slf4j
@RequestMapping("/camsOrder")
@Api(tags = "新版本订单管理接口")
public class FlowOrderController {
@Autowired
private IOrderService orderService;
@Autowired
private IOrderAbnormalService orderAbnormalService;
@Autowired
private OrderInvoiceService orderInvoiceService;
@PostMapping(value = "order/pushSapOrder")
@ApiOperation(value = "同步订单到sap")
public ResponseMessage2 pushSapOrder(@RequestBody ManualSapBo bo) {
try {
orderService.pushSapOrder(bo);
return ResponseMessage2.Success2(bo.getId() + "重推SAP成功。");
} catch (Exception ex) {
return ResponseMessage2.Failed(bo.getId() + "重推SAP失败:" + ex.getMessage());
}
}
/**
* 批量更新开票信息
*
* @param invoiceJson
* @return
*/
@PostMapping(value = "orderInvoice/batchUpdate")
@ApiOperation(value = "批量更新开票信息", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "invoiceJson", value = "json数据", dataType = "String", paramType = "query", required = true),})
public ResponseMessage2 batchImportInvoiceData(String invoiceJson) {
if (StrUtil.isEmpty(invoiceJson)) {
return ResponseMessage2.Failed("缺少参数");
}
try {
orderInvoiceService.processBatchUpdate(invoiceJson);
} catch (Exception ex) {
return ResponseMessage2.Failed(ex.getMessage());
}
return ResponseMessage2.Success();
}
@ApiOperation("获取工单信息:type=1 勘测详情;type=2 安装详情;type缺失或者其它值 基本信息")
@GetMapping(value = "/getOrderInfo")
public ResponseMessage2 getOrderInfo(@RequestParam(value = "id") String id, @RequestParam(value = "type", required = false) Integer type) {
try {
OrderInfoEnum infoEnum = OrderInfoEnum.getEnum(type);
return ResponseMessage2.Success2(orderService.getOrderInfo(id, infoEnum));
} catch (Exception ex) {
return ResponseMessage2.Failed("getOrderInfo:" + ex.getMessage());
}
}
@GetMapping(value = "exportOrderDocx.do")
@ApiOperation(value = "导出工单Docx,type=1 勘测详情;type=2 安装详情;===>调整成前端实现")
@ApiIgnore
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "工单Id", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "type", value = "类型", dataType = "Integer", paramType = "query", required = true)})
public void exportOrderDocx(HttpServletResponse response, String id, Integer type) throws Exception {
OrderInfoEnum infoEnum = OrderInfoEnum.getEnum(type);
if (OrderInfoEnum.BASE_INFO.equals(infoEnum)) {
infoEnum = OrderInfoEnum.SURVEY_INFO;
}
Map<String, Object> dataMap = orderService.getOrderInfo(id, infoEnum);
String fileName = OrderInfoEnum.SURVEY_INFO.equals(infoEnum) ? WiosConstant.SURVEY_ORDER_DOCX : WiosConstant.INSTALL_ORDER_DOCX;
String templateName = OrderInfoEnum.SURVEY_INFO.equals(infoEnum) ? WiosConstant.SURVEY_ORDER_DOCX_TEMPLATE : WiosConstant.INSTALL_ORDER_DOCX_TEMPLATE;
PoiUtil.exportOrderDocx(response, dataMap, fileName, templateName);
}
@PostMapping("order/add")
@ApiOperation(value = "订单管理-添加派单信息")
public ResponseMessage2 add(OrderPO order) {
OrderAbnormalPO orderAbnormalPO = new OrderAbnormalPO();
BeanUtil.copyProperties(order, orderAbnormalPO);
SessionInfo sessionInfo = ProcessUtil.getUserInfo();
if (sessionInfo == null) {
return ResponseMessage2.Failed(ProcessUtil.RE_LOGIN);
}
order.setCreateAccount(sessionInfo.getUserId());
order.setCreateAccountName(sessionInfo.getUserName());
//车主姓名
if (StringUtils.isBlank(order.getUserName()) ||
//车主电话
!ValidUtil.isMobileSimple(order.getUserPhone()) ||
//车型
StringUtils.isBlank(order.getVehicleModel()) ||
//主机厂
StringUtils.isBlank(order.getOemName()) ||
//主机厂业务代码
order.getOemId() == null ||
//是否需要人工派单
order.getManuDispatchEnable() == null ||
//区域
// StringUtils.isBlank(order.getArea()) ||
//安装地址
StringUtils.isBlank(order.getAddress()) ||
//是否为售车前预勘测
order.getSurveyBeforeSaleEnable() == null ||
//是否联系上客户
order.getIsConnect() == null ||
//是否需要勘测
order.getIsNeedSurvey() == null ||
//安装紧急程度
order.getInstallEmergencyLevel() == null) {
orderAbnormalService.insertSelective(orderAbnormalPO);
return ResponseMessage2.Failed("异常订单");
}
return orderService.startFlow(order);
}
@GetMapping("order/getOemCascade")
@ApiOperation(value = "订单管理-主机厂和套包类型级联关系")
@ApiImplicitParams({@ApiImplicitParam(name = "oemId", value = "主机厂ID", dataType = "String", paramType = "query", required = true)
})
public ResponseMessage2 getOemCascade(String oemId) {
return ResponseMessage2.Success2(orderService.getOemCascade(oemId));
}
/**
* @Description 订单附件生成pdf
* @Param
* @author miaoguoqing
* @date 2022/10/27
*/
@PostMapping(value = "order/autogeneratePdf")
@ApiOperation(value = "订单附件生成pdf")
public void getAutogeneratePdf(@RequestBody BlockPairBo blockPairBo, HttpServletResponse response) throws IOException {
try {
orderService.getAutogeneratePdf(blockPairBo, response);
} catch (Exception e) {
log.error("生成PDF失败!", e);
throw new IOException(e.getMessage());
}
}
}
package com.boco.nbd.wios.flow.controller;
import cn.hutool.core.collection.CollUtil;
import com.boco.nbd.cams.core.util.LambdaUtils;
import com.boco.nbd.framework.common.PageData;
import com.boco.nbd.framework.common.ResponseMessage2;
import com.boco.nbd.framework.parent.microservice.exception.ErrorInfoException;
import com.boco.nbd.wios.flow.entity.po.HolidayPO;
import com.boco.nbd.wios.flow.service.IHolidayService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
import java.util.UUID;
/**
* @Description: 节假日配置
* @Author: ZQY
* @Date: 2022/8/25
**/
@RestController
@Slf4j
@RequestMapping("holidayConfig")
@Api(tags = "节假日配置")
public class HolidayController {
@Autowired
private IHolidayService holidayService;
@ApiOperation(value = "查询节假日配置")
@GetMapping("/getList")
public ResponseMessage2<PageData<HolidayPO>> getList(int pageIndex, int pageSize){
Page<HolidayPO> result = PageHelper.startPage(pageIndex, pageSize);
holidayService.getList();
return ResponseMessage2.Success2(PageData.create2(result.getTotal(),result.getResult()));
}
@ApiOperation(value = "新增节假日配置")
@PostMapping("/add")
public ResponseMessage2<Boolean> add(HolidayPO po){
Example example = new Example(HolidayPO.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo(LambdaUtils.getFieldName(HolidayPO::getHolidayDate), po.getHolidayDate());
List<HolidayPO> holidayPOList= holidayService.selectByExample(example);
if(CollUtil.isNotEmpty(holidayPOList)){
throw new ErrorInfoException("存在重复数据!");
}
po.setId(UUID.randomUUID().toString());
holidayService.insert(po);
return ResponseMessage2.Success();
}
@ApiOperation(value = "删除节假日配置")
@PostMapping("/delete")
public ResponseMessage2<Boolean> delete(HolidayPO po){
holidayService.delete(po);
return ResponseMessage2.Success();
}
@ApiOperation(value = "修改节假日配置")
@PostMapping("/update")
public ResponseMessage2<Boolean> update(HolidayPO po){
Example example = new Example(HolidayPO.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo(LambdaUtils.getFieldName(HolidayPO::getHolidayDate), po.getHolidayDate());
List<HolidayPO> holidayPOList= holidayService.selectByExample(example);
if(CollUtil.isNotEmpty(holidayPOList)){
throw new ErrorInfoException("存在重复数据!");
}
holidayService.updateByPrimaryKey(po);
return ResponseMessage2.Success();
}
@ApiOperation(value = "导入节假日配置")
@PostMapping("/importExcel")
public ResponseMessage2<Boolean> importExcel(@RequestParam("file") MultipartFile excel) {
return holidayService.importExcel(excel);
}
}
package com.boco.nbd.wios.flow.controller;
import cn.hutool.core.date.DateUtil;
import com.boco.nbd.wios.flow.imports.Import;
import com.ihidea.core.support.SpringContextLoader;
import com.ihidea.core.support.exception.ServiceException;
import com.ihidea.core.support.servlet.ServletHolderFilter;
import com.ihidea.core.util.FileUtilsEx;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import jxl.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author:cao hai
* @date:2022/6/29 14:04
* @version:V1.0
* @description:ImportController
* @modify:
*/
@RestController
@Api(tags = "导入模块")
@Slf4j
public class ImportController {
/**
* excel导入数据解析
*
* @param request
* @param serviceName
* @return
*/
@PostMapping(value = "import.do")
@ApiOperation(value = "导入excel")
@ApiImplicitParams({
@ApiImplicitParam(name = "serviceName", value = "service名称", dataType = "String", paramType = "query", required = true),})
public List<?> importCommon(HttpServletRequest request, String serviceName) {
log.info("start " + serviceName);
Map<String, Object> param = ServletHolderFilter.getContext().getParamMap();
List<Object[]> fileList = new ArrayList<>();
for (String nameKey : param.keySet()) {
Object obj = param.get(nameKey);
if (obj != null && obj instanceof List && ((List) obj).size() > 0) {
Object fileItem = ((List) obj).get(0);
if (fileItem instanceof DiskFileItem) {
// 如果是servlet2上传的文件
List<DiskFileItem> diskFileItemList = (List<DiskFileItem>) obj;
for (DiskFileItem file : diskFileItemList) {
String fileName = FileUtilsEx.getFileNameByPath(file.getName());
byte[] fileContent = file.get();
fileList.add(new Object[]{fileName, fileContent});
}
}
}
}
Import importClass = null;
if (!StringUtils.isEmpty(serviceName)) {
// 获取serviceName对应的bean
importClass = SpringContextLoader.getBean(serviceName, Import.class);
}
// 返回的结果list
List<Object> list = new ArrayList<>();
Workbook rwb = null;
log.info("start " + serviceName + " file read.");
try {
// 输入流获取对象
rwb = Workbook.getWorkbook(new ByteArrayInputStream((byte[]) fileList.get(0)[1]));
// 获取页数数组
Sheet[] sheetArr = rwb.getSheets();
for (Sheet rs : sheetArr) {
Cell[] headCells = rs.getRow(0);
int headCellSize = headCells.length;
// 每页行数
for (int i = 0; i < rs.getRows(); i++) {
List<String> cellList = new ArrayList<>();
// 每行单元数组
Cell[] cells = rs.getRow(i);
for (Cell cell : cells) {
if (cell.getType() == CellType.DATE) {
DateCell dc = (DateCell) cell;
cellList.add(DateUtil.date(dc.getDate()).toDateStr());
} else {
cellList.add(cell.getContents());
}
}
if (headCellSize > cells.length) {
for (int k = 0; k < headCellSize - cells.length; k++) {
cellList.add("");
}
}
list.add(cellList);
}
}
} catch (Exception e) {
log.error(serviceName + "error:", e);
throw new ServiceException(e.getMessage());
} finally {
// 关闭数据流
if (rwb != null) {
rwb.close();
}
}
if (importClass != null) {
// 返回具体实现类处理结果
List<?> returnList = importClass.handle(list);
returnList.remove(0);
return returnList;
} else {
list.remove(0);
return list;
}
}
}
package com.boco.nbd.wios.flow.controller;
import com.boco.nbd.framework.common.PageData;
import com.boco.nbd.framework.common.ResponseMessage2;
import com.boco.nbd.wios.flow.entity.bo.OrderTempBO;
import com.boco.nbd.wios.flow.service.IImportOrderService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* @Description: TODO
* @Author: ZQY
* @Date: 2022/7/19
**/
@RestController
@Slf4j
@RequestMapping("importOrder")
@Api(tags = "订单导入")
public class ImportOrderController {
@Autowired
private IImportOrderService importOrderService;
/**
* 导入订单
* @param excel
* @return
*/
@PostMapping("order/importExcel")
@ApiOperation(value = "订单导入")
public ResponseMessage2 importExcel(@RequestParam("file") MultipartFile excel,@RequestParam("type") Integer type) {
return importOrderService.importExcel(excel,type);
}
/**
* 获取导入订单列表
*
* @param
* @return
*/
@ApiOperation(value = "获取导入订单列表")
@GetMapping(value = "/getList")
public ResponseMessage2<PageData<OrderTempBO>> getList(Integer type, int pageIndex, int pageSize) {
Page<OrderTempBO> result = PageHelper.startPage(pageIndex, pageSize);
importOrderService.getImportOrderAll(type);
return ResponseMessage2.Success2(PageData.create2(result.getTotal(),result.getResult()));
}
/**
* 批量删除导入订单
* @param ids
* @return
*/
@ApiOperation(value = "批量删除导入订单")
@PostMapping(value = "/deleteImportOrder")
public ResponseMessage2 deleteImportOrder(@RequestParam("ids")List<String> ids) {
return importOrderService.deleteImportOrder(ids);
}
/**
* 批量生成新订单
* @param ids
* @return
*/
@ApiOperation(value = "批量生成新订单")
@PostMapping(value = "/addOrder")
@ApiImplicitParams({@ApiImplicitParam(name = "ids", value = "导入订单id", paramType = "query", required = false),
@ApiImplicitParam(name = "stateAll", value = "全选状态:0-非全选,1-全选", dataType = "String", paramType = "query", required = false)})
public ResponseMessage2 addOrder(@RequestParam("ids")List<String> ids,String stateAll) {
importOrderService.addOrder(ids,stateAll);
return ResponseMessage2.Success();
}
}
package com.boco.nbd.wios.flow.controller;
import com.boco.nbd.framework.common.PageData;
import com.boco.nbd.framework.common.ResponseMessage2;
import com.boco.nbd.wios.flow.entity.bo.OrderAbnormalBO;
import com.boco.nbd.wios.flow.entity.po.OrderAbnormalPO;
import com.boco.nbd.wios.flow.service.IOrderAbnormalService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Description: OrderAbnormalController
* @Author: ZQY
* @Date: 2022/7/12
**/
@RestController
@Slf4j
@RequestMapping("orderAbnormal")
@Api(tags = "异常订单")
public class OrderAbnormalController {
@Autowired
private IOrderAbnormalService orderAbnormalService;
/**
* 获取异常订单列表
* @param pageIndex
* @param pageSize
* @return
*/
@ApiOperation(value = "获取异常订单列表")
@GetMapping(value = "/getList")
public ResponseMessage2<PageData<OrderAbnormalBO>> getList(int pageIndex, int pageSize) {
Page<OrderAbnormalBO> result = PageHelper.startPage(pageIndex, pageSize);
orderAbnormalService.getOrderAbnormalAll();
return ResponseMessage2.Success2(PageData.create2(result.getTotal(),result.getResult()));
}
/**
* 获取异常订单详情
* @param id
* @return
*/
@ApiOperation(value = "获取异常订单详情")
@GetMapping(value = "/getOrderAbnormal")
public ResponseMessage2<OrderAbnormalPO> getOrderAbnormal(String id) {
return ResponseMessage2.Success2(orderAbnormalService.selectByPrimaryKey(id));
}
/**
* 修改异常订单
* @param po
* @return
*/
@ApiOperation(value = "修改异常订单")
@PostMapping(value = "/update")
public ResponseMessage2<Boolean> updateOrderAbnormal(OrderAbnormalPO po){
try{
orderAbnormalService.updateByPrimaryKeySelective(po);
return ResponseMessage2.Success();
}catch (Exception e) {
e.printStackTrace();
log.error("修改异常订单",e.getMessage());
return ResponseMessage2.Failed(e.getMessage());
}
}
/**
* 新增异常订单
* @param po
* @return
*/
@ApiOperation(value = "新增异常订单")
@PostMapping(value = "/add")
public ResponseMessage2 saveOrderAbnormal(OrderAbnormalPO po) {
try{
orderAbnormalService.insertSelective(po);
return ResponseMessage2.Success();
}catch (Exception e) {
e.printStackTrace();
log.error("新增异常订单",e.getMessage());
return ResponseMessage2.Failed(e.getMessage());
}
}
}
package com.boco.nbd.wios.flow.controller;
import com.boco.nbd.framework.common.ResponseMessage2;
import com.boco.nbd.framework.common.util.IdUtil;
import com.boco.nbd.wios.flow.entity.po.OrderBlockedPO;
import com.boco.nbd.wios.flow.service.IOrderBlockedService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description: OrderBlockedController
* @Author: ZQY
* @Date: 2022/8/4
**/
@RestController
@Slf4j
@RequestMapping("orderBlocked")
@Api(tags = "工单受阻")
public class OrderBlockedController {
@Autowired
private IOrderBlockedService orderBlockedService;
/**
* 新增受阻信息
*
* @param po
* @return
*/
@ApiOperation(value = "新增受阻信息")
@PostMapping(value = "/add")
public ResponseMessage2<Boolean> saveOrderBlocked(OrderBlockedPO po) {
try {
po.setId(IdUtil.getLongUUID()+"");
orderBlockedService.insertSelective(po);
return ResponseMessage2.Success();
} catch (Exception e) {
e.printStackTrace();
log.error("新增受阻信息",e.getMessage());
return ResponseMessage2.Failed(e.getMessage());
}
}
/**
* 获取受阻信息列表
*
* @param
* @return
*/
@ApiOperation(value = "获取受阻信息列表")
@ApiImplicitParams({@ApiImplicitParam(name = "orderId", value = "订单ID", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "nodeFlag", value = "流程节点标识", dataType = "String", paramType = "query", required = false)})
@GetMapping(value = "/getList")
public ResponseMessage2<List<OrderBlockedPO>> getList(String orderId, String nodeFlag) {
return ResponseMessage2.Success2(orderBlockedService.getList(orderId,nodeFlag));
}
}
package com.boco.nbd.wios.flow.controller;
import com.boco.nbd.cams.core.util.LambdaUtils;
import com.boco.nbd.framework.common.PageData;
import com.boco.nbd.framework.common.ResponseMessage2;
import com.boco.nbd.framework.common.util.IdUtil;
import com.boco.nbd.framework.parent.microservice.exception.ErrorInfoException;
import com.boco.nbd.wios.flow.entity.po.PlanTaskPO;
import com.boco.nbd.wios.flow.service.IPlanTaskService;
import com.boco.nbd.wios.flow.util.ProcessUtil;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ihidea.core.support.session.SessionInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* @Description: TODO
* @Author: ZQY
* @Date: 2022/8/11
**/
@RestController
@Slf4j
@RequestMapping("planTask")
@Api(tags = "计划任务配置")
public class PlanTaskController {
@Autowired
private IPlanTaskService planTaskService;
/**
* 新增计划任务
*
* @param po
* @return
*/
@ApiOperation(value = "新增计划任务")
@PostMapping(value = "/addPlanTask")
public ResponseMessage2 savePlanTask(PlanTaskPO po) {
try {
Example example = new Example(PlanTaskPO.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo(LambdaUtils.getFieldName(PlanTaskPO::getYear), po.getYear());
criteria.andEqualTo(LambdaUtils.getFieldName(PlanTaskPO::getOemName), po.getOemName());
List<PlanTaskPO> planTaskPOList = planTaskService.selectByExample(example);
if (planTaskPOList.size() > 0) {
throw new ErrorInfoException("存在(" + po.getYear() + "+" + po.getOemName() + ")重复数据!");
}
po.setId(IdUtil.getLongUUID() + "");
SessionInfo user = ProcessUtil.getUserInfo();
po.setCreateUser(user == null ? "" : user.getUserId());
planTaskService.insertSelective(po);
return ResponseMessage2.Success();
} catch (Exception e) {
e.printStackTrace();
log.error("新增计划任务", e.getMessage());
return ResponseMessage2.Failed(e.getMessage());
}
}
/**
* 修改计划任务
*
* @param po
* @return
*/
@ApiOperation(value = "修改计划任务")
@PostMapping(value = "/updatePlanTask")
public ResponseMessage2 updatePlanTask(PlanTaskPO po) {
try {
Example example = new Example(PlanTaskPO.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo(LambdaUtils.getFieldName(PlanTaskPO::getYear), po.getYear());
criteria.andEqualTo(LambdaUtils.getFieldName(PlanTaskPO::getOemName), po.getOemName());
planTaskService.updateByPrimaryKeySelective(po);
return ResponseMessage2.Success();
} catch (Exception e) {
e.printStackTrace();
log.error("修改计划任务", e.getMessage());
return ResponseMessage2.Failed(e.getMessage());
}
}
/**
* 删除计划任务
*
* @param id
* @return
*/
@ApiOperation(value = "删除计划任务")
@PostMapping(value = "/deletePlanTask")
public ResponseMessage2 deletePlanTask(@RequestParam("id") String id) {
try {
Example example = new Example(PlanTaskPO.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo(LambdaUtils.getFieldName(PlanTaskPO::getId), id);
planTaskService.deleteByExample(example);
return ResponseMessage2.Success();
} catch (Exception e) {
e.printStackTrace();
log.error("删除计划任务", e.getMessage());
return ResponseMessage2.Failed(e.getMessage());
}
}
/**
* 获取计划任务列表
*
* @param
* @return
*/
@ApiOperation(value = "获取计划任务列表")
@GetMapping(value = "/getList")
public ResponseMessage2<PageData<PlanTaskPO>> getList(int pageIndex, int pageSize) {
Page<PlanTaskPO> result = PageHelper.startPage(pageIndex, pageSize);
planTaskService.selectAll();
return ResponseMessage2.Success2(PageData.create2(result.getTotal(), result.getResult()));
}
/**
* 导入计划任务列表
*
* @param excel
* @return
*/
@ApiOperation(value = "导入计划任务配置")
@PostMapping("/importExcel")
public ResponseMessage2 importExcel(@RequestParam("file") MultipartFile excel) {
return planTaskService.importExcel(excel);
}
@ApiOperation(value = "根据年份和主机厂查询计划任务")
@PostMapping("/getPlanTaskByYearAndOemId")
@ApiImplicitParams({@ApiImplicitParam(name = "year", value = "年份", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "oemId", value = "主机厂ID", dataType = "String", paramType = "query", required = false)})
public ResponseMessage2 getPlanTaskByYearAndOemId(String year, Integer oemId) {
return ResponseMessage2.Success2(planTaskService.getPlanTaskByYearAndOemId(year, oemId));
}
}
package com.boco.nbd.wios.flow.controller;
import com.boco.nbd.framework.common.PageData;
import com.boco.nbd.framework.common.ResponseMessage2;
import com.boco.nbd.wios.flow.entity.bo.InstallationCompletionRateBO;
import com.boco.nbd.wios.flow.entity.bo.InstallationDataStatisticsBO;
import com.boco.nbd.wios.flow.entity.bo.InstallationDurationStatisticsBO;
import com.boco.nbd.wios.flow.entity.bo.ReportStatisticsBO;
import com.boco.nbd.wios.flow.service.IReportStatisticsService;
import com.boco.nbd.wios.flow.util.ProcessUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException;
import java.util.List;
/**
* @Description: TODO
* @Author: ZQY
* @Date: 2022/8/29
**/
@RestController
@Slf4j
@RequestMapping("reportStatistics")
@Api(tags = "新版本报表统计接口")
public class ReportStatisticsController {
@Autowired
private IReportStatisticsService reportStatisticsService;
/**
* 充电桩安装数据统计
* @param bo
* @return
*/
@ApiOperation(value = "充电桩安装数据统计")
@GetMapping(value = "/getInstallationDataStatistics")
public ResponseMessage2<PageData<InstallationDataStatisticsBO>> getInstallationDataStatistics(ReportStatisticsBO bo,int pageIndex, int pageSize){
List<InstallationDataStatisticsBO> list= ProcessUtil.getPageInfo(pageIndex,pageSize,reportStatisticsService.getInstallationDataStatistics(bo));
return ResponseMessage2.Success2(PageData.create2((long)list.size() ,list));
}
/**
* 充电桩安装订单时长统计
* @param bo
* @return
*/
@ApiOperation(value = "充电桩安装订单时长统计")
@GetMapping(value = "/getInstallationDurationStatistics")
public ResponseMessage2<PageData<InstallationDurationStatisticsBO>> getInstallationDurationStatistics(ReportStatisticsBO bo, int pageIndex, int pageSize){
List<InstallationDurationStatisticsBO> list= ProcessUtil.getPageInfo(pageIndex,pageSize,reportStatisticsService.getInstallationDurationStatistics(bo));
return ResponseMessage2.Success2(PageData.create2((long)list.size() ,list));
}
/**
* 首联时效统计
* @param bo
* @return
*/
@ApiOperation(value = "首联时效统计")
@GetMapping(value = "/getFirstTimeStatistics")
public ResponseMessage2 getFirstTimeStatistics(ReportStatisticsBO bo) {
return ResponseMessage2.Success2(reportStatisticsService.getTimeStatistics(bo,"getFirstTimeStatistics"));
}
/**
* 勘测时效统计
* @param bo
* @return
*/
@ApiOperation(value = "勘测时效统计")
@GetMapping(value = "/getSurveyTimeStatistics")
public ResponseMessage2 getSurveyTimeStatistics(ReportStatisticsBO bo) {
return ResponseMessage2.Success2(reportStatisticsService.getTimeStatistics(bo,"getSurveyTimeStatistics"));
}
/**
* 勘测审核时效统计
* @param bo
* @return
*/
@ApiOperation(value = "勘测审核时效统计")
@GetMapping(value = "/getSurveyExamineTimeStatistics")
public ResponseMessage2 getSurveyxamineTimeStatistics(ReportStatisticsBO bo) {
return ResponseMessage2.Success2(reportStatisticsService.getTimeStatistics(bo,"getSurveyExamineTimeStatistics"));
}
/**
* 平均安装时效统计
* @param bo
* @return
*/
@ApiOperation(value = "平均安装时效统计 ")
@GetMapping(value = "/getAvgTimeStatistics")
public ResponseMessage2 getAvgTimeStatistics(ReportStatisticsBO bo) {
return ResponseMessage2.Success2(reportStatisticsService.getTimeStatistics(bo,"getAvgTimeStatistics"));
}
@ApiOperation(value = "安装完成率统计 ")
@GetMapping(value = "/getInstallationCompletionRate")
public ResponseMessage2<PageData<InstallationCompletionRateBO>> getInstallationCompletionRate(ReportStatisticsBO bo, int pageIndex, int pageSize){
List<InstallationCompletionRateBO> list= ProcessUtil.getPageInfo(pageIndex,pageSize,reportStatisticsService.getInstallationCompletionRate(bo));
return ResponseMessage2.Success2(PageData.create2((long)list.size() ,list));
}
@ApiOperation(value = "平均运行时长(非电力报装)统计 ")
@GetMapping(value = "/getAverageRunningTime")
public ResponseMessage2 getAverageRunningTime(ReportStatisticsBO bo){
return ResponseMessage2.Success2(reportStatisticsService.getTimeStatistics(bo,"getAverageRunningTime"));
}
@ApiOperation(value = "平均运行时长(电力报装)统计 ")
@GetMapping(value = "/getAverageRunningTime1")
public ResponseMessage2 getAverageRunningTime1(ReportStatisticsBO bo) {
return ResponseMessage2.Success2(reportStatisticsService.getTimeStatistics(bo,"getAverageRunningTime1"));
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论