Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
0d927e17
Commit
0d927e17
authored
Dec 17, 2020
by
罗承锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交页面基础功能报错、配置网点充值奖励机制
parent
a43c27c0
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1019 additions
and
142 deletions
+1019
-142
common/src/main/java/com/winsun/bean/School.java
+24
-0
common/src/main/java/com/winsun/bean/activity/HhrActivity.java
+5
-6
common/src/main/java/com/winsun/bean/activity/HhrActivityRecord.java
+10
-4
core-service/src/main/resources/log4j2.xml
+2
-2
migration/pom.xml
+102
-0
migration/src/main/java/com/winsun/migration/MigrationApplication.java
+22
-0
migration/src/main/java/com/winsun/migration/controller/MigrationDataController.java
+42
-0
migration/src/main/java/com/winsun/migration/datasource/DataSourceAspect.java
+36
-0
migration/src/main/java/com/winsun/migration/datasource/DataSourceConfig.java
+84
-0
migration/src/main/java/com/winsun/migration/datasource/DataSourceContextHolder.java
+26
-0
migration/src/main/java/com/winsun/migration/datasource/DynamicDataSource.java
+12
-0
migration/src/main/java/com/winsun/migration/mapper/db1/NewDatabases.java
+42
-0
migration/src/main/java/com/winsun/migration/mapper/db2/OldDatabases.java
+119
-0
migration/src/main/java/com/winsun/migration/service/IMigrationService.java
+21
-0
migration/src/main/java/com/winsun/migration/service/impl/MigrationServiceImpl.java
+286
-0
pom.xml
+1
-0
service-manager/src/main/java/com/winsun/controller/BillController.java
+18
-11
service-manager/src/main/java/com/winsun/controller/BonusController.java
+10
-8
service-manager/src/main/java/com/winsun/controller/SalesListController.java
+104
-45
service-manager/src/main/java/com/winsun/controller/SchoolManagementController.java
+49
-64
service-manager/src/main/resources/log4j2.xml
+4
-2
No files found.
common/src/main/java/com/winsun/bean/School.java
View file @
0d927e17
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotations.TableId;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotations.TableId;
import
com.baomidou.mybatisplus.annotations.TableField
;
import
com.baomidou.mybatisplus.annotations.TableField
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
/**
* < >
* < >
...
@@ -136,4 +137,27 @@ public class School implements Serializable {
...
@@ -136,4 +137,27 @@ public class School implements Serializable {
@TableField
(
"network_name"
)
@TableField
(
"network_name"
)
private
String
networkName
;
private
String
networkName
;
/**
* 开学时间
*/
@TableField
(
"start_date"
)
private
Date
startDate
;
/**
* 结束时间
*/
@TableField
(
"end_date"
)
private
Date
endDate
;
/**
* 大于50元激励
*/
@TableField
(
"greater_fifty"
)
private
Double
greaterFifty
;
/**
* 大于100元激励
*/
@TableField
(
"greater_hundred"
)
private
Double
greaterHundred
;
}
}
common/src/main/java/com/winsun/bean/activity/HhrActivity.java
View file @
0d927e17
package
com
.
winsun
.
bean
.
activity
;
package
com
.
winsun
.
bean
.
activity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.enums.IdType
;
import
com.baomidou.mybatisplus.enums.IdType
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@SuppressWarnings
(
"serial"
)
@SuppressWarnings
(
"serial"
)
@TableName
(
"hhr_activity"
)
@TableName
(
"hhr_activity"
)
@Data
@Data
...
@@ -63,7 +62,7 @@ public class HhrActivity implements Serializable{
...
@@ -63,7 +62,7 @@ public class HhrActivity implements Serializable{
/**
/**
* 排序号
* 排序号
*/
*/
private
int
sort
;
private
Integer
sort
;
/**
/**
* 创建时间
* 创建时间
...
@@ -83,5 +82,5 @@ public class HhrActivity implements Serializable{
...
@@ -83,5 +82,5 @@ public class HhrActivity implements Serializable{
/**
/**
* 删除标记
* 删除标记
*/
*/
private
int
delFlag
;
private
Integer
delFlag
;
}
}
common/src/main/java/com/winsun/bean/activity/HhrActivityRecord.java
View file @
0d927e17
package
com
.
winsun
.
bean
.
activity
;
package
com
.
winsun
.
bean
.
activity
;
import
java.io.Serializable
;
import
com.baomidou.mybatisplus.annotations.TableField
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.enums.IdType
;
import
com.baomidou.mybatisplus.enums.IdType
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
@SuppressWarnings
(
"serial"
)
@SuppressWarnings
(
"serial"
)
@TableName
(
"hhr_activity_record"
)
@TableName
(
"hhr_activity_record"
)
@Data
@Data
...
@@ -72,4 +72,10 @@ public class HhrActivityRecord implements Serializable{
...
@@ -72,4 +72,10 @@ public class HhrActivityRecord implements Serializable{
*/
*/
private
Date
updateTime
;
private
Date
updateTime
;
/**
* 是否重复
*/
@TableField
(
value
=
"is_repeal"
)
public
Integer
isRepeal
;
}
}
core-service/src/main/resources/log4j2.xml
View file @
0d927e17
...
@@ -58,7 +58,7 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
...
@@ -58,7 +58,7 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
<!-- 限制单个文件大小 -->
<!-- 限制单个文件大小 -->
<SizeBasedTriggeringPolicy
size=
"20 MB"
/>
<SizeBasedTriggeringPolicy
size=
"20 MB"
/>
</Policies>
</Policies>
<DefaultRolloverStrategy
max=
"
3
0"
/>
<DefaultRolloverStrategy
max=
"
6
0"
/>
</RollingRandomAccessFile>
</RollingRandomAccessFile>
...
@@ -76,7 +76,7 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
...
@@ -76,7 +76,7 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
<!-- 限制单个文件大小 -->
<!-- 限制单个文件大小 -->
<SizeBasedTriggeringPolicy
size=
"20 MB"
/>
<SizeBasedTriggeringPolicy
size=
"20 MB"
/>
</Policies>
</Policies>
<DefaultRolloverStrategy
max=
"
3
0"
/>
<DefaultRolloverStrategy
max=
"
6
0"
/>
</RollingRandomAccessFile>
</RollingRandomAccessFile>
...
...
migration/pom.xml
0 → 100644
View file @
0d927e17
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
school-center
</artifactId>
<groupId>
com.winsun.gdtel.gztel
</groupId>
<version>
0.0.2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
migration
</artifactId>
<version>
0.0.1
</version>
<description>
Demo project for Spring Boot
</description>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<exclusions>
<exclusion>
<groupId>
org.junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<artifactId>
p6spy
</artifactId>
<groupId>
p6spy
</groupId>
</dependency>
<dependency>
<artifactId>
druid-spring-boot-starter
</artifactId>
<groupId>
com.alibaba
</groupId>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
</dependency>
<dependency>
<groupId>
com.winsun.gdtel.gztel
</groupId>
<artifactId>
common
</artifactId>
<version>
0.0.2
</version>
</dependency>
<dependency>
<groupId>
com.winsun.framework
</groupId>
<artifactId>
winsun-core-service
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
3.8.1
</version>
<configuration>
<source>
1.8
</source>
<target>
1.8
</target>
<encoding>
UTF-8
</encoding>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
migration/src/main/java/com/winsun/migration/MigrationApplication.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.cloud.context.config.annotation.RefreshScope
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
})
@RefreshScope
@EnableEurekaClient
@MapperScan
(
basePackages
=
{
"com.winsun.*.mapper"
,
"com.winsun.mapper"
,
"com.winsun.migration.mapper"
,
"com.winsun.mapper.activity"
})
public
class
MigrationApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
MigrationApplication
.
class
,
args
);
}
}
migration/src/main/java/com/winsun/migration/controller/MigrationDataController.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
controller
;
import
com.winsun.migration.service.IMigrationService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.security.NoSuchAlgorithmException
;
@RestController
@RequestMapping
(
"/migration"
)
public
class
MigrationDataController
{
@Autowired
private
IMigrationService
migrationService
;
/**
* 迁移用户数据
* @return
*/
@RequestMapping
(
"/migrationUser"
)
public
String
migrationUser
()
{
try
{
migrationService
.
migrationUser
();
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
return
"成功!"
;
}
/**
* 迁移活动数据
* @return
*/
@RequestMapping
(
"/migrationActivity"
)
public
String
migrationActivity
()
{
migrationService
.
migrationActivity
();
migrationService
.
migrationActivityRecord
();
return
"成功!"
;
}
}
migration/src/main/java/com/winsun/migration/datasource/DataSourceAspect.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
datasource
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
@Component
@Order
(
value
=
-
100
)
@Slf4j
@Aspect
public
class
DataSourceAspect
{
@Pointcut
(
"execution(* com.winsun.migration.mapper.db1..*.*(..))"
+
"|| execution(* com.winsun.mapper.*.*(..)) || execution(* com.winsun.mapper.activity.*.*(..))"
)
private
void
db1Aspect
()
{
}
@Pointcut
(
"execution(* com.winsun.migration.mapper.db2..*.*(..))"
)
private
void
db2Aspect
()
{
}
@Before
(
"db1Aspect()"
)
public
void
db1
()
{
System
.
out
.
println
(
"切换到新框架数据源"
);
DataSourceContextHolder
.
setDbType
(
"schoolCenter"
);
}
@Before
(
"db2Aspect()"
)
public
void
db2
()
{
System
.
out
.
println
(
"切换到旧框架数据源"
);
DataSourceContextHolder
.
setDbType
(
"dzqd"
);
}
}
migration/src/main/java/com/winsun/migration/datasource/DataSourceConfig.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
datasource
;
import
com.baomidou.mybatisplus.MybatisConfiguration
;
import
com.baomidou.mybatisplus.plugins.PaginationInterceptor
;
import
com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean
;
import
org.apache.ibatis.plugin.Interceptor
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.apache.ibatis.type.JdbcType
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.jdbc.DataSourceBuilder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
javax.sql.DataSource
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 多数据源配置
*/
@EnableTransactionManagement
//开启事务
@Configuration
//spring中常用到注解,与xml配置相对立。是两种加载bean方式
@MapperScan
(
"com.winsun.migration.mapper.db*"
)
// 扫描mapperdao的地址
public
class
DataSourceConfig
{
@Bean
public
PaginationInterceptor
paginationInterceptor
()
{
PaginationInterceptor
paginationInterceptor
=
new
PaginationInterceptor
();
return
paginationInterceptor
;
}
@Bean
(
name
=
"schoolCenter"
)
@ConfigurationProperties
(
prefix
=
"spring.datasource.db1"
)
public
DataSource
dataSource1
()
{
return
DataSourceBuilder
.
create
().
build
();
}
@Bean
(
name
=
"xyjl"
)
@ConfigurationProperties
(
prefix
=
"spring.datasource.db2"
)
public
DataSource
dataSource2
()
{
return
DataSourceBuilder
.
create
().
build
();
}
/**
* 动态数据源配置
*
* @return
*/
@Bean
@Primary
public
DataSource
multipleDataSource
(
@Qualifier
(
"schoolCenter"
)
DataSource
db1
,
@Qualifier
(
"xyjl"
)
DataSource
db2
)
{
DynamicDataSource
dynamicDataSource
=
new
DynamicDataSource
();
Map
<
Object
,
Object
>
targetDataSources
=
new
HashMap
<>();
targetDataSources
.
put
(
"schoolCenter"
,
db1
);
targetDataSources
.
put
(
"xyjl"
,
db2
);
dynamicDataSource
.
setTargetDataSources
(
targetDataSources
);
dynamicDataSource
.
setDefaultTargetDataSource
(
db2
);
// 程序默认数据源,这个要根据程序调用数据源频次,经常把常调用的数据源作为默认
return
dynamicDataSource
;
}
@Bean
(
"sqlSessionFactory"
)
public
SqlSessionFactory
sqlSessionFactory
()
throws
Exception
{
MybatisSqlSessionFactoryBean
sqlSessionFactory
=
new
MybatisSqlSessionFactoryBean
();
sqlSessionFactory
.
setDataSource
(
multipleDataSource
(
dataSource1
(),
dataSource2
()));
MybatisConfiguration
configuration
=
new
MybatisConfiguration
();
configuration
.
setJdbcTypeForNull
(
JdbcType
.
NULL
);
configuration
.
setMapUnderscoreToCamelCase
(
true
);
configuration
.
setCacheEnabled
(
false
);
sqlSessionFactory
.
setConfiguration
(
configuration
);
sqlSessionFactory
.
setPlugins
(
new
Interceptor
[]{
paginationInterceptor
()
});
//PerformanceInterceptor(),OptimisticLockerInterceptor()
// sqlSessionFactory.setGlobalConfig(globalConfiguration()); //注释掉全局配置,因为在xml中读取就是全局配置
return
sqlSessionFactory
.
getObject
();
}
}
\ No newline at end of file
migration/src/main/java/com/winsun/migration/datasource/DataSourceContextHolder.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
datasource
;
public
class
DataSourceContextHolder
{
private
static
final
ThreadLocal
contextHolder
=
new
ThreadLocal
<>();
//实际上就是开启多个线程,每个线程进行初始化一个数据源
/**
* 设置数据源
*/
public
static
void
setDbType
(
String
dbName
)
{
contextHolder
.
set
(
dbName
);
}
/**
* 取得当前数据源
* @return
*/
public
static
String
getDbType
()
{
return
(
String
)
contextHolder
.
get
();
}
/**
* 清除上下文数据
*/
public
static
void
clearDbType
()
{
contextHolder
.
remove
();
}
}
migration/src/main/java/com/winsun/migration/datasource/DynamicDataSource.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
datasource
;
import
org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
;
public
class
DynamicDataSource
extends
AbstractRoutingDataSource
{
protected
Object
determineCurrentLookupKey
()
{
String
datasource
=
DataSourceContextHolder
.
getDbType
();
return
datasource
;
}
}
\ No newline at end of file
migration/src/main/java/com/winsun/migration/mapper/db1/NewDatabases.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
mapper
.
db1
;
import
com.winsun.bean.HhrUser
;
import
com.winsun.bean.SysUser
;
import
com.winsun.bean.activity.HhrActivity
;
import
com.winsun.bean.activity.HhrActivityRecord
;
import
org.apache.ibatis.annotations.*
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Mapper
@Component
public
interface
NewDatabases
{
@Select
(
"select * from sys_user where id = 1"
)
public
List
<
Map
<
String
,
Object
>>
getUser
();
@Insert
({
"insert into sys_user(id, account, password, salt, name, sex, phone, roleid, deptid, status, createtime, substName) "
+
"value(#{id}, #{account}, #{password}, #{salt}, #{name}, #{sex}, #{phone}, #{roleid}, #{deptid}, #{status}, #{createtime}, #{substName} )"
})
public
int
insert
(
SysUser
user
);
@Insert
({
"insert into hhr_user(id, id_card, ysm, wx_head_img_url, wx_nick_name, open_id, upload_state, grade, position, parent_id, parent_ids, is_active) "
+
"value(#{id}, #{idCard}, #{ysm}, #{wxHeadImgUrl}, #{wxNickName}, #{openId}, #{uploadState}, #{grade}, #{position}, #{parentId}, #{parentIds}, #{isActive})"
})
public
int
insertHhr
(
HhrUser
user
);
@Insert
({
"insert into hhr_activity(id, `title`, `desc`, integral, image_url, activity_type, subclass, `range`, `status`, `sort`, create_time, creator, del_flag) "
+
" value(#{id}, #{title}, #{desc}, #{integral}, #{imageUrl}, #{activityType}, #{subclass}, #{range}, #{status}, #{sort}, #{createTime}, #{creator}, #{delFlag})"
})
public
int
insertActivity
(
HhrActivity
hhrActivity
);
@Insert
({
"insert into hhr_activity_record(id, activity_id, record_integral, status, remark, image_url, message, create_time, create_id, creator, is_repeal) "
+
" value(#{id}, #{activityId}, #{recordIntegral}, #{status}, #{remark}, #{imageUrl}, #{message}, #{createTime}, #{createId}, #{creator}, #{isRepeal})"
})
public
int
insertActivityRecord
(
HhrActivityRecord
hhrActivityRecord
);
@Insert
({
"insert into migration_log(table_name, object, `status`, message, create_time) "
+
"value(#{tableName}, #{object}, #{status}, #{message}, now())"
})
public
int
insertLog
(
@Param
(
"tableName"
)
String
tableName
,
@Param
(
"object"
)
Object
object
,
@Param
(
"status"
)
String
status
,
@Param
(
"message"
)
String
message
);
}
migration/src/main/java/com/winsun/migration/mapper/db2/OldDatabases.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
mapper
.
db2
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Mapper
@Component
public
interface
OldDatabases
{
@Select
(
"select "
+
" ys.id, "
+
" ys.account, "
+
" ys.password, "
+
" ys.name, "
+
" (case ys.sex when '男' then 1 when '女' then 2 end) as sex, "
+
" ys.account as phone, "
+
" (case gur.role_id when '6f5b4a62410c457f8b643c358b03d73c ' then 243 when '1 'then 10 when '4545be257d944d77afc3f98ce982e615 ' then 241 "
+
" when 'f85e3ae76a73456c9849bc84f5478fef ' then 242 else 244 end) as role_id, "
+
" '24 ' dept_id,"
+
" (case ys.state when '0 ' then 1 when '1 ' then 1 when '2 ' then 2 when '3 ' then 4 when '4 ' then 3 end) as state, "
+
" ys.subst_name, "
+
" ys.is_active, "
+
" ys.school_remark, "
+
" ys.is_protocol, "
+
" ys.yzf_authen_state, "
+
" ys.staffPhoneNum, "
+
" ys.open_id, "
+
" ys.wx_head_img_url, "
+
" ys.wx_nick_name, "
+
" ys.grade, "
+
" ys.id_card, "
+
" xsr.parent_user_id, "
+
" xsr.position, "
+
" xsr.parent_ids "
+
" from "
+
" yx_sales ys "
+
" left join "
+
" gk_user_role_rel gur on ys.id = gur.user_id "
+
" LEFT JOIN "
+
" xz_sales_relation xsr on ys.id = xsr.user_id "
+
// " where " +
// " ys.id in ('12860') " +
" GROUP BY ys.id "
)
public
List
<
Map
<
String
,
Object
>>
getUser
();
@Select
({
"select "
+
" yai.id, "
+
" yai.title, "
+
" yai.activityDesc, "
+
" yai.integral, "
+
" yai.imageUrl, "
+
" (case yai.activityType when 1 then '团队活动' when 2 then '个人活动' end) activity_type, "
+
" yat.type_name as subclass, "
+
" yai.act_range, "
+
" yai.state as `status`, "
+
" yai.sort as sort, "
+
" yai.createDate, "
+
" ys.`name`, "
+
" yai.flag as del_flag "
+
"from "
+
" yx_activity_integral yai "
+
"left join "
+
" yx_activity_type yat "
+
"on "
+
" yai.type_id = yat.id "
+
"left join "
+
" (select "
+
" * "
+
" from "
+
" yx_sales "
+
" where state != 4) ys "
+
"on "
+
" yai.createOp = ys.account; "
})
public
List
<
Map
<
String
,
Object
>>
getActivity
();
@Select
({
"select "
+
" yaat.id, "
+
" yaat.activityId, "
+
" yaat.Integral, "
+
" yaat.state, "
+
" yaat.opinions, "
+
" yaat.imageUrl_old, "
+
" yaat.messageInfo, "
+
" yaat.createDate, "
+
" yaat.account, "
+
" ys.id as create_id, "
+
" ys.name as creator, "
+
" yaat.update_date "
+
"from "
+
" yx_activity_accede_to yaat "
+
"left join "
+
" (select "
+
" *"
+
" from "
+
" yx_sales "
+
" where state != 4) ys "
+
" on "
+
" yaat.account = ys.account "
})
public
List
<
Map
<
String
,
Object
>>
getActivityRecord
();
/**
* 查询重复记录
* @param id 记录主键
* @param activityId 活动id
* @param account 账号
* @return 总数记录
*/
@Select
(
"select count(1) as count from yx_activity_accede_to where id <> #{id} "
+
"and activityId = #{activityId} and account = #{account}"
)
public
Map
<
String
,
Object
>
getActivityRecordCount
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"activityId"
)
Integer
activityId
,
@Param
(
"account"
)
String
account
);
}
migration/src/main/java/com/winsun/migration/service/IMigrationService.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
service
;
import
java.security.NoSuchAlgorithmException
;
public
interface
IMigrationService
{
/**
* 获取用户数据
*/
public
void
migrationUser
()
throws
NoSuchAlgorithmException
;
/**
* 迁移活动
*/
public
void
migrationActivity
();
/**
* 迁移活动参与记录
*/
public
void
migrationActivityRecord
();
}
migration/src/main/java/com/winsun/migration/service/impl/MigrationServiceImpl.java
0 → 100644
View file @
0d927e17
package
com
.
winsun
.
migration
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.winsun.bean.HhrUser
;
import
com.winsun.bean.SysUser
;
import
com.winsun.bean.activity.HhrActivity
;
import
com.winsun.bean.activity.HhrActivityRecord
;
import
com.winsun.item.core.shiro.ShiroKit
;
import
com.winsun.mapper.HhrUserMapper
;
import
com.winsun.mapper.SysUserMapper
;
import
com.winsun.mapper.activity.ActivityMapper
;
import
com.winsun.mapper.activity.ActivityRecordMapper
;
import
com.winsun.migration.mapper.db1.NewDatabases
;
import
com.winsun.migration.mapper.db2.OldDatabases
;
import
com.winsun.migration.service.IMigrationService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.security.NoSuchAlgorithmException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Service
(
"migrationService"
)
public
class
MigrationServiceImpl
implements
IMigrationService
{
@Autowired
private
NewDatabases
newDatabases
;
@Autowired
private
OldDatabases
oldDatabases
;
@Autowired
private
SysUserMapper
sysUserMapper
;
@Autowired
private
HhrUserMapper
hhrUserMapper
;
@Autowired
private
ActivityMapper
activityMapper
;
@Autowired
private
ActivityRecordMapper
activityRecordMapper
;
/**
* 迁移用户数据
*/
public
void
migrationUser
()
throws
NoSuchAlgorithmException
{
//
List
<
Map
<
String
,
Object
>>
oldUserList
=
oldDatabases
.
getUser
();
log
.
info
(
JSON
.
toJSONString
(
oldUserList
.
get
(
0
)));
SysUser
user
=
null
;
HhrUser
hhrUser
=
null
;
List
<
String
>
hhrError
=
new
ArrayList
<>();
List
<
String
>
sysError
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
stringObjectMap
:
oldUserList
)
{
try
{
user
=
new
SysUser
();
user
.
setId
(
stringObjectMap
.
get
(
"id"
).
toString
());
user
.
setAccount
(
stringObjectMap
.
get
(
"account"
)
!=
null
?
stringObjectMap
.
get
(
"account"
).
toString
()
:
""
);
user
.
setName
(
stringObjectMap
.
get
(
"name"
)
!=
null
?
stringObjectMap
.
get
(
"name"
).
toString
()
:
""
);
user
.
setSalt
(
ShiroKit
.
getRandomSalt
(
6
));
user
.
setPassword
(
ShiroKit
.
md5
(
"123456"
,
user
.
getSalt
()));
user
.
setSex
(
stringObjectMap
.
get
(
"sex"
)
!=
null
?
stringObjectMap
.
get
(
"sex"
).
toString
()
:
"1"
);
user
.
setPhone
(
stringObjectMap
.
get
(
"account"
)
!=
null
?
stringObjectMap
.
get
(
"account"
).
toString
()
:
""
);
user
.
setRoleid
(
stringObjectMap
.
get
(
"role_id"
)
!=
null
?
stringObjectMap
.
get
(
"role_id"
).
toString
()
:
""
);
user
.
setDeptid
(
stringObjectMap
.
get
(
"dept_id"
)
!=
null
?
stringObjectMap
.
get
(
"dept_id"
).
toString
()
:
""
);
user
.
setStatus
(
stringObjectMap
.
get
(
"state"
)
!=
null
?
stringObjectMap
.
get
(
"state"
).
toString
()
:
""
);
user
.
setCreatetime
(
new
Date
());
user
.
setUpdateTime
(
new
Date
());
try
{
int
insert
=
newDatabases
.
insert
(
user
);
if
(
insert
<
1
)
{
sysError
.
add
(
stringObjectMap
.
get
(
"id"
).
toString
());
}
}
catch
(
Exception
e
)
{
if
(
e
instanceof
DuplicateKeyException
){
System
.
out
.
println
(
"更新记录"
);
sysUserMapper
.
updateById
(
user
);
}
else
{
throw
e
;
}
}
}
catch
(
Exception
e
)
{
sysError
.
add
(
stringObjectMap
.
get
(
"id"
).
toString
());
log
.
info
(
e
.
getMessage
());
this
.
insertLog
(
"sys_user"
,
user
,
"error"
,
e
.
getMessage
());
}
try
{
hhrUser
=
new
HhrUser
();
hhrUser
.
setId
(
stringObjectMap
.
get
(
"id"
).
toString
());
hhrUser
.
setIdCard
(
stringObjectMap
.
get
(
"id_card"
)
!=
null
?
stringObjectMap
.
get
(
"id_card"
).
toString
()
:
""
);
hhrUser
.
setYsm
(
"1"
);
hhrUser
.
setWxHeadImgUrl
(
stringObjectMap
.
get
(
"wx_head_img_url"
)
!=
null
?
stringObjectMap
.
get
(
"wx_head_img_url"
).
toString
()
:
""
);
hhrUser
.
setWxNickName
(
stringObjectMap
.
get
(
"wx_nick_name"
)
!=
null
?
stringObjectMap
.
get
(
"wx_nick_name"
).
toString
()
:
""
);
hhrUser
.
setOpenId
(
stringObjectMap
.
get
(
"open_id"
)
!=
null
?
stringObjectMap
.
get
(
"open_id"
).
toString
()
:
""
);
hhrUser
.
setUploadState
(
0
);
hhrUser
.
setGrade
(
stringObjectMap
.
get
(
"grade"
)
!=
null
?
stringObjectMap
.
get
(
"grade"
).
toString
()
:
""
);
hhrUser
.
setPosition
(
stringObjectMap
.
get
(
"position"
)
!=
null
?
stringObjectMap
.
get
(
"position"
).
toString
()
:
""
);
hhrUser
.
setParentId
(
stringObjectMap
.
get
(
"parent_user_id"
)
!=
null
?
stringObjectMap
.
get
(
"parent_user_id"
).
toString
()
:
""
);
hhrUser
.
setParentIds
(
stringObjectMap
.
get
(
"parent_ids"
)
!=
null
?
stringObjectMap
.
get
(
"parent_ids"
).
toString
()
:
""
);
hhrUser
.
setIsActive
(
Integer
.
parseInt
(
stringObjectMap
.
get
(
"is_active"
)
!=
null
?
stringObjectMap
.
get
(
"is_active"
).
toString
()
:
""
));
try
{
int
i
=
newDatabases
.
insertHhr
(
hhrUser
);
if
(
i
<
1
)
{
hhrError
.
add
(
stringObjectMap
.
get
(
"id"
).
toString
());
}
}
catch
(
Exception
e
)
{
if
(
e
instanceof
DuplicateKeyException
){
hhrUserMapper
.
updateById
(
hhrUser
);
}
else
{
throw
e
;
}
}
}
catch
(
Exception
e
)
{
hhrError
.
add
(
stringObjectMap
.
get
(
"id"
).
toString
());
log
.
error
(
e
.
getMessage
());
this
.
insertLog
(
"hhr_user"
,
hhrUser
,
"error"
,
e
.
getMessage
());
}
}
insertResult
(
oldUserList
.
size
(),
"sys_user"
,
sysError
);
insertResult
(
oldUserList
.
size
(),
"hhr_user"
,
hhrError
);
}
/**
* 迁移日志
* @param tableName 迁移表名
* @param object 迁移对象
* @param status 迁移状态
* @param message 迁移信息
*/
public
void
insertLog
(
String
tableName
,
Object
object
,
String
status
,
String
message
)
{
try
{
newDatabases
.
insertLog
(
tableName
,
JSON
.
toJSONString
(
object
),
status
,
message
);
}
catch
(
Exception
e
)
{
log
.
error
(
"插入日志失败:"
+
e
.
getMessage
());
}
}
/**
* 迁移活动
*/
public
void
migrationActivity
()
{
List
<
Map
<
String
,
Object
>>
activityList
=
oldDatabases
.
getActivity
();
HhrActivity
hhrActivity
=
null
;
log
.
info
(
JSON
.
toJSONString
(
activityList
));
List
<
String
>
list
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
activity
:
activityList
)
{
try
{
hhrActivity
=
new
HhrActivity
();
hhrActivity
.
setId
(
getString
(
activity
.
get
(
"id"
)));
hhrActivity
.
setTitle
(
getString
(
activity
.
get
(
"title"
)));
hhrActivity
.
setDesc
(
getString
(
activity
.
get
(
"activityDesc"
)));
hhrActivity
.
setIntegral
(
Integer
.
valueOf
(
getString
(
activity
.
get
(
"integral"
))));
hhrActivity
.
setImageUrl
(
getString
(
activity
.
get
(
"imageUrl"
)));
hhrActivity
.
setActivityType
(
getString
(
activity
.
get
(
"activity_type"
)));
hhrActivity
.
setSubclass
(
getString
(
activity
.
get
(
"subclass"
)));
hhrActivity
.
setRange
(
getString
(
activity
.
get
(
"act_range"
)));
hhrActivity
.
setStatus
(
getString
(
activity
.
get
(
"status"
)));
hhrActivity
.
setSort
(
activity
.
get
(
"sort"
)
!=
null
?
Integer
.
valueOf
(
getString
(
activity
.
get
(
"sort"
)))
:
null
);
hhrActivity
.
setCreateTime
(
getDate
(
activity
.
get
(
"createDate"
)));
hhrActivity
.
setCreator
(
getString
(
activity
.
get
(
"name"
)));
hhrActivity
.
setDelFlag
(
activity
.
get
(
"del_flag"
)
!=
null
?
Integer
.
valueOf
(
getString
(
activity
.
get
(
"del_flag"
)))
:
0
);
try
{
Integer
insert
=
newDatabases
.
insertActivity
(
hhrActivity
);
if
(
insert
<
0
)
{
list
.
add
(
activity
.
get
(
"id"
).
toString
());
}
}
catch
(
Exception
e
)
{
if
(
e
instanceof
DuplicateKeyException
){
activityMapper
.
updateById
(
hhrActivity
);
}
else
{
throw
e
;
}
}
}
catch
(
Exception
e
)
{
list
.
add
(
activity
.
get
(
"id"
).
toString
());
log
.
error
(
e
.
getMessage
());
this
.
insertLog
(
"hhr_activity"
,
hhrActivity
,
"error"
,
e
.
getMessage
());
}
}
insertResult
(
activityList
.
size
(),
"hhr_activity"
,
list
);
}
/**
* 迁移活动参与记录
*/
public
void
migrationActivityRecord
()
{
// 查询出所有记录
List
<
Map
<
String
,
Object
>>
activityRecord
=
oldDatabases
.
getActivityRecord
();
HhrActivityRecord
hhrActivityRecord
=
null
;
Map
<
String
,
Object
>
count
=
null
;
List
<
String
>
list
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
map:
activityRecord
)
{
try
{
hhrActivityRecord
=
new
HhrActivityRecord
();
// 判断是否有重复记录, 根据id 账号 活动id
Integer
id
=
Integer
.
valueOf
(
getString
(
map
.
get
(
"id"
)));
Integer
activityId
=
Integer
.
valueOf
(
getString
(
map
.
get
(
"activityId"
)));
String
account
=
getString
(
map
.
get
(
"account"
));
count
=
oldDatabases
.
getActivityRecordCount
(
id
,
activityId
,
account
);
if
(
Integer
.
valueOf
(
getString
(
count
.
get
(
"count"
)))
>
0
)
{
hhrActivityRecord
.
setIsRepeal
(
1
);
}
else
{
hhrActivityRecord
.
setIsRepeal
(
0
);
}
hhrActivityRecord
.
setId
(
getString
(
map
.
get
(
"id"
)));
hhrActivityRecord
.
setActivityId
(
getString
(
map
.
get
(
"activityId"
)));
hhrActivityRecord
.
setCreateId
(
getString
(
map
.
get
(
"create_id"
)));
hhrActivityRecord
.
setCreator
(
getString
(
map
.
get
(
"creator"
)));
hhrActivityRecord
.
setCreateTime
(
getDate
(
map
.
get
(
"createDate"
)));
hhrActivityRecord
.
setImageUrl
(
getString
(
map
.
get
(
"imageUrl_old"
)));
hhrActivityRecord
.
setMessage
(
getString
(
map
.
get
(
"messageInfo"
)));
hhrActivityRecord
.
setRemark
(
getString
(
map
.
get
(
"opinions"
)));
hhrActivityRecord
.
setStatus
(
getString
(
map
.
get
(
"state"
)));
hhrActivityRecord
.
setUpdateTime
(
getDate
(
map
.
get
(
"update_date"
)));
hhrActivityRecord
.
setRecordIntegral
(
new
BigDecimal
(
getString
(
map
.
get
(
"Integral"
))).
intValue
());
try
{
Integer
insert
=
newDatabases
.
insertActivityRecord
(
hhrActivityRecord
);
if
(
insert
<
1
)
{
list
.
add
(
hhrActivityRecord
.
getId
());
}
}
catch
(
Exception
e
)
{
if
(
e
instanceof
DuplicateKeyException
)
{
activityRecordMapper
.
updateById
(
hhrActivityRecord
);
}
else
{
throw
e
;
}
}
}
catch
(
Exception
e
)
{
list
.
add
(
map
.
get
(
"id"
).
toString
());
log
.
error
(
e
.
getMessage
());
this
.
insertLog
(
"hhr_activity_record"
,
hhrActivityRecord
,
"error"
,
e
.
getMessage
());
}
}
insertResult
(
activityRecord
.
size
(),
"hhr_activity_record"
,
list
);
}
public
Date
getDate
(
Object
object
)
{
if
(
object
==
null
)
{
return
null
;
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
date
=
new
Date
();
try
{
date
=
sdf
.
parse
((
String
)
getString
(
object
));
}
catch
(
ParseException
e
)
{
return
null
;
}
return
date
;
}
public
String
getString
(
Object
object
)
{
return
object
!=
null
?
object
.
toString
()
:
""
;
}
/**
* 插入迁移结果
* @param total 迁移总数
* @param tableName 表明
* @param ids 插入错误id
*/
public
void
insertResult
(
Integer
total
,
String
tableName
,
List
<
String
>
ids
)
{
this
.
insertLog
(
tableName
,
ids
,
"result"
,
"total:"
+
total
+
", "
+
tableName
+
" fail num: "
+
ids
.
size
());
log
.
info
(
"----------------------------------------------------"
);
log
.
info
(
tableName
+
"插入失败个数:"
+
ids
.
size
());
log
.
info
(
JSON
.
toJSONString
(
ids
));
log
.
info
(
"----------------------------------------------------"
);
}
}
pom.xml
View file @
0d927e17
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<module>
apply-net
</module>
<module>
apply-net
</module>
<module>
renewal-user
</module>
<module>
renewal-user
</module>
<module>
order
</module>
<module>
order
</module>
<module>
migration
</module>
</modules>
</modules>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<description>
校园系统聚合
</description>
<description>
校园系统聚合
</description>
...
...
service-manager/src/main/java/com/winsun/controller/BillController.java
View file @
0d927e17
...
@@ -34,6 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -34,6 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -572,7 +573,7 @@ public class BillController extends BaseController{
...
@@ -572,7 +573,7 @@ public class BillController extends BaseController{
Wrapper
<
HhrUser
>
wrapperHhrUser
=
new
EntityWrapper
<
HhrUser
>();
Wrapper
<
HhrUser
>
wrapperHhrUser
=
new
EntityWrapper
<
HhrUser
>();
wrapperHhrUser
.
setSqlSelect
(
" id "
);
wrapperHhrUser
.
setSqlSelect
(
" id "
);
wrapperHhrUser
.
eq
(
"position"
,
"
督导
"
);
wrapperHhrUser
.
eq
(
"position"
,
"
总经理
"
);
List
<
Map
<
String
,
Object
>>
hhrUserList
=
hhrUserMapper
.
selectMaps
(
wrapperHhrUser
);
List
<
Map
<
String
,
Object
>>
hhrUserList
=
hhrUserMapper
.
selectMaps
(
wrapperHhrUser
);
//Map<String, Object> hhrUserMap = MapUtil.listToMap(hhrUserMapper.selectMaps(wrapperHhrUser), "id", "id");
//Map<String, Object> hhrUserMap = MapUtil.listToMap(hhrUserMapper.selectMaps(wrapperHhrUser), "id", "id");
List
<
Map
<
String
,
Object
>>
managerSchoolList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
managerSchoolList
=
new
ArrayList
<
Map
<
String
,
Object
>>();
...
@@ -586,11 +587,13 @@ public class BillController extends BaseController{
...
@@ -586,11 +587,13 @@ public class BillController extends BaseController{
for
(
Map
<
String
,
Object
>
schoolRefMap
:
schoolRefList
)
{
for
(
Map
<
String
,
Object
>
schoolRefMap
:
schoolRefList
)
{
if
((
int
)
schoolRefMap
.
get
(
"user_id"
)
==
userId
)
{
if
((
int
)
schoolRefMap
.
get
(
"user_id"
)
==
userId
)
{
String
schoolId
=
schoolRefMap
.
get
(
"school"
).
toString
();
String
schoolId
=
schoolRefMap
.
get
(
"school"
).
toString
();
String
schoolName
=
schoolMaps
.
get
(
schoolId
).
toString
();
if
(
null
!=
schoolMaps
.
get
(
schoolId
)
&&
!
""
.
equals
(
schoolMaps
.
get
(
schoolId
)))
{
Map
<
String
,
Object
>
managerSchoolMap
=
new
HashMap
<
String
,
Object
>();
String
schoolName
=
schoolMaps
.
get
(
schoolId
).
toString
();
managerSchoolMap
.
put
(
"schoolName"
,
schoolName
);
Map
<
String
,
Object
>
managerSchoolMap
=
new
HashMap
<
String
,
Object
>();
managerSchoolMap
.
put
(
"userName"
,
userName
);
managerSchoolMap
.
put
(
"schoolName"
,
schoolName
);
managerSchoolList
.
add
(
managerSchoolMap
);
managerSchoolMap
.
put
(
"userName"
,
userName
);
managerSchoolList
.
add
(
managerSchoolMap
);
}
}
}
}
}
}
}
...
@@ -627,11 +630,11 @@ public class BillController extends BaseController{
...
@@ -627,11 +630,11 @@ public class BillController extends BaseController{
firstMap
.
put
(
"target"
,
statisType
);
firstMap
.
put
(
"target"
,
statisType
);
firstMap
.
put
(
"billType"
,
""
);
firstMap
.
put
(
"billType"
,
""
);
firstMap
.
put
(
"billDetail"
,
""
);
firstMap
.
put
(
"billDetail"
,
""
);
firstMap
.
put
(
"amount"
,
df
.
parse
(
Double
.
toString
(
incomeSum
)
));
firstMap
.
put
(
"amount"
,
new
BigDecimal
(
incomeSum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
firstMap
.
put
(
"billTypeExpense"
,
""
);
firstMap
.
put
(
"billTypeExpense"
,
""
);
firstMap
.
put
(
"billDetailExpense"
,
""
);
firstMap
.
put
(
"billDetailExpense"
,
""
);
firstMap
.
put
(
"amountExpense"
,
df
.
parse
(
Double
.
toString
(
expenseSum
)
));
firstMap
.
put
(
"amountExpense"
,
new
BigDecimal
(
expenseSum
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
firstMap
.
put
(
"taxAmount"
,
df
.
parse
(
Double
.
toString
(
taxAmount
)
));
firstMap
.
put
(
"taxAmount"
,
new
BigDecimal
(
taxAmount
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
));
imcomeList
=
addGroupSum
(
imcomeList
,
statisType
);
imcomeList
=
addGroupSum
(
imcomeList
,
statisType
);
expenseList
=
addGroupSum
(
expenseList
,
statisType
);
expenseList
=
addGroupSum
(
expenseList
,
statisType
);
...
@@ -785,8 +788,12 @@ public class BillController extends BaseController{
...
@@ -785,8 +788,12 @@ public class BillController extends BaseController{
// 把支出和收入数据拼接
// 把支出和收入数据拼接
public
List
<
Map
<
String
,
Object
>>
dealDataOther
(
List
<
Map
<
String
,
Object
>>
list1
,
List
<
Map
<
String
,
Object
>>
list2
,
String
target
){
public
List
<
Map
<
String
,
Object
>>
dealDataOther
(
List
<
Map
<
String
,
Object
>>
list1
,
List
<
Map
<
String
,
Object
>>
list2
,
String
target
){
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
firstmap
=
list1
.
get
(
0
);
String
theTarget
=
""
;
String
theTarget
=
(
String
)
firstmap
.
get
(
target
);
if
(
list1
.
size
()
!=
0
)
{
Map
<
String
,
Object
>
firstmap
=
list1
.
get
(
0
);
theTarget
=
(
String
)
firstmap
.
get
(
target
);
}
for
(
int
i
=
0
;
i
<
list1
.
size
()
;
i
++){
for
(
int
i
=
0
;
i
<
list1
.
size
()
;
i
++){
Map
<
String
,
Object
>
map1
=
list1
.
get
(
i
);
Map
<
String
,
Object
>
map1
=
list1
.
get
(
i
);
...
...
service-manager/src/main/java/com/winsun/controller/BonusController.java
View file @
0d927e17
...
@@ -121,15 +121,17 @@ public class BonusController extends BaseController {
...
@@ -121,15 +121,17 @@ public class BonusController extends BaseController {
if
(
isMatch
&&
null
!=
hhrUserMaps
.
get
(
userId
))
{
if
(
isMatch
&&
null
!=
hhrUserMaps
.
get
(
userId
))
{
map
.
put
(
"isBind"
,
hhrUserMaps
.
get
(
userId
).
toString
());
map
.
put
(
"isBind"
,
hhrUserMaps
.
get
(
userId
).
toString
());
String
schoolId
=
schoolRefMap
.
get
(
userId
).
toString
();
if
(
schoolRefMap
.
get
(
userId
)
!=
null
)
{
String
schoolId
=
schoolRefMap
.
get
(
userId
).
toString
();
if
(
null
!=
schoolMaps
.
get
(
schoolId
))
{
if
(
null
!=
schoolMaps
.
get
(
schoolId
))
{
Map
<
String
,
Object
>
schoolMap
=
schoolMaps
.
get
(
schoolId
);
Map
<
String
,
Object
>
schoolMap
=
schoolMaps
.
get
(
schoolId
);
map
.
put
(
"substName"
,
schoolMap
.
get
(
"substName"
));
map
.
put
(
"substName"
,
schoolMap
.
get
(
"substName"
));
map
.
put
(
"schoolName"
,
schoolMap
.
get
(
"schoolName"
));
map
.
put
(
"schoolName"
,
schoolMap
.
get
(
"schoolName"
));
dataList
.
add
(
map
);
dataList
.
add
(
map
);
}
}
}
}
}
}
}
...
...
service-manager/src/main/java/com/winsun/controller/SalesListController.java
View file @
0d927e17
...
@@ -17,10 +17,13 @@ import com.winsun.mapper.SysUserMapper;
...
@@ -17,10 +17,13 @@ import com.winsun.mapper.SysUserMapper;
import
com.winsun.utils.ImportExcel
;
import
com.winsun.utils.ImportExcel
;
import
com.winsun.utils.MapUtil
;
import
com.winsun.utils.MapUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
@@ -32,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -32,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* 销售订单
* 销售订单
...
@@ -48,6 +52,9 @@ public class SalesListController extends BaseController{
...
@@ -48,6 +52,9 @@ public class SalesListController extends BaseController{
*/
*/
private
static
final
int
HEADER_NUM
=
-
1
;
private
static
final
int
HEADER_NUM
=
-
1
;
private
static
final
int
SHEET_INDEX
=
0
;
private
static
final
int
SHEET_INDEX
=
0
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
/**
* 放号上传模板列名
* 放号上传模板列名
...
@@ -58,6 +65,7 @@ public class SalesListController extends BaseController{
...
@@ -58,6 +65,7 @@ public class SalesListController extends BaseController{
private
static
String
FH_ACCOUNT
=
"销售员账号(必填,系统注册手机号,重要)"
;
private
static
String
FH_ACCOUNT
=
"销售员账号(必填,系统注册手机号,重要)"
;
private
static
String
FH_SALES_SCHOOL
=
"销售学校"
;
private
static
String
FH_SALES_SCHOOL
=
"销售学校"
;
private
static
String
FH_SALES_SUBST
=
"销售县分"
;
private
static
String
FH_SALES_SUBST
=
"销售县分"
;
private
static
String
FH_ORDER_TYPE
=
"订单类型"
;
/**
/**
* 充值审核模板列名
* 充值审核模板列名
...
@@ -98,6 +106,7 @@ public class SalesListController extends BaseController{
...
@@ -98,6 +106,7 @@ public class SalesListController extends BaseController{
wrapperOrder
.
eq
(
StringUtils
.
isNotBlank
(
name
),
"name"
,
name
);
wrapperOrder
.
eq
(
StringUtils
.
isNotBlank
(
name
),
"name"
,
name
);
wrapperOrder
.
eq
(
StringUtils
.
isNotBlank
(
account
),
"account"
,
account
);
wrapperOrder
.
eq
(
StringUtils
.
isNotBlank
(
account
),
"account"
,
account
);
wrapperOrder
.
eq
(
"del_flag"
,
0
);
wrapperOrder
.
eq
(
"del_flag"
,
0
);
wrapperOrder
.
orderBy
(
"create_time"
,
false
);
List
<
SalesList
>
orderList
=
salesListMapper
.
selectPage
(
page
,
wrapperOrder
);
List
<
SalesList
>
orderList
=
salesListMapper
.
selectPage
(
page
,
wrapperOrder
);
page
.
setRecords
(
orderList
);
page
.
setRecords
(
orderList
);
...
@@ -199,8 +208,10 @@ public class SalesListController extends BaseController{
...
@@ -199,8 +208,10 @@ public class SalesListController extends BaseController{
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
@Permission
(
menuname
=
"上传订单数据"
,
value
=
"importOrder"
,
method
=
RequestMethod
.
POST
)
@Permission
(
menuname
=
"上传订单数据"
,
value
=
"importOrder"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
importOrder
(
@RequestParam
(
name
=
"file"
)
MultipartFile
file
)
{
public
ResponseData
<
Map
<
String
,
Object
>
>
importOrder
(
@RequestParam
(
name
=
"file"
)
MultipartFile
file
)
{
StringBuffer
info
=
new
StringBuffer
();
StringBuffer
info
=
new
StringBuffer
();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(!
StringUtils
.
endsWithAny
(
file
.
getOriginalFilename
(),
"xlsx"
,
"xls"
))
{
if
(!
StringUtils
.
endsWithAny
(
file
.
getOriginalFilename
(),
"xlsx"
,
"xls"
))
{
return
ResponseData
.
error
(
"手工上传数据仅支持Excel文件,其他格式不支持!"
);
return
ResponseData
.
error
(
"手工上传数据仅支持Excel文件,其他格式不支持!"
);
}
}
...
@@ -226,23 +237,26 @@ public class SalesListController extends BaseController{
...
@@ -226,23 +237,26 @@ public class SalesListController extends BaseController{
}
}
if
(!
listMap
.
get
(
0
).
get
(
"b"
).
toString
().
equals
(
FH_ORDER_PHONE
))
{
if
(!
listMap
.
get
(
0
).
get
(
"b"
).
toString
().
equals
(
FH_ORDER_PHONE
))
{
return
ResponseData
.
error
(
"
模板
不对,请选择正确的模板!"
);
return
ResponseData
.
error
(
"
b列
不对,请选择正确的模板!"
);
}
}
if
(!
listMap
.
get
(
0
).
get
(
"c"
).
toString
().
equals
(
FH_NAME
))
{
if
(!
listMap
.
get
(
0
).
get
(
"c"
).
toString
().
equals
(
FH_NAME
))
{
return
ResponseData
.
error
(
"
模板
不对,请选择正确的模板!"
);
return
ResponseData
.
error
(
"
c列
不对,请选择正确的模板!"
);
}
}
if
(!
listMap
.
get
(
0
).
get
(
"d"
).
toString
().
equals
(
FH_ACCOUNT
))
{
if
(!
listMap
.
get
(
0
).
get
(
"d"
).
toString
().
equals
(
FH_ACCOUNT
))
{
return
ResponseData
.
error
(
"
模板
不对,请选择正确的模板!"
);
return
ResponseData
.
error
(
"
d列
不对,请选择正确的模板!"
);
}
}
if
(!
listMap
.
get
(
0
).
get
(
"e"
).
toString
().
equals
(
FH_SALES_SCHOOL
))
{
if
(!
listMap
.
get
(
0
).
get
(
"e"
).
toString
().
equals
(
FH_SALES_SCHOOL
))
{
return
ResponseData
.
error
(
"
模板
不对,请选择正确的模板!"
);
return
ResponseData
.
error
(
"
e列
不对,请选择正确的模板!"
);
}
}
if
(!
listMap
.
get
(
0
).
get
(
"f"
).
toString
().
equals
(
FH_SALES_SUBST
))
{
if
(!
listMap
.
get
(
0
).
get
(
"f"
).
toString
().
equals
(
FH_SALES_SUBST
))
{
return
ResponseData
.
error
(
"模板不对,请选择正确的模板!"
);
return
ResponseData
.
error
(
"f列不对,请选择正确的模板!"
);
}
if
(
listMap
.
get
(
0
).
size
()
!=
6
)
{
return
ResponseData
.
error
(
"模板不对,请选择正确的模板!"
);
}
}
if
(!
listMap
.
get
(
0
).
get
(
"g"
).
toString
().
equals
(
FH_ORDER_TYPE
))
{
return
ResponseData
.
error
(
"g列不对,请选择正确的模板!"
);
}
// if (listMap.get(0).size() != 7) {
// return ResponseData.error("模板不对,请选择正确的模板!");
// }
//校验数据
//校验数据
try
{
try
{
//校验数据
//校验数据
...
@@ -271,18 +285,25 @@ public class SalesListController extends BaseController{
...
@@ -271,18 +285,25 @@ public class SalesListController extends BaseController{
log
.
error
(
"放号清单导入异常"
+
e
.
getMessage
(),
e
);
log
.
error
(
"放号清单导入异常"
+
e
.
getMessage
(),
e
);
return
ResponseData
.
error
(
"导入异常!"
);
return
ResponseData
.
error
(
"导入异常!"
);
}
}
// 去掉首行标题
// 去掉首行标题
listMap
.
remove
(
0
);
listMap
.
remove
(
0
);
Map
<
String
,
Object
>
resultMap
=
dealUploadData
(
listMap
);
Map
<
String
,
Object
>
dataResultMap
=
dealUploadData
(
listMap
);
int
num
=
(
int
)
resultMap
.
get
(
"num"
);
int
num
=
(
int
)
dataResultMap
.
get
(
"num"
);
exportList
.
set
((
List
<
Map
<
String
,
Object
>>)
resultMap
.
get
(
"infoList"
));
info
.
append
(
"导入"
+
num
+
"条数据!"
);
info
.
append
(
"导入"
+
num
+
"条数据!"
);
if
(
exportList
.
get
().
size
()
>
0
)
{
info
.
append
(
"返回导入结果清单!"
);
// 将导出清单结果数据保存到redis中
}
List
<
Map
<
String
,
Object
>>
errorList
=
(
List
<
Map
<
String
,
Object
>>)
dataResultMap
.
get
(
"infoList"
);
if
(
errorList
.
size
()
>
0
)
{
return
ResponseData
.
success
(
info
.
toString
(),
"导入完成"
);
info
.
append
(
"返回导入结果清单!"
);
String
key
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
redisTemplate
.
opsForValue
().
set
(
key
,
JSONArray
.
fromObject
(
errorList
).
toString
(),
30
,
TimeUnit
.
SECONDS
);
resultMap
.
put
(
"key"
,
key
);
}
resultMap
.
put
(
"msg"
,
info
);
return
ResponseData
.
success
(
resultMap
,
"导入完成"
);
}
}
public
Map
<
String
,
Object
>
dealUploadData
(
List
<
Map
<
String
,
Object
>>
list
){
public
Map
<
String
,
Object
>
dealUploadData
(
List
<
Map
<
String
,
Object
>>
list
){
...
@@ -308,6 +329,7 @@ public class SalesListController extends BaseController{
...
@@ -308,6 +329,7 @@ public class SalesListController extends BaseController{
String
account
=
(
String
)
map
.
get
(
"d"
);
String
account
=
(
String
)
map
.
get
(
"d"
);
String
salesSchool
=
(
String
)
map
.
get
(
"e"
);
String
salesSchool
=
(
String
)
map
.
get
(
"e"
);
String
salesSubst
=
(
String
)
map
.
get
(
"f"
);
String
salesSubst
=
(
String
)
map
.
get
(
"f"
);
String
orderType
=
getOrderType
(
map
.
get
(
"g"
)
!=
null
?
map
.
get
(
"g"
).
toString
()
:
""
);
Map
<
String
,
Object
>
theMap
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
theMap
=
new
HashMap
<
String
,
Object
>();
theMap
.
put
(
"sortNo"
,
sortNo
);
theMap
.
put
(
"sortNo"
,
sortNo
);
...
@@ -316,7 +338,7 @@ public class SalesListController extends BaseController{
...
@@ -316,7 +338,7 @@ public class SalesListController extends BaseController{
theMap
.
put
(
"account"
,
account
);
theMap
.
put
(
"account"
,
account
);
theMap
.
put
(
"salesSchool"
,
salesSchool
);
theMap
.
put
(
"salesSchool"
,
salesSchool
);
theMap
.
put
(
"salesSubst"
,
salesSubst
);
theMap
.
put
(
"salesSubst"
,
salesSubst
);
theMap
.
put
(
"orderType"
,
orderType
);
if
(
null
==
userMaps
.
get
(
account
))
{
if
(
null
==
userMaps
.
get
(
account
))
{
theMap
.
put
(
"desc"
,
"账号不存在"
);
theMap
.
put
(
"desc"
,
"账号不存在"
);
...
@@ -358,6 +380,29 @@ public class SalesListController extends BaseController{
...
@@ -358,6 +380,29 @@ public class SalesListController extends BaseController{
return
resultMap
;
return
resultMap
;
}
}
public
String
getOrderType
(
String
orderTypeName
)
{
if
(
"放号登记"
.
equals
(
orderTypeName
))
{
return
"1"
;
}
else
if
(
"新用户办理"
.
equals
(
orderTypeName
))
{
return
"0"
;
}
else
if
(
"羊城通"
.
equals
(
orderTypeName
))
{
return
"4"
;
}
else
if
(
"存量升级"
.
equals
(
orderTypeName
))
{
return
"2"
;
}
else
if
(
"小白卡"
.
equals
(
orderTypeName
))
{
return
"3"
;
}
else
if
(
"线上预制卡"
.
equals
(
orderTypeName
))
{
return
"5"
;
}
else
if
(
"线上小白卡"
.
equals
(
orderTypeName
))
{
return
"6"
;
}
else
if
(
"自助终端"
.
equals
(
orderTypeName
))
{
return
"7"
;
}
else
{
return
"无"
;
}
}
// 插入销售订单表
// 插入销售订单表
public
int
addSalesOrder
(
List
<
Map
<
String
,
Object
>>
list
)
{
public
int
addSalesOrder
(
List
<
Map
<
String
,
Object
>>
list
)
{
...
@@ -370,7 +415,7 @@ public class SalesListController extends BaseController{
...
@@ -370,7 +415,7 @@ public class SalesListController extends BaseController{
order
.
setCreateTime
(
new
Date
());
order
.
setCreateTime
(
new
Date
());
order
.
setSalesSubst
((
String
)
map
.
get
(
"salesSubst"
));
order
.
setSalesSubst
((
String
)
map
.
get
(
"salesSubst"
));
order
.
setSalesSchool
((
String
)
map
.
get
(
"salesSchool"
));
order
.
setSalesSchool
((
String
)
map
.
get
(
"salesSchool"
));
order
.
setOrderType
(
"1"
);
order
.
setOrderType
(
(
String
)
map
.
get
(
"orderType"
)
);
order
.
setName
((
String
)
map
.
get
(
"name"
));
order
.
setName
((
String
)
map
.
get
(
"name"
));
order
.
setAccount
((
String
)
map
.
get
(
"account"
));
order
.
setAccount
((
String
)
map
.
get
(
"account"
));
...
@@ -518,10 +563,10 @@ public class SalesListController extends BaseController{
...
@@ -518,10 +563,10 @@ public class SalesListController extends BaseController{
String
networkName
=
(
String
)
map
.
get
(
"d"
);
String
networkName
=
(
String
)
map
.
get
(
"d"
);
double
amount
=
Double
.
parseDouble
((
String
)
map
.
get
(
"e"
));
double
amount
=
Double
.
parseDouble
((
String
)
map
.
get
(
"e"
));
boolean
isSkip
=
false
;
boolean
isSkip
=
false
;
String
status
=
"2"
;
if
(
null
!=
orderMaps
.
get
(
orderPhone
))
{
if
(
null
!=
orderMaps
.
get
(
orderPhone
))
{
Map
<
String
,
Object
>
orderMap
=
(
Map
<
String
,
Object
>)
orderMaps
.
get
(
orderPhone
);
Map
<
String
,
Object
>
orderMap
=
(
Map
<
String
,
Object
>)
orderMaps
.
get
(
orderPhone
);
String
status
=
"2"
;
String
remark
=
"激活号码所属学校与上报学校不一致"
;
String
remark
=
"激活号码所属学校与上报学校不一致"
;
if
(
null
==
networkName
)
{
if
(
null
==
networkName
)
{
...
@@ -530,12 +575,14 @@ public class SalesListController extends BaseController{
...
@@ -530,12 +575,14 @@ public class SalesListController extends BaseController{
Map
<
String
,
Object
>
schoolMap
=
(
Map
<
String
,
Object
>)
schoolMaps
.
get
(
orderMap
.
get
(
"salesSchool"
));
Map
<
String
,
Object
>
schoolMap
=
(
Map
<
String
,
Object
>)
schoolMaps
.
get
(
orderMap
.
get
(
"salesSchool"
));
if
(
null
!=
schoolMap
.
get
(
"networkCode"
))
{
if
(
null
!=
schoolMap
.
get
(
"networkCode"
)
&&
!
""
.
equals
(
schoolMap
.
get
(
"networkCode"
))
)
{
if
(
networkCode
.
equals
(
schoolMap
.
get
(
"networkCode"
)))
{
if
(
networkCode
.
equals
(
schoolMap
.
get
(
"networkCode"
)))
{
double
bonus
=
0
;
double
bonus
=
0
;
double
allBonus
=
0
;
double
allBonus
=
0
;
double
nonSendBonus
=
0
;
double
nonSendBonus
=
0
;
// TODO 根据网点配置的时段进行判定
if
(
amount
>=
50
&&
amount
<
100
)
{
if
(
amount
>=
50
&&
amount
<
100
)
{
bonus
=
20
;
bonus
=
20
;
}
else
if
(
amount
>=
100
)
{
}
else
if
(
amount
>=
100
)
{
...
@@ -545,7 +592,7 @@ public class SalesListController extends BaseController{
...
@@ -545,7 +592,7 @@ public class SalesListController extends BaseController{
if
(
"广州美术学院(大学城)"
.
equals
(
orderMap
.
get
(
"sales_school"
))
&&
bonus
>=
20
){
if
(
"广州美术学院(大学城)"
.
equals
(
orderMap
.
get
(
"sales_school"
))
&&
bonus
>=
20
){
bonus
=
10
;
bonus
=
10
;
}
}
allBonus
=
bonus
;
allBonus
=
bonus
;
nonSendBonus
=
bonus
;
nonSendBonus
=
bonus
;
if
(
bonus
==
0
)
{
if
(
bonus
==
0
)
{
...
@@ -555,15 +602,20 @@ public class SalesListController extends BaseController{
...
@@ -555,15 +602,20 @@ public class SalesListController extends BaseController{
status
=
"3"
;
status
=
"3"
;
remark
=
""
;
remark
=
""
;
}
}
orderMap
.
put
(
"nonSendBonus"
,
nonSendBonus
);
orderMap
.
put
(
"allBonus"
,
allBonus
);
orderMap
.
put
(
"allBonus"
,
allBonus
);
orderMap
.
put
(
"nonSendBonus"
,
nonSendBonus
);
orderMap
.
put
(
"recentlyAmount"
,
amount
);
orderMap
.
put
(
"recentlyAmount"
,
amount
);
orderMap
.
put
(
"recentlyBonus"
,
bonus
);
orderMap
.
put
(
"recentlyBonus"
,
bonus
);
}
}
}
else
{
}
else
{
remark
=
"该学校的网点信息未添加"
;
remark
=
"该学校的网点信息未添加"
;
}
}
// 不达标,充值激励,未发送激励,应发总激励为0
if
(!
"3"
.
equals
(
status
))
{
orderMap
.
put
(
"nonSendBonus"
,
0
d
);
orderMap
.
put
(
"allBonus"
,
0
d
);
}
orderMap
.
put
(
"status"
,
status
);
orderMap
.
put
(
"status"
,
status
);
orderMap
.
put
(
"remark"
,
remark
);
orderMap
.
put
(
"remark"
,
remark
);
...
@@ -596,7 +648,7 @@ public class SalesListController extends BaseController{
...
@@ -596,7 +648,7 @@ public class SalesListController extends BaseController{
order
.
setAllBonus
((
double
)
map
.
get
(
"allBonus"
));
order
.
setAllBonus
((
double
)
map
.
get
(
"allBonus"
));
order
.
setNonSendBonus
((
double
)
map
.
get
(
"nonSendBonus"
));
order
.
setNonSendBonus
((
double
)
map
.
get
(
"nonSendBonus"
));
order
.
setRecentlyAmount
((
double
)
map
.
get
(
"recentlyAmount"
));
order
.
setRecentlyAmount
((
double
)
map
.
get
(
"recentlyAmount"
));
order
.
setRecentlyBonus
((
double
)
map
.
get
(
"
nonSend
Bonus"
));
order
.
setRecentlyBonus
((
double
)
map
.
get
(
"
recently
Bonus"
));
order
.
setActivateTime
(
sFormat
.
parse
((
String
)
map
.
get
(
"activateTime"
)));
order
.
setActivateTime
(
sFormat
.
parse
((
String
)
map
.
get
(
"activateTime"
)));
order
.
setNetworkCode
((
String
)
map
.
get
(
"networkCode"
));
order
.
setNetworkCode
((
String
)
map
.
get
(
"networkCode"
));
order
.
setNetworkName
((
String
)
map
.
get
(
"networkName"
));
order
.
setNetworkName
((
String
)
map
.
get
(
"networkName"
));
...
@@ -620,6 +672,7 @@ public class SalesListController extends BaseController{
...
@@ -620,6 +672,7 @@ public class SalesListController extends BaseController{
columns
.
add
(
FH_ACCOUNT
);
columns
.
add
(
FH_ACCOUNT
);
columns
.
add
(
FH_SALES_SCHOOL
);
columns
.
add
(
FH_SALES_SCHOOL
);
columns
.
add
(
FH_SALES_SUBST
);
columns
.
add
(
FH_SALES_SUBST
);
columns
.
add
(
FH_ORDER_TYPE
);
ServletOutputStream
os
=
null
;
ServletOutputStream
os
=
null
;
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
try
{
try
{
...
@@ -631,7 +684,8 @@ public class SalesListController extends BaseController{
...
@@ -631,7 +684,8 @@ public class SalesListController extends BaseController{
sheet
.
setColumnWidth
(
3
,
4000
);
sheet
.
setColumnWidth
(
3
,
4000
);
sheet
.
setColumnWidth
(
4
,
4000
);
sheet
.
setColumnWidth
(
4
,
4000
);
sheet
.
setColumnWidth
(
5
,
4000
);
sheet
.
setColumnWidth
(
5
,
4000
);
sheet
.
setColumnWidth
(
6
,
4000
);
//添加表头
//添加表头
final
XSSFRow
row
=
sheet
.
createRow
(
0
);
final
XSSFRow
row
=
sheet
.
createRow
(
0
);
XSSFCellStyle
cellStyle
=
workbook
.
createCellStyle
();
XSSFCellStyle
cellStyle
=
workbook
.
createCellStyle
();
...
@@ -699,8 +753,7 @@ public class SalesListController extends BaseController{
...
@@ -699,8 +753,7 @@ public class SalesListController extends BaseController{
}
}
@Permission
(
menuname
=
"导出导入结果"
,
value
=
"exportResult"
,
method
=
RequestMethod
.
POST
)
@Permission
(
menuname
=
"导出导入结果"
,
value
=
"exportResult"
,
method
=
RequestMethod
.
POST
)
public
void
exportResult
(
public
void
exportResult
(
String
key
)
{
)
throws
IOException
{
List
<
String
>
tops
=
new
ArrayList
<>();
List
<
String
>
tops
=
new
ArrayList
<>();
tops
.
add
(
FH_SORT
);
tops
.
add
(
FH_SORT
);
...
@@ -709,6 +762,7 @@ public class SalesListController extends BaseController{
...
@@ -709,6 +762,7 @@ public class SalesListController extends BaseController{
tops
.
add
(
FH_ACCOUNT
);
tops
.
add
(
FH_ACCOUNT
);
tops
.
add
(
FH_SALES_SCHOOL
);
tops
.
add
(
FH_SALES_SCHOOL
);
tops
.
add
(
FH_SALES_SUBST
);
tops
.
add
(
FH_SALES_SUBST
);
tops
.
add
(
FH_ORDER_TYPE
);
tops
.
add
(
"导入结果"
);
tops
.
add
(
"导入结果"
);
List
<
String
>
columns
=
new
ArrayList
<>();
List
<
String
>
columns
=
new
ArrayList
<>();
...
@@ -718,11 +772,17 @@ public class SalesListController extends BaseController{
...
@@ -718,11 +772,17 @@ public class SalesListController extends BaseController{
columns
.
add
(
"account"
);
columns
.
add
(
"account"
);
columns
.
add
(
"salesSchool"
);
columns
.
add
(
"salesSchool"
);
columns
.
add
(
"salesSubst"
);
columns
.
add
(
"salesSubst"
);
columns
.
add
(
"orderType"
);
columns
.
add
(
"desc"
);
columns
.
add
(
"desc"
);
JSONArray
jsonArray
=
new
JSONArray
();
ServletOutputStream
os
=
null
;
ServletOutputStream
os
=
null
;
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
XSSFWorkbook
workbook
=
new
XSSFWorkbook
();
try
{
try
{
//创建工作表
Object
o
=
redisTemplate
.
opsForValue
().
get
(
key
);
if
(
o
!=
null
)
{
jsonArray
=
JSONArray
.
fromObject
(
o
);
}
//创建工作表
XSSFSheet
sheet
=
workbook
.
createSheet
(
"导入结果返回清单"
);
XSSFSheet
sheet
=
workbook
.
createSheet
(
"导入结果返回清单"
);
//添加表头
//添加表头
final
XSSFRow
row
=
sheet
.
createRow
(
0
);
final
XSSFRow
row
=
sheet
.
createRow
(
0
);
...
@@ -736,16 +796,17 @@ public class SalesListController extends BaseController{
...
@@ -736,16 +796,17 @@ public class SalesListController extends BaseController{
});
});
//数据
//数据
int
rowIndex
=
row
.
getRowNum
();
int
rowIndex
=
row
.
getRowNum
();
for
(
Map
<
String
,
Object
>
maps:
exportList
.
get
())
{
JSONObject
jsonObject
=
null
;
final
XSSFRow
rowdata
=
sheet
.
createRow
(++
rowIndex
);
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
++
i
)
{
for
(
String
column
:
columns
)
{
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
XSSFCell
cell
=
rowdata
.
createCell
(
Math
.
max
(
rowdata
.
getLastCellNum
(),
0
));
final
XSSFRow
rowdata
=
sheet
.
createRow
(++
rowIndex
);
if
(
maps
.
get
(
column
)
!=
null
)
{
for
(
String
column
:
columns
)
{
cell
.
setCellValue
(
maps
.
get
(
column
).
toString
());
XSSFCell
cell
=
rowdata
.
createCell
(
Math
.
max
(
rowdata
.
getLastCellNum
(),
0
));
}
if
(
jsonObject
.
get
(
column
)
!=
null
)
{
}
cell
.
setCellValue
(
jsonObject
.
get
(
column
).
toString
());
}
}
}
}
HttpServletResponse
response
=
getHttpServletResponse
();
HttpServletResponse
response
=
getHttpServletResponse
();
response
.
reset
();
response
.
reset
();
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
...
@@ -753,8 +814,6 @@ public class SalesListController extends BaseController{
...
@@ -753,8 +814,6 @@ public class SalesListController extends BaseController{
os
=
response
.
getOutputStream
();
os
=
response
.
getOutputStream
();
workbook
.
write
(
os
);
workbook
.
write
(
os
);
os
.
flush
();
os
.
flush
();
exportList
.
set
(
new
ArrayList
<>());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"文件出错!"
+
e
.
getMessage
(),
e
);
log
.
error
(
"文件出错!"
+
e
.
getMessage
(),
e
);
}
finally
{
}
finally
{
...
...
service-manager/src/main/java/com/winsun/controller/SchoolManagementController.java
View file @
0d927e17
package
com
.
winsun
.
controller
;
package
com
.
winsun
.
controller
;
import
com.alibaba.excel.util.DateUtils
;
import
com.baomidou.mybatisplus.enums.SqlLike
;
import
com.baomidou.mybatisplus.enums.SqlLike
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
...
@@ -68,26 +69,18 @@ public class SchoolManagementController extends BaseController {
...
@@ -68,26 +69,18 @@ public class SchoolManagementController extends BaseController {
}
}
@Permission
(
menuname
=
"添加学校信息"
,
value
=
"insert"
,
method
=
RequestMethod
.
POST
)
@Permission
(
menuname
=
"添加学校信息"
,
value
=
"insert"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
insertSchool
(
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
"netId"
)
String
netId
,
public
ResponseData
<
String
>
insertSchool
(
School
school
,
@RequestParam
(
"chosePages"
)
String
chosePages
,
@RequestParam
(
"lzgh"
)
String
lzgh
,
@RequestParam
(
"bandproductId"
)
String
bandproductId
,
@RequestParam
(
"netPhone"
)
String
netPhone
,
@RequestParam
(
value
=
"startDateStr"
,
required
=
false
)
String
startDateStr
,
@RequestParam
(
"isShowband"
)
String
isShowband
,
@RequestParam
(
"isShowrh"
)
String
isShowrh
,
@RequestParam
(
"isRecv"
)
String
isRecv
,
@RequestParam
(
value
=
"endDateStr"
,
required
=
false
)
String
endDateStr
)
{
@RequestParam
(
"chosePages"
)
String
chosePages
,
@RequestParam
(
"networkCode"
)
String
networkCode
,
@RequestParam
(
"networkName"
)
String
networkName
)
{
try
{
if
(
StringUtils
.
isNotBlank
(
startDateStr
))
{
School
school
=
new
School
();
school
.
setStartDate
(
DateUtils
.
parseDate
(
startDateStr
));
school
.
setBandproductId
(
bandproductId
);
}
if
(
StringUtils
.
isNotBlank
(
isRecv
)){
if
(
StringUtils
.
isNotBlank
(
endDateStr
))
{
school
.
setIsRecv
(
Integer
.
valueOf
(
isRecv
));
school
.
setEndDate
(
DateUtils
.
parseDate
(
endDateStr
));
}
}
school
.
setNetId
(
netId
);
}
catch
(
Exception
e
){
school
.
setLzgh
(
lzgh
);
return
ResponseData
.
error
(
"日期格式转换错误"
);
school
.
setSchoolName
(
schoolName
);
school
.
setSubName
(
subName
);
school
.
setIsShowband
(
isShowband
);
school
.
setIsShowrh
(
isShowrh
);
school
.
setNetworkCode
(
networkCode
);
school
.
setNetworkName
(
networkName
);
if
(
StringUtils
.
isNotBlank
(
netPhone
)){
school
.
setNetPhone
(
Integer
.
valueOf
(
netPhone
));
}
}
Integer
insert
=
schoolMapper
.
insert
(
school
);
Integer
insert
=
schoolMapper
.
insert
(
school
);
...
@@ -128,56 +121,48 @@ public class SchoolManagementController extends BaseController {
...
@@ -128,56 +121,48 @@ public class SchoolManagementController extends BaseController {
}
}
/**
/**
*@param id
* 修改学校信息
* @param subName 县分
* @param school
* @param schoolName 学校
* @param chosePages
* @param netId 网点id
* @param lzgh 揽装工号
* @param bandproductId 单宽id
* @param netPhone 购机
* @param isShowband 显示宽带
* @param isShowrh 融合
* @param isRecv 收到电信卡
* @param chosePages 套餐id
* @return
* @return
*/
*/
@Permission
(
menuname
=
"修改学校信息"
,
value
=
"update"
,
method
=
RequestMethod
.
POST
)
@Permission
(
menuname
=
"修改学校信息"
,
value
=
"update"
,
method
=
RequestMethod
.
POST
)
public
ResponseData
<
String
>
updateSchool
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
"subName"
)
String
subName
,
@RequestParam
(
"schoolName"
)
String
schoolName
,
@RequestParam
(
"netId"
)
String
netId
,
public
ResponseData
<
String
>
updateSchool
(
School
school
,
@RequestParam
(
"chosePages"
)
String
chosePages
,
@RequestParam
(
"lzgh"
)
String
lzgh
,
@RequestParam
(
"bandproductId"
)
String
bandproductId
,
@RequestParam
(
"netPhone"
)
String
netPhone
,
@RequestParam
(
"isShowband"
)
String
isShowband
,
@RequestParam
(
value
=
"startDateStr"
,
required
=
false
)
String
startDateStr
,
@RequestParam
(
"isShowrh"
)
String
isShowrh
,
@RequestParam
(
"isRecv"
)
String
isRecv
,
@RequestParam
(
"chosePages"
)
String
chosePages
,
@RequestParam
(
value
=
"endDateStr"
,
required
=
false
)
String
endDateStr
)
{
@RequestParam
(
"networkCode"
)
String
networkCode
,
@RequestParam
(
"networkName"
)
String
networkName
)
{
try
{
if
(
StringUtils
.
isNotBlank
(
startDateStr
))
{
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<>();
school
.
setStartDate
(
DateUtils
.
parseDate
(
startDateStr
));
wrapper
.
eq
(
"id"
,
id
);
Map
<
String
,
Object
>
dataMapping
=
new
HashMap
<>();
dataMapping
.
put
(
"sub_name"
,
subName
);
dataMapping
.
put
(
"school_name"
,
schoolName
);
dataMapping
.
put
(
"lzgh"
,
lzgh
);
dataMapping
.
put
(
"net_id"
,
netId
);
dataMapping
.
put
(
"is_recv"
,
isRecv
);
dataMapping
.
put
(
"net_phone"
,
netPhone
);
dataMapping
.
put
(
"bandproduct_id"
,
bandproductId
);
dataMapping
.
put
(
"is_showband"
,
isShowband
);
dataMapping
.
put
(
"is_showrh"
,
isShowrh
);
dataMapping
.
put
(
"network_code"
,
networkCode
);
dataMapping
.
put
(
"network_name"
,
networkName
);
schoolMapper
.
updateForSet
(
MyBatisPlusUpdateUtils
.
toUpdateSet
(
dataMapping
),
wrapper
);
//插入学校与套餐中间表数据
if
(
StringUtils
.
isNotBlank
(
chosePages
)){
String
[]
split
=
chosePages
.
split
(
","
);
if
(
split
.
length
<=
0
)
{
return
ResponseData
.
success
(
"修改完毕!"
);
}
}
EntityWrapper
<
SchoolPackage
>
schoolPackagewrapper
=
new
EntityWrapper
<>();
if
(
StringUtils
.
isNotBlank
(
endDateStr
))
{
schoolPackagewrapper
.
eq
(
"school_id"
,
id
);
school
.
setEndDate
(
DateUtils
.
parseDate
(
endDateStr
));
schoolPackageMapper
.
delete
(
schoolPackagewrapper
);
for
(
String
s
:
split
)
{
SchoolPackage
schoolPackage
=
new
SchoolPackage
();
schoolPackage
.
setSchoolId
(
id
);
schoolPackage
.
setPackageId
(
s
);
schoolPackageMapper
.
insert
(
schoolPackage
);
}
}
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
school
.
getId
());
Map
<
String
,
Object
>
dataMapping
=
new
HashMap
<>();
schoolMapper
.
update
(
school
,
wrapper
);
// schoolMapper.updateForSet(MyBatisPlusUpdateUtils.toUpdateSet(dataMapping), wrapper);
//插入学校与套餐中间表数据
if
(
StringUtils
.
isNotBlank
(
chosePages
)){
String
[]
split
=
chosePages
.
split
(
","
);
if
(
split
.
length
<=
0
)
{
return
ResponseData
.
success
(
"修改完毕!"
);
}
EntityWrapper
<
SchoolPackage
>
schoolPackagewrapper
=
new
EntityWrapper
<>();
schoolPackagewrapper
.
eq
(
"school_id"
,
school
.
getId
());
schoolPackageMapper
.
delete
(
schoolPackagewrapper
);
for
(
String
s
:
split
)
{
SchoolPackage
schoolPackage
=
new
SchoolPackage
();
schoolPackage
.
setSchoolId
(
school
.
getId
()
+
""
);
schoolPackage
.
setPackageId
(
s
);
schoolPackageMapper
.
insert
(
schoolPackage
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"修改学校失败!"
+
e
.
getMessage
());
}
}
return
ResponseData
.
success
(
"修改完毕!"
);
return
ResponseData
.
success
(
"修改完毕!"
);
}
}
...
...
service-manager/src/main/resources/log4j2.xml
View file @
0d927e17
...
@@ -34,7 +34,8 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
...
@@ -34,7 +34,8 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
<ThresholdFilter
level=
"warn"
onMatch=
"DENY"
onMismatch=
"NEUTRAL"
/>
<ThresholdFilter
level=
"warn"
onMatch=
"DENY"
onMismatch=
"NEUTRAL"
/>
<ThresholdFilter
level=
"info"
onMatch=
"ACCEPT"
onMismatch=
"DENY"
/>
<ThresholdFilter
level=
"info"
onMatch=
"ACCEPT"
onMismatch=
"DENY"
/>
</Filters>
</Filters>
<PatternLayout
pattern=
"%date{yyyy-MM-dd HH:mm:ss} %level [%file:%line] - %msg%n"
/>
<!-- <PatternLayout pattern="%date{yyyy-MM-dd HH:mm:ss} %level [%file:%line] - %msg%n"/>-->
<Policies>
<Policies>
<!-- 归档每天的文件 -->
<!-- 归档每天的文件 -->
<TimeBasedTriggeringPolicy
interval=
"1"
modulate=
"true"
/>
<TimeBasedTriggeringPolicy
interval=
"1"
modulate=
"true"
/>
...
@@ -67,7 +68,8 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
...
@@ -67,7 +68,8 @@ TimeBasedTriggeringPolicy指定的size是1,结合起来就是每1分钟生成
<ThresholdFilter
level=
"fatal"
onMatch=
"DENY"
onMismatch=
"NEUTRAL"
/>
<ThresholdFilter
level=
"fatal"
onMatch=
"DENY"
onMismatch=
"NEUTRAL"
/>
<ThresholdFilter
level=
"error"
onMatch=
"ACCEPT"
onMismatch=
"DENY"
/>
<ThresholdFilter
level=
"error"
onMatch=
"ACCEPT"
onMismatch=
"DENY"
/>
</Filters>
</Filters>
<PatternLayout
pattern=
"%date{yyyy-MM-dd_HH:mm:ss} %level [%file:%line] - %msg%n"
/>
<!-- <PatternLayout pattern="%date{yyyy-MM-dd_HH:mm:ss} %level [%file:%line] - %msg%n"/>-->
<JsonLayout/>
<Policies>
<Policies>
<!-- 归档每天的文件 -->
<!-- 归档每天的文件 -->
<TimeBasedTriggeringPolicy
interval=
"1"
modulate=
"true"
/>
<TimeBasedTriggeringPolicy
interval=
"1"
modulate=
"true"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment