parent
40c158de6e
commit
041dbd1364
@ -0,0 +1,28 @@
|
||||
package au.com.royalpay.payment.manage.management.sysconfig.beans;
|
||||
|
||||
import au.com.royalpay.payment.tools.holiday.beans.SettlementRegion;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
public class HolidayConfig {
|
||||
@NotEmpty
|
||||
private String description;
|
||||
@NotEmpty
|
||||
private SettlementRegion[] regions;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public SettlementRegion[] getRegions() {
|
||||
return regions;
|
||||
}
|
||||
|
||||
public void setRegions(SettlementRegion[] regions) {
|
||||
this.regions = regions;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import au.com.royalpay.payment.tools.holiday.beans.HolidayDefinition;
|
||||
import au.com.royalpay.payment.tools.holiday.beans.SettlementRegion;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class HolidayDAO {
|
||||
private int holidayId;
|
||||
private String holiday;
|
||||
private String description;
|
||||
private String regions;
|
||||
|
||||
public HolidayDAO() {
|
||||
}
|
||||
|
||||
public HolidayDAO(HolidayDefinition define) {
|
||||
holiday = new DateTime(define.getHoliday()).toString("yyyy-MM-dd");
|
||||
description = define.getDescription();
|
||||
regions = Arrays.stream(define.getRegions()).map(SettlementRegion::toString).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
public HolidayDefinition toHolidayDefine() {
|
||||
return new HolidayDefinition(holidayId, DateTime.parse(holiday).toDate(), description,
|
||||
Arrays.stream(regions.split(",")).map(SettlementRegion::valueOf).toArray(SettlementRegion[]::new));
|
||||
}
|
||||
|
||||
public int getHolidayId() {
|
||||
return holidayId;
|
||||
}
|
||||
|
||||
public void setHolidayId(int holidayId) {
|
||||
this.holidayId = holidayId;
|
||||
}
|
||||
|
||||
public String getHoliday() {
|
||||
return holiday;
|
||||
}
|
||||
|
||||
public void setHoliday(String holiday) {
|
||||
this.holiday = holiday;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getRegions() {
|
||||
return regions;
|
||||
}
|
||||
|
||||
public void setRegions(String regions) {
|
||||
this.regions = regions;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import com.yixsoft.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import com.yixsoft.support.mybatis.autosql.annotations.AutoSql;
|
||||
import com.yixsoft.support.mybatis.autosql.annotations.SqlType;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AutoMapper(tablename = "sys_holidays", pkName = "holiday_id", keyGenerator = Jdbc3KeyGenerator.class)
|
||||
public interface HolidayMapper {
|
||||
@AutoSql(SqlType.INSERT)
|
||||
void saveHoliday(HolidayDAO dao);
|
||||
|
||||
List<HolidayDAO> listMonthly(@Param("month") String monthPattern);
|
||||
|
||||
@AutoSql(SqlType.DELETE)
|
||||
void deleteHoliday(@Param("holiday") String holiday);
|
||||
|
||||
@AutoSql(SqlType.SELECT)
|
||||
HolidayDAO findDefine(@Param("holiday") String holiday);
|
||||
|
||||
@AutoSql(SqlType.UPDATE)
|
||||
void updateHolidayDescription(@Param("description") String description, @Param("regions") String regions, @Param("holiday_id") int holidayId);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="au.com.royalpay.payment.manage.mappers.system.HolidayMapper">
|
||||
<select id="listMonthly" resultType="au.com.royalpay.payment.manage.mappers.system.HolidayDAO">
|
||||
select * from sys_holidays where holiday like concat(#{month},'-%')
|
||||
order by holiday
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,38 @@
|
||||
<div class="modal-header">Holiday Config: {{holiday.holiday}}</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<input title="Description" placeholder="Description" ng-model="holiday.description">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item disabled">Affected Regions</li>
|
||||
<li class="list-group-item" ng-class="{'active':regionActive('CN_MAINLAND')}"
|
||||
ng-click="toggleRegion('CN_MAINLAND')">CN MainLand
|
||||
</li>
|
||||
<li class="list-group-item" ng-class="{'active':regionActive('CN_HONGKONG')}"
|
||||
ng-click="toggleRegion('CN_HONGKONG')">CN Hongkong
|
||||
</li>
|
||||
<li class="list-group-item" ng-class="{'active':regionActive('AU_VIC')}"
|
||||
ng-click="toggleRegion('AU_VIC')">AU VIC
|
||||
</li>
|
||||
<li class="list-group-item" ng-class="{'active':regionActive('AU_NSW')}"
|
||||
ng-click="toggleRegion('AU_NSW')">AU NSW
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="btn-group">
|
||||
<button ng-click="commitHoliday()" type="button" class="btn btn-primary">Commit</button>
|
||||
<button ng-click="deleteHoliday()" type="button" class="btn btn-danger" ng-if="holiday.holiday_id">Delete
|
||||
</button>
|
||||
<button ng-click="$dismiss()" type="button" class="btn btn-warning">Cancel</button>
|
||||
</div>
|
||||
|
||||
</div>
|
Loading…
Reference in new issue