Commit 32d0df77 authored by Mccoy Z Xia's avatar Mccoy Z Xia

calendar action 相关页面和接口

parent 2ac54545
......@@ -933,4 +933,42 @@ public class DateUtils {
// }
// //System.out.println("sss");
// }
/**
* 清零 时分秒
* 用于时间查询
* @param date
* @return
*/
public static Date clearTimeShort(Date date) {
return clearTimeShortAndAdd1Day(date, false);
}
/**
* 清零 时分秒 并加一天
* 用于时间查询
* @param date
* @return
*/
public static Date clearTimeShortAndAdd1Day(Date date) {
return clearTimeShortAndAdd1Day(date, true);
}
private static Date clearTimeShortAndAdd1Day(Date date, boolean addOneDay) {
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
// 将时分秒,毫秒域清零
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
//把日期往后增加一天
if (addOneDay) {
calendar.add(Calendar.DATE, 1);
}
return calendar.getTime();
}
}
package pwc.taxtech.atms.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.calendar.dto.CalendarActionDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.ICalendarActionService;
/**
* <p> @Description </p>
*
* @Author: Mccoy Z Xia (Xia zhixin)
* @Date: 2019-07-21 20:15
* @Version: 1.0
**/
@RestController
@RequestMapping("api/v1/calendarAction/")
public class CalendarActionController {
@Autowired
private ICalendarActionService actionServiceImpl;
@PostMapping("saveCalendarAction")
public OperationResultDto saveCalendarAction(@RequestBody CalendarActionDto dto){
return actionServiceImpl.saveCalendarAction(dto);
}
@GetMapping("getCalendarActionList")
public OperationResultDto getCalendarActionList(){
return actionServiceImpl.getCalendarActionList();
}
@PostMapping("deleteCalendarAction")
public OperationResultDto getCalendarDataForDisplay(@RequestBody CalendarActionDto dto){
return actionServiceImpl.deleteCalendarAction(dto);
}
}
package pwc.taxtech.atms.service;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.calendar.dto.CalendarActionDto;
import pwc.taxtech.atms.calendar.entity.CalendarAction;
import pwc.taxtech.atms.dto.OperationResultDto;
public interface ICalendarActionService {
OperationResultDto saveEvent(CalendarAction record);
OperationResultDto saveCalendarAction(CalendarActionDto dto);
OperationResultDto deleteEvent(Long id);
OperationResultDto deleteCalendarAction(CalendarActionDto dto);
OperationResultDto getCalendarActionList();
}
......@@ -2,10 +2,12 @@ package pwc.taxtech.atms.service;
import pwc.taxtech.atms.calendar.entity.CalendarEvent;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.calendar.CalendarDisplayQueryParamDto;
public interface ICalendarEventService {
OperationResultDto addEvent(CalendarEvent event);
OperationResultDto updateEvent(CalendarEvent event);
OperationResultDto deleteEvent(Long id);
}
......@@ -2,15 +2,25 @@ package pwc.taxtech.atms.service.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.calendar.dao.CalendarActionJurisdictionRelationshipMapper;
import pwc.taxtech.atms.calendar.dao.CalendarActionMapper;
import pwc.taxtech.atms.calendar.dao.CalendarJurisdictionMapper;
import pwc.taxtech.atms.calendar.entity.CalendarAction;
import pwc.taxtech.atms.calendar.dao.ext.CalendarActionTMapper;
import pwc.taxtech.atms.calendar.dao.ext.CalendarExtMapper;
import pwc.taxtech.atms.calendar.dao.ext.CalendarJurisdictionTMapper;
import pwc.taxtech.atms.calendar.dto.CalendarActionDto;
import pwc.taxtech.atms.calendar.dto.CalendarJurisdictionDto;
import pwc.taxtech.atms.calendar.entity.*;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.ICalendarActionService;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p> @Description </p>
......@@ -19,6 +29,7 @@ import java.util.Date;
* @Date: 2019-07-10 16:19
* @Version: 1.0
**/
@Service
public class CalendarActionServiceImpl extends BaseService implements ICalendarActionService {
private static final Logger log = LoggerFactory.getLogger(CalendarActionServiceImpl.class);
......@@ -26,45 +37,126 @@ public class CalendarActionServiceImpl extends BaseService implements ICalendarA
@Resource
private CalendarActionMapper calendarActionMapper;
@Resource
private CalendarExtMapper calendarExtMapper;
@Resource
private CalendarJurisdictionMapper calendarJurisdictionMapper;
@Resource
private CalendarActionJurisdictionRelationshipMapper calendarActionJurisdictionRelationshipMapper;
@Autowired
private CalendarActionTMapper actionTMapper;
@Autowired
private CalendarJurisdictionTMapper jurisdictionTMapper;
@Override
public OperationResultDto saveEvent(CalendarAction record) {
int count = 0;
try {
record.setUpdateTime(new Date());
// 无ID则新建,有ID则更新
if (record.getId() != null){
count = calendarActionMapper.updateByPrimaryKeySelective(record);
public OperationResultDto saveCalendarAction(CalendarActionDto dto) {
boolean result;
if (dto.getId() == null) {
result = insertAction(dto);
} else {
record.setId(idService.nextId());
record.setCreateTime(record.getUpdateTime());
count = calendarActionMapper.insert(record);
result =updateAction(dto);
}
return new OperationResultDto(result);
}
private boolean insertAction(CalendarActionDto dto) {
Date createTime = new Date();
CalendarAction action = actionTMapper.toCalendarAction(dto);
action.setId(idService.nextId());
action.setCreateTime(createTime);
action.setUpdateTime(createTime);
List<CalendarJurisdictionDto> list = dto.getJurisdictionDtoList();
List<CalendarJurisdiction> jurisdictionList = new ArrayList<>();
List<CalendarActionJurisdictionRelationship> relationshipList = new ArrayList<>();
list.forEach(l -> {
CalendarJurisdiction jurisdiction = jurisdictionTMapper.toCalendarAction(l);
jurisdiction.setId(idService.nextId());
jurisdiction.setCreateTime(createTime);
jurisdiction.setUpdateTime(createTime);
jurisdictionList.add(jurisdiction);
CalendarActionJurisdictionRelationship relationship = new CalendarActionJurisdictionRelationship();
relationship.setId(idService.nextId());
relationship.setActionId(action.getId());
relationship.setJurisdictionId(jurisdiction.getId());
});
try {
calendarExtMapper.batchInsertActionJurisdiction(jurisdictionList);
calendarExtMapper.batchInsertActionJurisdictionRelation(relationshipList);
calendarActionMapper.insert(action);
} catch (Exception e) {
log.error("save error", e);
log.error("insertAction error", e);
return false;
}
boolean result = count > 0;
String msg = result ? "1" : "0";
return new OperationResultDto(result, msg);
return true;
}
private boolean updateAction(CalendarActionDto dto) {
Date updateTime = new Date();
CalendarAction action = actionTMapper.toCalendarAction(dto);
action.setUpdateTime(updateTime);
action.setStatus((byte) 1);
List<CalendarJurisdictionDto> list = dto.getJurisdictionDtoList();
List<CalendarJurisdiction> jurisdictionList = new ArrayList<>();
try {
list.forEach(p -> {
CalendarJurisdiction jurisdiction = jurisdictionTMapper.toCalendarAction(p);
jurisdiction.setId(idService.nextId());
jurisdiction.setUpdateTime(updateTime);
jurisdictionList.add(jurisdiction);
});
jurisdictionList.forEach(p -> calendarJurisdictionMapper.updateByPrimaryKeySelective(p));
calendarActionMapper.updateByPrimaryKeySelective(action);
} catch (Exception e) {
log.error("updateAction error", e);
}
return true;
}
@Override
public OperationResultDto deleteEvent(Long id) {
public OperationResultDto deleteCalendarAction(CalendarActionDto dto) {
int count = 0;
CalendarAction action = new CalendarAction();
action.setId(dto.getId());
action.setStatus(Byte.parseByte("0"));
action.setUpdateTime(new Date());
try {
count = calendarActionMapper.deleteByPrimaryKey(id);
count = calendarActionMapper.updateByPrimaryKeySelective(action);
} catch (Exception e) {
log.error("deleteAction error", e);
}
boolean result = count > 0;
String msg = result ? "删除成功" : "删除失败";
return new OperationResultDto(result, msg);
return new OperationResultDto(count > 0);
}
@Override
public OperationResultDto getCalendarActionList() {
CalendarActionExample actionExample = new CalendarActionExample();
actionExample.createCriteria().andStatusEqualTo((byte) 1);
List<CalendarAction> actionList = calendarActionMapper.selectByExample(null);
List<CalendarActionDto> actionDtoList = new ArrayList<>();
actionList.forEach(p -> {
List<CalendarJurisdictionDto> jurisdictionDtoList = calendarExtMapper.getJurisdictionListByActionId(p.getId());
CalendarActionDto dto = actionTMapper.toCalendarActionDto(p);
dto.setJurisdictionDtoList(jurisdictionDtoList);
actionDtoList.add(dto);
});
return OperationResultDto.success(actionDtoList);
}
}
......@@ -6,12 +6,17 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.calendar.dao.*;
import pwc.taxtech.atms.calendar.dao.ext.CalendarExtMapper;
import pwc.taxtech.atms.calendar.dto.CalendarEventDto;
import pwc.taxtech.atms.calendar.entity.CalendarEvent;
import pwc.taxtech.atms.calendar.entity.CalendarEventExample;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.calendar.CalendarDisplayQueryParamDto;
import pwc.taxtech.atms.service.ICalendarEventService;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* <p> @Description </p>
......@@ -27,6 +32,8 @@ public class CalendarEventServiceImpl extends BaseService implements ICalendarEv
@Resource
private CalendarEventMapper calendarEventMapper;
@Resource
private CalendarExtMapper calendarExtMapper;
@Override
public OperationResultDto addEvent(CalendarEvent event) {
......@@ -45,7 +52,7 @@ public class CalendarEventServiceImpl extends BaseService implements ICalendarEv
}
boolean result = count > 0;
String msg = result ? "1" : "-1";
return new OperationResultDto(result, msg);
return new OperationResultDto(result, msg, event.getId().toString());
}
@Override
......@@ -75,4 +82,5 @@ public class CalendarEventServiceImpl extends BaseService implements ICalendarEv
String msg = result ? "1" : "-1";
return new OperationResultDto(result, msg);
}
}
......@@ -361,8 +361,8 @@ public class CalendarServiceImpl extends BaseService implements ICalendarService
}
public List<CalendarEventDto> getCalendarEventData(CalendarDisplayQueryParamDto queryParamDto) {
Date start = formatQueryDateTime(queryParamDto.getQueryStartTime(), false);
Date end = formatQueryDateTime(queryParamDto.getQueryEndTime(), true);
Date start = pwc.taxtech.atms.common.util.DateUtils.clearTimeShort(queryParamDto.getQueryStartTime());
Date end = pwc.taxtech.atms.common.util.DateUtils.clearTimeShortAndAdd1Day(queryParamDto.getQueryEndTime());
String startYearStr = String.format("%tY", start);
String endYearStr = String.format("%tY", end);
......@@ -485,7 +485,7 @@ public class CalendarServiceImpl extends BaseService implements ICalendarService
boolean isEffective = dueDate != null
&& dueDate.compareTo(start) >= 0
&& dueDate.compareTo(p.getValidDateStart()) >= 0
&& dueDate.compareTo(formatQueryDateTime(p.getValidDateEnd(), true)) < 0
&& dueDate.compareTo(pwc.taxtech.atms.common.util.DateUtils.clearTimeShortAndAdd1Day(p.getValidDateEnd())) < 0
&& dueDate.compareTo(end) < 0;
//
......@@ -494,7 +494,7 @@ public class CalendarServiceImpl extends BaseService implements ICalendarService
isEffective = dueDate != null
&& dueDate.compareTo(start) >= 0
&& dueDate.compareTo(p.getValidDateStart()) >= 0
&& dueDate.compareTo(formatQueryDateTime(p.getValidDateEnd(), true)) < 0
&& dueDate.compareTo(pwc.taxtech.atms.common.util.DateUtils.clearTimeShortAndAdd1Day(p.getValidDateEnd())) < 0
&& dueDate.compareTo(end) < 0;
}
......@@ -541,22 +541,4 @@ public class CalendarServiceImpl extends BaseService implements ICalendarService
return str2Date;
}
private Date formatQueryDateTime(Date date, boolean addOneDay) {
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
// 将时分秒,毫秒域清零
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
//把日期往后增加一天
if (addOneDay) {
calendar.add(Calendar.DATE, 1);
}
return calendar.getTime();
}
}
package pwc.taxtech.atms.calendar.dao.ext;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import pwc.taxtech.atms.calendar.dto.CalendarActionDto;
import pwc.taxtech.atms.calendar.entity.CalendarAction;
@Mapper(componentModel = "spring")
public interface CalendarActionTMapper {
CalendarActionTMapper CALENDAR_ACTION_T_MAPPERT_Mapper = Mappers.getMapper(CalendarActionTMapper.class);
@Mapping(source = "id", target = "id")
CalendarActionDto toCalendarActionDto(CalendarAction calendarAction);
@Mapping(source = "id", target = "id")
CalendarAction toCalendarAction(CalendarActionDto calendarActionDto);
}
package pwc.taxtech.atms.calendar.dao.ext;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.*;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.calendar.dto.CalendarJurisdictionDto;
import pwc.taxtech.atms.calendar.dto.CalendarTaskTypeDto;
import pwc.taxtech.atms.calendar.dto.EntityDto;
import pwc.taxtech.atms.calendar.entity.CalendarActionJurisdictionRelationship;
import pwc.taxtech.atms.calendar.entity.CalendarJurisdiction;
import java.util.List;
import java.util.Map;
......@@ -57,4 +57,46 @@ public interface CalendarExtMapper extends MyMapper {
@Select("SELECT order_Index FROM calendar_configuration ORDER BY id DESC LIMIT 1")
Integer getMaxConfigOrder();
@Insert("<script>\n" +
"INSERT INTO CalendarActionJurisdictionRelationship\n" +
" ( id, area, description, logic_num, logic_unit, status, create_time, update_time)\n" +
"VALUES\n" +
"<foreach collection='list' item='item' index='index' separator=','>\n" +
" (\n" +
" #{item.id},\n" +
" #{item.area},\n" +
" #{item.description},\n" +
" #{item.logicNum},\n" +
" #{item.logicUnit},\n" +
" #{item.status},\n" +
" #{item.createTime},\n" +
" #{item.updateTime}\n" +
" )\n" +
"</foreach>\n" +
"</script>")
int batchInsertActionJurisdiction(List<CalendarJurisdiction> jurisdictionList);
@Insert("<script>" +
"INSERT INTO CalendarActionJurisdictionRelationship\n" +
"( id, action_id, jurisdiction_id)\n" +
"VALUES\n" +
" <foreach collection='list' item='item' index='index' separator=','>\n" +
" (\n" +
" #{item.id},\n" +
" #{item.actionId},\n" +
" #{item.jurisdictionId}\n" +
" )\n" +
" </foreach> " +
"</script>")
int batchInsertActionJurisdictionRelation(List<CalendarActionJurisdictionRelationship> relationshipList);
@Select("SELECT\n" +
"\tt.id, area, description, logic_num, logic_unit, status\n" +
"FROM\n" +
"\tcalendar_jurisdiction t\n" +
"LEFT JOIN calendar_action_jurisdiction_relationship ON t.id = jurisdiction_id\n" +
"AND action_id = #{actionId}\n" +
"ORDER BY area")
List<CalendarJurisdictionDto> getJurisdictionListByActionId(Long actionId);
}
package pwc.taxtech.atms.calendar.dao.ext;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import pwc.taxtech.atms.calendar.dto.CalendarActionDto;
import pwc.taxtech.atms.calendar.dto.CalendarJurisdictionDto;
import pwc.taxtech.atms.calendar.entity.CalendarAction;
import pwc.taxtech.atms.calendar.entity.CalendarJurisdiction;
@Mapper(componentModel = "spring")
public interface CalendarJurisdictionTMapper {
CalendarJurisdictionTMapper CALENDAR_JURISDICTION_T_MAPPER = Mappers.getMapper(CalendarJurisdictionTMapper.class);
@Mapping(source = "id", target = "id")
CalendarJurisdictionDto toCalendarActionDto(CalendarJurisdiction calendarJurisdiction);
@Mapping(source = "id", target = "id")
CalendarJurisdiction toCalendarAction(CalendarJurisdictionDto calendarJurisdictionDto);
}
package pwc.taxtech.atms.calendar.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* <p> @Description </p>
*
* @Author: Mccoy Z Xia (Xia zhixin)
* @Date: 2019-07-21 20:22
* @Version: 1.0
**/
@Getter
@Setter
@ToString
@NoArgsConstructor
public class CalendarActionDto {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private String name;
@JsonSerialize(using = ToStringSerializer.class)
private Long triggerId;
@JsonSerialize(using = ToStringSerializer.class)
private Long taskTypeId;
private Byte status;
private List<CalendarJurisdictionDto> jurisdictionDtoList;
}
package pwc.taxtech.atms.calendar.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* <p> @Description </p>
*
* @Author: Mccoy Z Xia (Xia zhixin)
* @Date: 2019-07-21 20:28
* @Version: 1.0
**/
@Getter
@Setter
@ToString
@NoArgsConstructor
public class CalendarJurisdictionDto {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private Byte area;
private String description;
private Integer logicNum;
private String logicUnit;
private Byte status;
}
systemConfigurationModule.controller('CalendarActionController', ['$scope', 'SweetAlert', '$translate', 'taxCalendarService', "calendarActionService", "$timeout", "$uibModal", "$document",
function ($scope, SweetAlert, $translate, taxCalendarService, calendarActionService, $timeout, $uibModal, $document) {
'use strict';
$scope.actionList = {};
$scope.taskTypeList = {};
$scope.validateOption = {};
var refreshActionList = function () {
calendarActionService.getCalendarActionList().success(function (res) {
if (res.result) {
$scope.actionList = res.data;
} else {
SweetAlert.warning($translate.instant('SystemException'));
}
})
};
// taskType编辑相关
$scope.taskTypeOptions = {
bindingOptions: {
dataSource: 'taskTypeList',
readOnly: 'isTaskTypeReadOnly'
},
displayExpr: "name",
valueExpr: "id",
showSelectionControls: true,
applyValueMode: "instantly",
multiline: false,
placeholder: $translate.instant('PleaseSelect')
};
$scope.editTaskTypeList = function () {
if ($scope.isReadOnly) {
return;
}
$scope.taskTypeGridOptions = {
showRowLines: true,
showColumnLines: true,
showBorders: true,
allowColumnResizing: true,
hoverStateEnabled: true,
rowAlternationEnabled: true,
bindingOptions: {
dataSource: 'taskTypeList'
},
filterRow: {
visible: true
},
height: 250,
columns: [
{dataField: 'name', caption: $translate.instant('TaxProjectName'), width: '70%'},
{
dataField: '',
caption: $translate.instant('OrderOperation'),
width: '30%',
cellTemplate: function (ele, info) {
$('<i class="fa fa-pencil-square-o"/>').css({
'color': '#d00',
'cursor': 'pointer',
'font-size': '16px'
}).html('&nbsp;&nbsp;').on('dxclick', function () {
$scope.editTaskType(info.data);
}).appendTo(ele);
}
}
]
};
//关闭弹窗口
$scope.hideEditTaskTypeListPanel = function () {
$scope.editTaskTypeListInstance.dismiss('cancel');
};
$scope.editTaskTypeListInstance = $uibModal.open({
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
backdrop: 'static',
templateUrl: 'edit-task-type-pop.html',
windowClass: 'data-table',
appendTo: angular.element($document[0].querySelector('#edit-task-type-pop')),
scope: $scope
});
};
$scope.editTaskType = function (data) {
$scope.validateOption.taskTypeText = {
validationRules: [{
type: "required",
message: $translate.instant('TaxProjectRequireWrite')
}, {
type: "stringLength",
max: 50,
message: $translate.instant('TaxProjectMaxLength')
}]
};
$scope.editTaskTypeEntity = {
id: '',
name: ''
};
if (!data) {
$scope.editTaskTypeTitle = $translate.instant('NewTaxProject');
} else {
$scope.editTaskTypeTitle = $translate.instant('EditTaxProject');
$scope.editTaskTypeEntity.name = data.name;
$scope.editTaskTypeEntity.id = data.id;
}
$scope.confirmSubmitTaskType = function () {
//必填验证
var dxResult = DevExpress.validationEngine.validateGroup($('#editTaskTypeForm').dxValidationGroup("instance")).isValid;
if (!dxResult) {
return;
}
var taskTypeModel = $scope.editTaskTypeEntity;
taxCalendarService.saveTaskType(taskTypeModel).success(function (result) {
if (result.result) {
SweetAlert.success($translate.instant('CommonSuccess'));
$scope.editTaskTypeInstance.dismiss('cancel');
refreshTaskTypeList();
} else if (result.resultMsg == -1) {
SweetAlert.warning($translate.instant('TaxProjectNameRepeat'));
} else {
SweetAlert.warning($translate.instant('SystemException'));
}
});
};
//关闭弹窗口
$scope.hideEditTaskTypePanel = function () {
$scope.editTaskTypeInstance.dismiss('cancel');
};
$scope.editTaskTypeInstance = $uibModal.open({
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
backdrop: 'static',
templateUrl: 'edit-task-type.html',
windowClass: 'data-table',
appendTo: angular.element($document[0].querySelector('#edit-task-type')),
scope: $scope
});
};
var refreshTaskTypeList = function () {
taxCalendarService.getTaskTypeList().success(function (result) {
if (result && result.result && result.data) {
$scope.taskTypeList = result.data;
}
resetEditBoxTag();
});
};
//tagBox控件不可编辑时,隐藏X按钮
var resetEditBoxTag = function () {
$timeout(function () {
if (!!$scope.isReadOnly) {
$('.dx-tag-remove-button').hide();
$('.dx-tag-content').css('padding-right', '6px');
}
if (!!$scope.calendarConfigId) {
$('#tax-project .dx-tag-remove-button').hide();
$('#tax-project .dx-tag-content').css('padding-right', '6px');
}
}, 50);
};
$scope.deleteAction = function (action) {
calendarActionService.deleteCalendarAction(action).success(function (result) {
if (result.result) {
SweetAlert.success($translate.instant('CommonSuccess'));
$scope.editActionInstance.dismiss('cancel');
refreshActionList();
} else {
SweetAlert.warning($translate.instant('SystemException'));
}
});
};
//action detail 弹框相关
$scope.editAction = function (action, type) {
var readOnly = false;
var actionModel = {};
if (type === "Edit") {
$scope.title = action ? "Edit Action" : "Add Action";
actionModel = angular.copy(action);
} else if (type === "Show") {
actionModel = angular.copy(action);
$scope.title = "Action Details";
readOnly = true;
} else {
return;
}
if ($scope.isReadOnly) {
return;
}
var triggerList = constant.trigger.triggerType;
var taskTypeList = $scope.taskTypeList;
var jurisdictionList = actionModel.jurisdictionDtoList;
var logicUnitList = constant.trigger.logicUnit;
$scope.formOptions = {
formData: actionModel,
readOnly: readOnly,
items: [
{
colSpan: 2,
itemType: "group",
// caption: "Action Information",
items: [
{
dataField: "name",
caption: "Action Item Name",
validationRules: [{
type: "required",
message: "Type of Tasks is required"
}]
},
{
dataField: "triggerId",
caption: "Trigger",
editorType: "dxSelectBox",
editorOptions: {
items: triggerList,
displayExpr: "name",
valueExpr: "id"
},
validationRules: [{
type: "required",
message: "Trigger is required"
}]
},
{
dataField: "taskTypeId",
caption: "Type of Tasks",
editorType: "dxSelectBox",
editorOptions: {
items: taskTypeList,
displayExpr: "name",
valueExpr: "id"
},
validationRules: [{
type: "required",
message: "Type of Tasks is required"
}]
}
]
}, {
itemType: "group",
// caption: "Contact Information",
items: [{
colCount: 3,
itemType: "tabbed",
tabPanelOptions: {
deferRendering: false
},
tabs: [
{
title: "Hong Kong",
items: [
{
dataField: "status",
caption: "Valid",
editorType: "dxCheckBox"
}, {
dataField: "logicNum",
caption: "LogicNum"
}, {
dataField: "logicUnit",
caption: "LogicUnit",
editorType: "dxSelectBox",
editorOptions: {
items: logicUnitList,
displayExpr: "name",
valueExpr: "id"
},
validationRules: [{
type: "required",
message: "LogicUnit is required"
}]
}, {
dataField: "description",
caption: "Description",
editorType: "dxTextArea",
colSpan: 3,
editorOptions: {
height: 100
}
}
]
}, {
title: "BVI",
items: [
{
dataField: "status",
caption: "Valid",
editorType: "dxCheckBox"
}, {
dataField: "logicNum",
caption: "LogicNum"
}, {
dataField: "logicUnit",
caption: "LogicUnit",
editorType: "dxSelectBox",
editorOptions: {
items: logicUnitList,
displayExpr: "name",
valueExpr: "id"
},
validationRules: [{
type: "required",
message: "LogicUnit is required"
}]
}, {
dataField: "description",
caption: "Description",
editorType: "dxTextArea",
colSpan: 3,
editorOptions: {
height: 100
}
}
]
}, {
title: "Cayman Islands",
items: [
{
dataField: "status",
caption: "Valid",
editorType: "dxCheckBox"
}, {
dataField: "logicNum",
caption: "LogicNum"
}, {
dataField: "logicUnit",
caption: "LogicUnit",
editorType: "dxSelectBox",
editorOptions: {
items: logicUnitList,
displayExpr: "name",
valueExpr: "id"
},
validationRules: [{
type: "required",
message: "LogicUnit is required"
}]
}, {
dataField: "description",
caption: "Description",
editorType: "dxTextArea",
colSpan: 3,
editorOptions: {
height: 100
}
}
]
}
]
}]
}
]
};
//关闭弹窗口
$scope.hideEditActionPanel = function () {
$scope.editActionInstance.dismiss('cancel');
};
$scope.saveAction = function () {
actionModel.status = actionModel.status ? "1" : "0";
calendarActionService.saveCalendarAction(actionModel).success(function (result) {
if (result.result) {
SweetAlert.success($translate.instant('CommonSuccess'));
$scope.editActionInstance.dismiss('cancel');
refreshActionList();
} else {
SweetAlert.warning($translate.instant('SystemException'));
}
});
};
$scope.editActionInstance = $uibModal.open({
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
backdrop: 'static',
templateUrl: 'edit-action-pop.html',
windowClass: 'data-table',
appendTo: angular.element($document[0].querySelector('#edit-action-pop')),
scope: $scope
});
};
var refreshAll = function () {
refreshActionList();
refreshTaskTypeList();
};
$scope.refreshAll = {};
(function () {
$scope.refreshAll = refreshAll();
refreshAll();
})();
}]);
\ No newline at end of file
<div id="calendar-action">
<div class="calendar-action-Head">{{'CalendarActionHead'|translate}}</div>
<div ng-click="refreshAll()">Refresh</div>
<div class="calendar-action-container">
<div id="data-grid-action">
<div>
<table id="data-table">
<thead id="table-head">
<tr>
<th rowspan="3">Action Item Name</th>
<th rowspan="3">Trigger</th>
<th rowspan="3">
Type of Tasks
<div id="editTaskType" ng-click="editTaskTypeList();">Edit</div>
</th>
<th colspan="9">Jurisdiction of Formation</th>
<th rowspan="3">Operation</th>
</tr>
<tr>
<th colspan="3">Hong Kong</th>
<th colspan="3">BVI</th>
<th colspan="3">Cayman Islands</th>
</tr>
<tr>
<th>Valid</th>
<th>Description</th>
<th>Logic</th>
<th>valid</th>
<th>Description</th>
<th>Logic</th>
<th>valid</th>
<th>Description</th>
<th>Logic</th>
</tr>
</thead>
<tbody id="table-body">
<tr ng-repeat="action in actionList">
<td>{{action.name}}</td>
<td>{{action.triggerId}}</td>
<td>{{action.taskTypeId}}</td>
<td>{{action.status}}</td>
<td>{{action.description}}</td>
<td>
<span>{{action.logicNum}}</span>
<span>{{action.logicUnitId}}</span>
</td>
<td>{{action.status}}</td>
<td>{{action.description}}</td>
<td>
<span>{{action.logicNum}}</span>
<span>{{action.logicUnitId}}</span>
</td>
<td>{{action.status}}</td>
<td>{{action.description}}</td>
<td>
<span>{{action.logicNum}}</span>
<span>{{action.logicUnitId}}</span>
</td>
<td>
<span ng-click="editAction(action, 'Show')">Detail</span>
<span ng-click="editAction(action, 'Edit')">Edit</span>
<span ng-click="deleteAction(action)">Delete</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="edit-task-type-pop"></div>
<script type="text/ng-template" class="content" id="edit-task-type-pop.html">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="hideEditTaskTypeListPanel()">&times;</span>
<h4 class="modal-title">
<i style="color: #b22;font-size: 23px; cursor: pointer;" class="fa fa-pencil"></i>
&nbsp;{{'EditTaxProject' | translate}}
</h4>
</div>
<div class="modal-body">
<div class="row pop-grid-container">
<div class="col-md-12">
<div dx-data-grid="taskTypeGridOptions"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button ng-click="hideEditTaskTypeListPanel();" class="btn btn-default btn-gray">{{'Cancel' | translate}}</button>
<button ng-click="editTaskType();" class="btn btn-default btn-red">{{'NewTaxCalendar' | translate}}</button>
</div>
</script>
<div id="edit-task-type"></div>
<script type="text/ng-template" class="content" id="edit-task-type.html">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="hideEditTaskTypePanel()">&times;</span>
<h4 class="modal-title">
<i style="color: #b22;font-size: 23px; cursor: pointer;" class="fa fa-pencil"></i>
&nbsp;{{editTaskTypeTitle}}
</h4>
</div>
<div class="modal-body" id="editTaskTypeForm" dx-validation-group="{}">
<div class="row">
<div class="col-lg-3">
<span class="form-title">
{{'TaxEvent' | translate}}
</span>
</div>
<div class="col-lg-9">
<div class="box-font" dx-text-box="{}" dx-validator="validateOption.taskTypeText" ng-model="editTaskTypeEntity.name"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button ng-click="hideEditTaskTypePanel();" class="btn btn-default btn-gray">{{'Cancel' | translate}}</button>
<button ng-click="confirmSubmitTaskType();" class="btn btn-default btn-red">{{'Confirm' | translate}}</button>
</div>
</script>
<edit-calendar-action-modal is-show="showEditModal" parent-page=".calendar-action-container" operate-type="orgOperateType" is-update="isOrgUpdate" selected-organization="selectedOrg"></edit-calendar-action-modal>
<div id="edit-action-pop"></div>
<script type="text/ng-template" class="content" id="edit-action-pop.html">
<div class="modal-header">
<span class="close" data-dismiss="modal" aria-hidden="true" ng-click="hideEditActionPanel()">&times;</span>
<div class="long-title"><h3>Action Details</h3></div>
</div>
<div class="modal-body">
<div id="myTabContent" class="tab-content">
<div id="form-container">
<div id="editActionForm" dx-form="formOptions"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button ng-click="hideEditActionPanel();" class="btn btn-default btn-gray">{{'Cancel' | translate}}</button>
<button ng-click="saveAction();" class="btn btn-default btn-red">{{'NewTaxCalendar' | translate}}</button>
</div>
</script>
</div>
systemConfigurationModule.directive('calendarAction', ['$log',
function ($log) {
'use strict';
$log.debug('calendarAction.ctor()...');
return {
restrict: 'E',
templateUrl: '/app/admin/systemConfiguration/calendarAction/calendar-action.html' + '?_=' + Math.random(),
replace: true,
scope: {},
controller: 'CalendarActionController',
link: function (scope, element) {
}
};
}
]);
\ No newline at end of file
#calendar-action {
.calendar-action-Head {
line-height: 60px;
vertical-align: middle;
padding-left: 20px;
display: inline-block;
border: 1px solid #dfdfdf;
width: 100%;
font-weight: bold;
}
table {
border-collapse: collapse;
}
#data-table th, tr {
border: 1px solid #DDD;
padding: 5px;
height: 40px;
text-align: center;
}
#data-table {
margin: 2% 1%;
width: 98%;
}
#table-head {
background-color: #f1f1f1;
text-align: center;
font-size: larger;
}
#table-body {
background-color: #ffffff;
}
#table-body td {
border: 1px solid #DDD;
padding: 5px;
height: 40px;
text-align: center;
}
#editTaskType {
color: red;
font-size: smaller;
margin-top: 5%;
outline: none;
}
#edit-task-type-pop, #edit-task-type, #edit-action-type-pop {
.form-title {
display: inline-block;
vertical-align: middle;
line-height: 36px;
}
.modal-footer {
display: inline-block;
margin-top: 10px;
padding-top: 20px;
width: 100%;
.btn {
float: right;
vertical-align: middle;
height: 30px;
line-height: 28px;
margin-right: 25px;
border: 0;
}
.btn-red {
background-color: #df532a;
color: #fff;
}
.btn-gray {
color: #555;
background-color: #eee;
}
}
}
#edit-action-type-pop {
#form-container {
margin: 10px;
}
.long-title h3 {
font-family: 'Segoe UI Light', 'Helvetica Neue Light', 'Segoe UI', 'Helvetica Neue', 'Trebuchet MS', Verdana;
font-weight: 200;
font-size: 28px;
text-align: center;
margin-bottom: 20px;
}
.modal-footer {
display: inline-block;
margin-top: 10px;
padding-top: 20px;
width: 100%;
.btn {
float: right;
vertical-align: middle;
height: 30px;
line-height: 28px;
margin-right: 25px;
border: 0;
}
.btn-red {
background-color: #df532a;
color: #fff;
}
.btn-gray {
color: #555;
background-color: #eee;
}
}
}
}
\ No newline at end of file
......@@ -644,6 +644,22 @@ var infrastructureModule = angular.module('app.infrastructure', ["isteven-multi-
sticky: true
});
$stateProvider.state({
name: 'calendarAction',
url: '/calendarAction',
views: {
'@': {
controller: ['$scope', '$stateParams', 'appTranslation',
function ($scope, $stateParams, appTranslation) {
appTranslation.load([appTranslation.systemConfiguration]);
}],
template: '<calendar-action></calendar-action>'
}
},
resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.systemConfiguration),
deepStateRedirect: true,
sticky: true
});
$stateProvider.state({
name: 'taxCalendarConfiguration',
......
......@@ -344,6 +344,11 @@
//}
taxCalendarEventService.add(model).success(function (data) {
if (data.result) {
if (data.data){
model.id = data.data;
}
if (_.isFunction($scope.onClosed)) {
$scope.onClosed({ param: { data: model, type: paramResultType }});
......
......@@ -1718,9 +1718,41 @@ constant.organizationHK = {
{id: 2, name: "CFO"},
{id: 3, name: "NA"}
],
executiveType:[
executiveType: [
{id: 1, name: "Y"},
{id: 2, name: "N"}
]
};
constant.trigger = {
triggerType: [
{
id: 1,
name: "change in named/resident secretary"
}, {
id: 2,
name: "change in registered agent"
}, {
id: 3,
name: "change in local registered office"
}
],
logicUnit: [
{
id: 1,
name: "Calendar Day"
}, {
id: 2,
name: "Week Day"
}, {
id: 3,
name: "Month"
}, {
id: 3,
name: "Year"
}
]
};
/************************************************cit constant end*************************************************/
\ No newline at end of file
webservices.factory('calendarActionService', ['$http', 'apiConfig', function ($http, apiConfig) {
'use strict';
return {
getCalendarActionList: function () {
return $http.get('/calendarAction/getCalendarActionList', apiConfig.create());
},
saveCalendarAction: function (data) {
return $http.post('/calendarAction/saveCalendarAction', data, apiConfig.create());
},
deleteCalendarAction: function (id) {
return $http.get('/calendarAction/deleteCalendarAction/' + id, apiConfig.create());
}
};
}]);
\ No newline at end of file
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