Browse Source

会议记录表+演练记录表+培训记录+考试记录,开始和结束时间转换成:yyyy-MM-dd HH:mm

zhongwei
ty 8 months ago
parent
commit
4b1a7e68b6
  1. 8
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java
  2. 14
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java
  3. 15
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java
  4. 14
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java
  5. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java
  6. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailVO.java
  7. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java
  8. 24
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java
  9. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java
  10. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java
  11. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  12. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml
  13. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java
  14. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  15. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java
  16. 8
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java
  17. 33
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java
  18. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  19. 195
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/TimeUtils.java
  20. 1
      hzims-service/safeproduct/src/main/resources/db/2.0.0.sql.1
  21. BIN
      hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx

8
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CarMaintenanceEntity.java

@ -43,10 +43,10 @@ public class CarMaintenanceEntity extends BaseEntity {
@ApiModelProperty("维保开始时间")
private Date startTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("维保结束时间")
private Date endTime;
// @NotNull
// @JsonFormat(pattern = "yyyy-MM-dd")
// @ApiModelProperty("维保结束时间")
// private Date endTime;
@NotNull
@Size(max = 255, message = "维保地点长度不能超过255")

14
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Size;
import java.util.Date;
@ -32,9 +34,21 @@ public class ConferenceRecordEntity extends BaseEntity {
private String peopleName;
@ApiModelProperty("会议实际开始时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm"
)
private Date actualStartTime;
@ApiModelProperty("会议实际结束时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm"
)
private Date actualEndTime;
@Size(max = 20, message = "记录人字段长度不能超过20")

15
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/RehearsalRecordEntity.java

@ -1,16 +1,19 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.util.Date;
/**
@ -41,10 +44,22 @@ public class RehearsalRecordEntity extends BaseEntity {
@NotNull
@ApiModelProperty("演练实际开始时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm"
)
private Date actualStartTime;
@NotNull
@ApiModelProperty("演练实际结束时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm"
)
private Date actualEndTime;
@NotNull

14
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TrainRecordEntity.java

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Size;
import java.util.Date;
@ -39,9 +41,21 @@ public class TrainRecordEntity extends BaseEntity {
private String content;
@ApiModelProperty("实际培训开始时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm"
)
private Date actualStartTime;
@ApiModelProperty("实际培训结束时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm"
)
private Date actualEndTime;
@Size(max = 250, message = "培训评价字段长度不能超过250")

6
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java

@ -21,9 +21,9 @@ public class CarMaintenanceDetailVO {
@ApiModelProperty("维保开始时间")
private Date startTime;
@ApiModelProperty("维保结束时间")
private Date endTime;
// 和需求方确定暂时不用了
// @ApiModelProperty("维保结束时间")
// private Date endTime;
@ApiModelProperty("维保地点")
private String location;

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailVO.java

@ -20,10 +20,10 @@ public class ConferenceRecordDetailVO {
private String code;
@ApiModelProperty("会议实际开始时间")
private Date actualStartTime;
private String actualStartTime;
@ApiModelProperty("会议实际结束时间")
private Date actualEndTime;
private String actualEndTime;
@ApiModelProperty("单位")
private String unit;

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java

@ -23,10 +23,10 @@ public class RehearsalRecordDetailVO {
private String peopleName;
@ApiModelProperty("演练实际开始时间")
private Date actualStartTime;
private String actualStartTime;
@ApiModelProperty("演练实际结束时间")
private Date actualEndTime;
private String actualEndTime;
@ApiModelProperty("演练记录")
private String record;

24
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java

@ -0,0 +1,24 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2023-12-25
*/
@Data
@ApiModel(value = "考试成绩VO类")
public class TestScoreSumVO {
@ApiModelProperty("应考人数")
private Integer peopleNum=0;
@ApiModelProperty("实考人数")
private Integer actualPeopleNum=0;
@ApiModelProperty("及格率")
private Double percentage=0.0;
}

6
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreVO.java

@ -15,6 +15,12 @@ public class TestScoreVO {
@ApiModelProperty("考试成绩id")
private Long id;
@ApiModelProperty("单位")
private Long dept;
@ApiModelProperty("单位名")
private String deptName;
@ApiModelProperty("姓名")
private String name;

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java

@ -20,10 +20,10 @@ public class TrainRecordDetailVO {
private String code;
@ApiModelProperty("实际培训开始时间")
private Date actualStartTime;
private String actualStartTime;
@ApiModelProperty("实际培训结束时间")
private Date actualEndTime;
private String actualEndTime;
@ApiModelProperty("单位")
private String unit;

13
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java

@ -12,10 +12,7 @@ import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainPlanService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import com.hnac.hzims.safeproduct.vo.TrainMonthVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.TrainYearVO;
import com.hnac.hzims.safeproduct.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -199,7 +196,13 @@ public class TrainController extends BladeController {
List<TestScoreVO> list = testScoreService.testScoreList(testId, name);
return R.data(list);
}
@GetMapping("/testScoreSum")
@ApiOperation(value = "考试总计")
@ApiOperationSupport(order = 18)
public R<TestScoreSumVO> testScoreSum(@RequestParam Long testId, String name) {
TestScoreSumVO list = testScoreService.testScoreSum(testId, name);
return R.data(list);
}
@PostMapping("/updateBatchScore")
@ApiOperation(value = "批量填写分数")
@ApiOperationSupport(order = 19)

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CarMaintenanceMapper.xml

@ -4,7 +4,7 @@
<select id="getCarMaintenance" resultType="com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO">
SELECT
t1.code, t1.start_time, t1.end_time, t1.location, t1.cost, t1.maintainer, t1.content, t1.img_path, t1.file_path,
t1.code, t1.start_time, t1.location, t1.cost, t1.maintainer, t1.content, t1.img_path, t1.file_path,
t1.manager_advice, t1.confirmation_time, t2.plate_number, t2.unit, t2.car_brand, t2.car_type, t1.maintenance_type
FROM
hzims_car_maintenance t1
@ -35,7 +35,7 @@
AND t1.start_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND t1.end_time &lt;= #{param.endTime}
AND t1.end_time &lt;= #{param.startTime}
</if>
<if test="param.carId != null and param.carId != ''">
AND t1.car_id = #{param.carId}

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestScoreService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TestScoreDTO;
import com.hnac.hzims.safeproduct.entity.TestScoreEntity;
import com.hnac.hzims.safeproduct.vo.TestScoreSumVO;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import java.util.List;
@ -43,4 +44,6 @@ public interface ITestScoreService extends IService<TestScoreEntity> {
* @return 考试成绩列表
*/
List<TestScoreEntity> getRelativeTestScore(Long testId);
TestScoreSumVO testScoreSum(Long testId, String name);
}

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java

@ -104,7 +104,7 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
// 若确认成功,更新台账相关信息
if (update) {
CarEntity carEntity = carService.getById(carMaintenanceEntity.getCarId());
carEntity.setMaintenanceLastTime(carMaintenanceEntity.getEndTime());
carEntity.setMaintenanceLastTime(carMaintenanceEntity.getStartTime());
carEntity.setMaintenanceNextTime(confirmationDTO.getMaintenanceNextTime());
carEntity.setMaintenanceMileage(confirmationDTO.getMaintenanceMileage());
carEntity.setMaintenanceStatus(CarMaintenanceStatusEnum.MAINTAINED.getValue());

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java

@ -17,14 +17,18 @@ import com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper;
import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper;
import com.hnac.hzims.safeproduct.service.IConferenceRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO;
import com.hnac.hzims.ticket.constants.TicketConstants;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -94,6 +98,12 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap
@Override
public void exportConferenceRecordData(Long id, HttpServletResponse response) {
ConferenceRecordDetailVO conferenceRecordDetailVO = this.getConferenceRecordDetailById(id);
if (StringUtils.isNotEmpty(conferenceRecordDetailVO.getActualStartTime())){
conferenceRecordDetailVO.setActualStartTime(TimeUtils.format(conferenceRecordDetailVO.getActualStartTime()));
}
if (StringUtils.isNotEmpty(conferenceRecordDetailVO.getActualEndTime())){
conferenceRecordDetailVO.setActualEndTime(TimeUtils.format(conferenceRecordDetailVO.getActualEndTime()));
}
// 数据处理
// 会议方式
String conferenceMethod = conferenceRecordDetailVO.getConferenceMethod();
@ -129,6 +139,8 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap
BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath,"filePath", response);
}
/**
* 查询会议记录表详情
*/

8
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java

@ -17,6 +17,7 @@ import com.hnac.hzims.safeproduct.mapper.RehearsalPlanMapper;
import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper;
import com.hnac.hzims.safeproduct.service.IRehearsalRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Query;
@ -140,6 +141,13 @@ public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMappe
RehearsalRecordDetailVO rehearsalRecordDetailVO = this.getRecordDetailVOById(id);
// 数据处理
// 图片
if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getActualStartTime())){
rehearsalRecordDetailVO.setActualStartTime(TimeUtils.format(rehearsalRecordDetailVO.getActualStartTime()));
}
if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getActualEndTime())){
rehearsalRecordDetailVO.setActualEndTime(TimeUtils.format(rehearsalRecordDetailVO.getActualEndTime()));
}
List<ImageEntity> list = new ArrayList<>();
if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getImgPath())) {
String[] imgArr = rehearsalRecordDetailVO.getImgPath().split(",");

33
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java

@ -1,16 +1,21 @@
package com.hnac.hzims.safeproduct.service.impl;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.dto.TestScoreDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity;
import com.hnac.hzims.safeproduct.entity.TestScoreEntity;
import com.hnac.hzims.safeproduct.mapper.TestMapper;
import com.hnac.hzims.safeproduct.mapper.TestScoreMapper;
import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.vo.TestScoreSumVO;
import com.hnac.hzims.safeproduct.vo.TestScoreVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -23,7 +28,8 @@ import java.util.stream.Collectors;
*/
@Service
public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScoreEntity> implements ITestScoreService {
@Resource
TestMapper testMapper;
/**
* 查询考试成绩列表
*/
@ -75,4 +81,27 @@ public class TestScoreServiceImpl extends ServiceImpl<TestScoreMapper, TestScore
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
return this.list(queryWrapper);
}
@Override
public TestScoreSumVO testScoreSum(Long testId, String name) {
TestScoreSumVO testScoreSumVO = new TestScoreSumVO();
TestEntity testEntity = testMapper.selectById(testId);
String peopleName = testEntity.getPeopleName();
if (StringUtils.isNotBlank(peopleName)){
String[] split = peopleName.split(",");
testScoreSumVO.setPeopleNum( split.length);
}
QueryWrapper<TestScoreEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TestScoreEntity::getTestId, testId);
List<TestScoreEntity> list = this.list(queryWrapper);
if (CollectionUtils.isNotEmpty(list)){
testScoreSumVO.setPeopleNum( list.size());
List<TestScoreEntity> collect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(list)) {
testScoreSumVO.setPercentage(new Double(collect.size() / list.size()));
}
}
return testScoreSumVO;
}
}

7
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -19,6 +19,7 @@ import com.hnac.hzims.safeproduct.mapper.TrainRecordMapper;
import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired;
@ -142,6 +143,12 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
// 数据处理
// 培训方式
String trainMethod = trainRecordDetailVO.getTrainMethod();
if (StringUtils.isNotEmpty(trainRecordDetailVO.getActualStartTime())){
trainRecordDetailVO.setActualStartTime(TimeUtils.format(trainRecordDetailVO.getActualStartTime()));
}
if (StringUtils.isNotEmpty(trainRecordDetailVO.getActualEndTime())){
trainRecordDetailVO.setActualEndTime(TimeUtils.format(trainRecordDetailVO.getActualEndTime()));
}
if (trainMethod.equals(TrainMethodEnum.MIXED.getValue())) {
trainRecordDetailVO.setTrainMethod(TrainMethodEnum.MIXED.getDesc());
} else if (trainMethod.equals(TrainMethodEnum.ONLINE.getValue())) {

195
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/TimeUtils.java

@ -0,0 +1,195 @@
package com.hnac.hzims.safeproduct.utils;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO;
import org.springblade.core.tool.utils.DateUtil;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class TimeUtils {
private static int sheet1NowRow, sheet2NowRow;
/**
* 相差时数
*
* @param endDate
* @param nowDate
* @return
* @author ty
*/
public static Long getDifferTime(Date nowDate, Date endDate) {
long nh = 1000 * 60 * 60L;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少小时
long hour = diff / nh;
return hour;
}
public static String getYear(Integer year) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, Calendar.JANUARY);
// 设置日期为1
calendar.set(Calendar.DATE, 1);
// 设置时间为0点0分0秒
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) + " 00:00:00";
return start;
}
public static String getYearEnd(Integer year) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为12(即十二月)
calendar.set(Calendar.MONTH, Calendar.DECEMBER);
// 设置日期为31
calendar.set(Calendar.DATE, 31);
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) + " 00:00:00";
return end;
}
public static String getYearEndV2(Integer year) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为12(即十二月)
calendar.set(Calendar.MONTH, Calendar.DECEMBER);
// 设置日期为31
calendar.set(Calendar.DATE, 31);
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) + " 23:59:59";
return end;
}
public static String getMonthStart(Integer year, Integer mon) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份
calendar.set(Calendar.MONTH,mon-1);
// 设置日期为1
calendar.set(Calendar.DATE, 1);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) + " 00:00:00";
return start;
}
public static String getMonthEnd(Integer year, Integer mon) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, mon);
calendar.set(Calendar.DAY_OF_MONTH, 1);
// 将日期对象减去一天,即为当月的最后一天
calendar.add(Calendar.DAY_OF_MONTH, -1);
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) + " 00:00:00";
return end;
}
public static String getMonthEndV2(Integer year, Integer mon) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, mon);
calendar.set(Calendar.DAY_OF_MONTH, 1);
// 将日期对象减去一天,即为当月的最后一天
calendar.add(Calendar.DAY_OF_MONTH, -1);
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) + " 23:59:59";
return end;
}
public static List<String> getListByYear(Integer year) {
List<String> monthList=new ArrayList<>();
for (int i = 0; i <12; i++) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, i);
calendar.set(Calendar.DAY_OF_MONTH, 1);
// 将日期对象减去一天,即为当月的最后一天
String mon = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE);
monthList.add(mon);
}
return monthList;
}
public static List<String> getListByYearMon(Integer year,Integer mon) {
List<String> monthList=new ArrayList<>();
for (int i = 0; i <mon; i++) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, i);
calendar.set(Calendar.DAY_OF_MONTH, 1);
String monTime = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE);
monthList.add(monTime);
}
return monthList;
}
public static String getMon(Integer year,Integer month) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, month-1);
// 设置日期为1
calendar.set(Calendar.DATE, 1);
// 设置时间为0点0分0秒
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ;
return start;
}
public static String getEarlyTime(Integer year, Integer month) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, month-1);
// 设置日期为1
calendar.set(Calendar.DATE, 1);
// 设置时间为0点0分0秒
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.add(Calendar.MONTH, -1);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ;
return start;
}
public static String format(String time) {
String formattedDateString="";
SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = originalFormat.parse(time);
SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
formattedDateString = targetFormat.format(date);
return formattedDateString;
} catch (Exception e) {
e.printStackTrace();
return time;
}
}
}

1
hzims-service/safeproduct/src/main/resources/db/2.0.0.sql.1

@ -276,7 +276,6 @@ CREATE TABLE `HZIMS_CAR_MAINTENANCE` (
`MAINTENANCE_TYPE` VARCHAR(50) NOT NULL COMMENT '维保类型',
`CONTENT` MEDIUMTEXT NOT NULL COMMENT '维保内容',
`START_TIME` DATE NOT NULL COMMENT '维保开始时间',
`END_TIME` DATE NOT NULL COMMENT '维保结束时间',
`LOCATION` VARCHAR(255) NOT NULL COMMENT '维保地点',
`COST` BIGINT(20) NOT NULL COMMENT '维保费用',
`MAINTAINER` VARCHAR(20) NOT NULL COMMENT '维保人',

BIN
hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx

Binary file not shown.
Loading…
Cancel
Save