Commit e87879df authored by neo's avatar neo

[dev] impl query approval task info

parent 91ba9c17
...@@ -13,6 +13,7 @@ import pwc.taxtech.atms.common.util.MyAsserts; ...@@ -13,6 +13,7 @@ import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.dto.approval.ApprovalDto; import pwc.taxtech.atms.dto.approval.ApprovalDto;
import pwc.taxtech.atms.dto.approval.ApprovalTask; import pwc.taxtech.atms.dto.approval.ApprovalTask;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.dpo.ApprovalTaskInfo;
import pwc.taxtech.atms.vat.service.impl.ApprovalService; import pwc.taxtech.atms.vat.service.impl.ApprovalService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -51,8 +52,8 @@ public class ApprovalController { ...@@ -51,8 +52,8 @@ public class ApprovalController {
@ResponseBody @ResponseBody
@RequestMapping(value = "/tasks/{assignee}") @RequestMapping(value = "/tasks/{assignee}")
public List<ApprovalTask> data(@PathVariable String assignee) {//accountant manager public List<ApprovalTaskInfo> data(@PathVariable String assignee) {//accountant manager
return approvalService.getTask(assignee); return approvalService.getTask();
} }
@ResponseBody @ResponseBody
......
...@@ -14,11 +14,11 @@ import pwc.taxtech.atms.common.AuthUserHelper; ...@@ -14,11 +14,11 @@ import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.util.MyAsserts; import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.dto.approval.ApprovalDto; import pwc.taxtech.atms.dto.approval.ApprovalDto;
import pwc.taxtech.atms.dto.approval.ApprovalTask;
import pwc.taxtech.atms.exception.BadParameterException; import pwc.taxtech.atms.exception.BadParameterException;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.vat.dao.PeriodApproveMapper; import pwc.taxtech.atms.vat.dao.PeriodApproveMapper;
import pwc.taxtech.atms.vat.dao.PeriodReportMapper; import pwc.taxtech.atms.vat.dao.PeriodReportMapper;
import pwc.taxtech.atms.vat.dpo.ApprovalTaskInfo;
import pwc.taxtech.atms.vat.entity.PeriodApprove; import pwc.taxtech.atms.vat.entity.PeriodApprove;
import pwc.taxtech.atms.vat.entity.PeriodApproveExample; import pwc.taxtech.atms.vat.entity.PeriodApproveExample;
import pwc.taxtech.atms.vat.entity.PeriodReport; import pwc.taxtech.atms.vat.entity.PeriodReport;
...@@ -26,8 +26,6 @@ import pwc.taxtech.atms.vat.entity.PeriodReportExample; ...@@ -26,8 +26,6 @@ import pwc.taxtech.atms.vat.entity.PeriodReportExample;
import java.util.*; import java.util.*;
import static pwc.taxtech.atms.exception.Exceptions.SERVER_ERROR_EXCEPTION;
@Service @Service
public class ApprovalService { public class ApprovalService {
private static Logger logger = LoggerFactory.getLogger(ApprovalService.class); private static Logger logger = LoggerFactory.getLogger(ApprovalService.class);
...@@ -42,6 +40,7 @@ public class ApprovalService { ...@@ -42,6 +40,7 @@ public class ApprovalService {
@Autowired @Autowired
AuthUserHelper authUserHelper; AuthUserHelper authUserHelper;
@Transactional @Transactional
public void startInstanceAndAssignee(ApprovalDto dto) { public void startInstanceAndAssignee(ApprovalDto dto) {
PeriodApprove pa = new PeriodApprove(); PeriodApprove pa = new PeriodApprove();
...@@ -51,14 +50,10 @@ public class ApprovalService { ...@@ -51,14 +50,10 @@ public class ApprovalService {
} }
public List<ApprovalTask> getTask(String assignee) { public List<ApprovalTaskInfo> getTask() {
List<Task> tasks = taskService.createTaskQuery().taskAssignee(assignee).list(); String userId = authUserHelper.getCurrentUserId();//TODO query user role from sesstion or db
List<ApprovalTask> list = new ArrayList<>(); String assignee = ("66933E7B-DA75-4B2E-B7D6-AB65DCA20D50".equalsIgnoreCase(userId)) ? "manager" : "accountant";
for (Task task : tasks) { return periodApproveMapper.queryApprovalList(assignee.equalsIgnoreCase("manager") ? null : userId);
ApprovalTask t = new ApprovalTask();
list.add(t.copyfrom(task));
}
return list;
} }
private void startInstance(ApprovalDto dto, PeriodApprove pa) { private void startInstance(ApprovalDto dto, PeriodApprove pa) {
...@@ -95,10 +90,11 @@ public class ApprovalService { ...@@ -95,10 +90,11 @@ public class ApprovalService {
pa.setTemplateIds(reportTemplateIds.toString()); pa.setTemplateIds(reportTemplateIds.toString());
pa.setStatus(Constant.APPROVAL_COMMITTED); pa.setStatus(Constant.APPROVAL_COMMITTED);
pa.setProjectId(dto.getProjectId()); pa.setProjectId(dto.getProjectId());
pa.setCreateBy(authUserHelper.getCurrentUserId()==null?"Admin":authUserHelper.getCurrentUserId()); pa.setCreateBy(authUserHelper.getCurrentUserId() == null ? "Admin" : authUserHelper.getCurrentUserId());
pa.setCreateTime(new Date()); pa.setCreateTime(new Date());
periodApproveMapper.insert(pa); periodApproveMapper.insert(pa);
} }
private void startAssignee(PeriodApprove pa) { private void startAssignee(PeriodApprove pa) {
List<Task> tasks = taskService.createTaskQuery().taskAssignee(Constant.ASSIGNEE_ACCOUNTANT).processInstanceId( List<Task> tasks = taskService.createTaskQuery().taskAssignee(Constant.ASSIGNEE_ACCOUNTANT).processInstanceId(
pa.getInstanceId()).list(); pa.getInstanceId()).list();
......
...@@ -3,8 +3,10 @@ package pwc.taxtech.atms.vat.dao; ...@@ -3,8 +3,10 @@ package pwc.taxtech.atms.vat.dao;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper; import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.dpo.ApprovalTaskInfo;
import pwc.taxtech.atms.vat.entity.PeriodApprove; import pwc.taxtech.atms.vat.entity.PeriodApprove;
import pwc.taxtech.atms.vat.entity.PeriodApproveExample; import pwc.taxtech.atms.vat.entity.PeriodApproveExample;
...@@ -105,4 +107,27 @@ public interface PeriodApproveMapper extends MyVatMapper { ...@@ -105,4 +107,27 @@ public interface PeriodApproveMapper extends MyVatMapper {
* @mbg.generated * @mbg.generated
*/ */
int updateByPrimaryKey(PeriodApprove record); int updateByPrimaryKey(PeriodApprove record);
@Select("<script>" +
"SELECT " +
" p.NAME AS projectName, " +
" pa.PERIOD AS period, " +
" pa.INSTANCE_ID AS instanceId, " +
" u1.USER_NAME AS createBy, " +
" u2.USER_NAME AS approvalBy, " +
" pa.STATUS AS status, " +
" pa.APPROVAL_RESUALT AS approvalResult, " +
" pa.CREATE_TIME AS createTime, " +
" pa.APPROVAL_TIME AS approvalTime, " +
" pa.REPORT_PATHS AS reportPaths " +
"FROM " +
" PERIOD_APPROVE pa " +
" INNER JOIN PROJECT p ON pa.PROJECT_ID = p.ID " +
" JOIN \"USER\" u1 ON pa.CREATE_BY = u1.id " +
" LEFT JOIN \"USER\" u2 ON pa.APPROVAL_BY = u2.id " +
"<where> 1=1 " +
" <if test=\"createId != null and createId !='' \">AND pa.CREATE_BY=#{createId}</if>" +
"</where>" +
"</script>")
List<ApprovalTaskInfo> queryApprovalList(@Param("createId") String createId);
} }
\ No newline at end of file
package pwc.taxtech.atms.vat.dpo;
import java.sql.Date;
public class ApprovalTaskInfo {
private String projectName;
private Integer period;
private String instanceId;
private String createBy;
private String approvalBy;
private String status;
private String approvalResult;
private Date createTime;
private Date approvalTime;
private String reportPaths;
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public String getInstanceId() {
return instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getApprovalBy() {
return approvalBy;
}
public void setApprovalBy(String approvalBy) {
this.approvalBy = approvalBy;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getApprovalResult() {
return approvalResult;
}
public void setApprovalResult(String approvalResult) {
this.approvalResult = approvalResult;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getApprovalTime() {
return approvalTime;
}
public void setApprovalTime(Date approvalTime) {
this.approvalTime = approvalTime;
}
public String getReportPaths() {
return reportPaths;
}
public void setReportPaths(String reportPaths) {
this.reportPaths = reportPaths;
}
}
...@@ -659,6 +659,18 @@ ...@@ -659,6 +659,18 @@
orgDisplay.main(); orgDisplay.main();
loadApprovalFromDB(); loadApprovalFromDB();
}); });
/**
private String projectName;
private Integer period;
private String instanceId;
private String createBy;
private String approvalBy;
private String status;
private String approvalResult;
private Date createTime;
private Date approvalTime;
private String reportPaths;
*/
$scope.gridOptions = { $scope.gridOptions = {
rowHeight: constant.UIGrid.rowHeight, rowHeight: constant.UIGrid.rowHeight,
...@@ -668,14 +680,14 @@ ...@@ -668,14 +680,14 @@
enableColumnMenus: false, enableColumnMenus: false,
columnDefs: [ columnDefs: [
{ name: '序号', width: '7%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.index}}<span></div>' }, { name: '序号', width: '7%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.index}}<span></div>' },
{ name: '报表名称', width: '12%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.name}}<span></div>' }, { name: '项目名称', width: '12%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.projectName}}<span></div>' },
{ name: '期间', width: '7%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.kprq | date:"yyyy-MM-dd"}}<span></div>' }, { name: '期间', width: '7%', cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.period}}<span></div>' },
{ name: '提审人', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.fpdm}}">{{row.entity.fpdm}}</span></div>' }, { name: '提审人', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.createBy}}</span></div>' },
{ name: '审批人', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.fphm}}">{{row.entity.fphm}}</span></div>' }, { name: '审批人', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.approvalBy}}</span></div>' },
{ name: '审批状态', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.xfsh}}">{{row.entity.xfsh}}</span></div>' }, { name: '审批状态', width: '10%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.status}}</span></div>' },
{ name: '审批意见', width: '15%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.fplx}}">{{grid.appScope.typeToString(row.entity.fplx)}}</span></div>' }, { name: '审批意见', width: '15%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.approvalResult}}</span></div>' },
{ name: '创建时间', width: '7.5%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.fplx}}">{{grid.appScope.typeToString(row.entity.fplx)}}</span></div>' }, { name: '创建时间', width: '7.5%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.createTime | date:"yyyy-MM-dd")}}</span></div>' },
{ name: '审批时间', width: '7.5%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.fplx}}">{{grid.appScope.typeToString(row.entity.fplx)}}</span></div>' }, { name: '审批时间', width: '7.5%', cellTemplate: '<div class="ui-grid-cell-contents"><span title="{{row.entity.approvalTime | date:"yyyy-MM-dd")}}</span></div>' },
{ name: '操作', width: '15%', cellTemplate: '<div class="ui-grid-cell-contents"><span>审批</span>|<span>下载</span>|<span>流程图</span></div>' } { name: '操作', width: '15%', cellTemplate: '<div class="ui-grid-cell-contents"><span>审批</span>|<span>下载</span>|<span>流程图</span></div>' }
] ]
}; };
......
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