Commit 14c2058e authored by Mccoy Z Xia's avatar Mccoy Z Xia

compliance info 调整

parent e2499407
......@@ -7,6 +7,7 @@ import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.ICalendarEventService;
import javax.annotation.Resource;
import java.util.List;
/**
* <p> @Description </p>
......@@ -42,4 +43,9 @@ public class CalendarEventController {
return calendarEventServiceImpl.getEventByEntityId(entityId);
}
@PostMapping("batchUpdate")
public OperationResultDto batchUpdate(@RequestBody List<CalendarEvent> list){
return calendarEventServiceImpl.batchUpdate(list);
}
}
......@@ -4,6 +4,8 @@ import pwc.taxtech.atms.calendar.entity.CalendarEvent;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.calendar.CalendarDisplayQueryParamDto;
import java.util.List;
public interface ICalendarEventService {
OperationResultDto addEvent(CalendarEvent event);
......@@ -11,4 +13,6 @@ public interface ICalendarEventService {
OperationResultDto deleteEvent(Long id);
OperationResultDto getEventByEntityId(Long entityId);
OperationResultDto batchUpdate(List<CalendarEvent> list);
}
......@@ -96,4 +96,20 @@ public class CalendarEventServiceImpl extends BaseService implements ICalendarEv
return OperationResultDto.success(dtoList);
}
@Override
public OperationResultDto batchUpdate(List<CalendarEvent> list) {
Date updateTime = new Date();
try {
list.forEach(p -> {
p.setUpdateTime(updateTime);
// authUserHelper.getCurrentUserId();
calendarEventMapper.updateByPrimaryKeySelective(p);
});
} catch (Exception e) {
log.error("getEventByEntityId error", e);
}
return OperationResultDto.success();
}
}
......@@ -7,6 +7,7 @@ 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.CalendarEvent;
import pwc.taxtech.atms.calendar.entity.CalendarJurisdiction;
import java.util.List;
......@@ -60,7 +61,7 @@ public interface CalendarExtMapper extends MyMapper {
Integer getMaxConfigOrder();
@Insert("<script>\n" +
"INSERT INTO CalendarActionJurisdictionRelationship\n" +
"INSERT INTO Calendar_Action_Jurisdiction_Relationship\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" +
......@@ -79,7 +80,7 @@ public interface CalendarExtMapper extends MyMapper {
int batchInsertActionJurisdiction(List<CalendarJurisdiction> jurisdictionList);
@Insert("<script>" +
"INSERT INTO CalendarActionJurisdictionRelationship\n" +
"INSERT INTO Calendar_Action_Jurisdiction_Relationship\n" +
"( id, action_id, jurisdiction_id)\n" +
"VALUES\n" +
" <foreach collection='list' item='item' index='index' separator=','>\n" +
......@@ -116,4 +117,5 @@ public interface CalendarExtMapper extends MyMapper {
"ORDER BY\n" +
"\tupdate_time")
List<CalendarEventDto> getEventByEntityId(Long entityId);
}
......@@ -1278,96 +1278,120 @@
var getEventsOfCurrentEntity = function () {
taxCalendarEventService.getEventByEntityId($scope.selectCompany.id).success(function (res) {
if (res.result) {
initCompliance(res.data);
refreshCompliance(res.data);
}
}).error(function () {
initCompliance([]);
refreshCompliance([]);
});
};
var initCompliance = function (calendarEventList) {
var refreshCompliance = function (data) {
calendarEventList = data;
$scope.eventsOfCurrentEntity = angular.copy(calendarEventList);
};
var tempEventList = angular.copy(calendarEventList);
$scope.revertEventsOfCurrentEntity = function(){
$scope.eventsOfCurrentEntity = angular.copy(calendarEventList);
};
var complianceStore = new DevExpress.data.ArrayStore({
key: "id",
data: tempEventList
});
$scope.selectedItemKeys = [];
$scope.batchSaveDisabled = true;
var statusDesc = [{
"id": 0, "name": "N/A"
}, {
"id": 1, "name": "Enable"
}];
$scope.complianceSaveButtonOptions = {
text: "Save",
height: 34,
width: 100,
onClick: function () {
$.each($scope.selectedItemKeys, function () {
complianceStore.byKey(this).done(function (data) {
console.log(data);
})
});
$scope.eventsOfCurrentEntity = [];
$scope.compliance = {
selectedItems: [],
batchSaveDisabled: true
};
var statusDesc = [{
"id": 0, "name": "N/A"
}, {
"id": 1, "name": "Enable"
}];
var calendarEventList = [];
$scope.complianceRevertButtonOptions = {
text: "Revert",
height: 34,
width: 100,
onClick: function () {
$scope.revertEventsOfCurrentEntity();
$("#complianceContainer").dxDataGrid("instance").refresh();
}
};
$scope.complianceSaveButtonOptions = {
text: "Save",
height: 34,
width: 100,
onClick: function () {
$.each($scope.compliance.selectedItems, function () {
console.log(this);
});
taxCalendarEventService.batchUpdate($scope.compliance.selectedItems).success(function (res) {
$scope.compliance.selectedItems = [];
$scope.compliance.batchSaveDisabled = true;
getEventsOfCurrentEntity();
SweetAlert.success($translate.instant('SaveSuccess'));
$("#complianceContainer").dxDataGrid("instance").refresh();
},
bindingOptions: {
disabled: 'batchSaveDisabled'
}
};
}).error(function () {
SweetAlert.error($translate.instant('CommonFail'));
});
$scope.complianceGridOptions = {
dataSource: complianceStore,
showBorders: false,
paging: {
enabled: false
},
editing: {
mode: "cell",
allowUpdating: true
},
selection: {
mode: "multiple"
},
onSelectionChanged: function (data) {
$scope.selectedItemKeys = data.selectedRowKeys;
$scope.batchSaveDisabled = !$scope.selectedItemKeys.length;
},
columns: [
{
dataField: "taskName",
caption: "Action Item"
}, {
dataField: "isEnable",
caption: "Show in calendar",
dataType: "boolean",
width: 150
}, {
dataField: "effectiveDate",
dataType: "date",
width: 150
}, {
dataField: "dueDate",
dataType: "date",
width: 150
}, {
dataField: "status",
width: 150,
lookup: {
dataSource: statusDesc,
displayExpr: "name",
valueExpr: "id"
}
}, {
dataField: "notes",
caption: "Due date logic"
},
bindingOptions: {
disabled: 'compliance.batchSaveDisabled'
}
};
$scope.complianceGridOptions = {
bindingOptions: {
dataSource: 'eventsOfCurrentEntity'
},
showBorders: true,
paging: {
enabled: false
},
editing: {
mode: "cell",
allowUpdating: true
},
selection: {
mode: "multiple"
},
onSelectionChanged: function (data) {
$scope.compliance.selectedItems = data.selectedRowKeys;
$scope.compliance.batchSaveDisabled = !$scope.compliance.selectedItems.length;
},
columns: [
{
dataField: "taskName",
caption: "Action Item"
}, {
dataField: "isEnable",
caption: "Show in calendar",
dataType: "boolean",
width: 150
}, {
dataField: "effectiveDate",
dataType: "date",
width: 150
}, {
dataField: "dueDate",
dataType: "date",
width: 150
}, {
dataField: "status",
width: 150,
lookup: {
dataSource: statusDesc,
displayExpr: "name",
valueExpr: "id"
}
]
};
}, {
dataField: "notes",
caption: "Due date logic"
}
]
};
var initOrgTree = function (nodesCotent) {
......
......@@ -355,7 +355,9 @@
<div class="org-compliance-info-body">
<!-- <div id="ComplianceGridContainer" dx-data-grid="complianceGridOptions" style="margin-top: 10px;"></div>-->
<div id="data-grid-compliance">
<div id="complianceSaveSelected" dx-button="complianceSaveButtonOptions"></div>
<div style="color: red;float: left;margin: 10px 20px;">+ New Action Item</div>
<div class="complianceSaveSelected" dx-button="complianceRevertButtonOptions"></div>
<div class="complianceSaveSelected" dx-button="complianceSaveButtonOptions"></div>
<div id="complianceContainer" dx-data-grid="complianceGridOptions"></div>
</div>
</div>
......
......@@ -1318,9 +1318,9 @@
padding-top: 45px;
}
#complianceSaveSelected {
.complianceSaveSelected {
float: right;
margin: 10px 20px;
margin: 10px 10px;
}
.dx-button-text {
......
......@@ -19,6 +19,10 @@ function ($http, apiConfig, httpCacheService) {
getEventByEntityId: function (id) {
return $http.get('/calendarEvent/getEventByEntityId/' + id, apiConfig.create());
},
batchUpdate: function (model) {
return $http.post('/calendarEvent/batchUpdate', model, 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