Commit 0d927e17 by 罗承锋

提交页面基础功能报错、配置网点充值奖励机制

parent a43c27c0
...@@ -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;
} }
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;
} }
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;
} }
...@@ -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="30"/> <DefaultRolloverStrategy max="60"/>
</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="30"/> <DefaultRolloverStrategy max="60"/>
</RollingRandomAccessFile> </RollingRandomAccessFile>
......
<?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>
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);
}
}
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 "成功!";
}
}
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");
}
}
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
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();
}
}
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
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);
}
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);
}
package com.winsun.migration.service;
import java.security.NoSuchAlgorithmException;
public interface IMigrationService {
/**
* 获取用户数据
*/
public void migrationUser() throws NoSuchAlgorithmException;
/**
* 迁移活动
*/
public void migrationActivity();
/**
* 迁移活动参与记录
*/
public void migrationActivityRecord();
}
...@@ -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>
......
...@@ -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);
......
...@@ -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);
}
} }
} }
} }
......
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("修改完毕!");
} }
......
...@@ -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"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment