项目承接人需求开发

master
pengqiang 2022-08-29 10:27:30 +08:00
parent c59e3bfdf6
commit 3dd06d3da9
5 changed files with 125 additions and 2 deletions

View File

@ -81,6 +81,8 @@ public class ProjectController extends BaseController {
private ActUtil actUtil;
@Autowired
private NumSeqService numSeqService;
@Autowired
private AdminRepository adminRepository;
/**
*
@ -95,6 +97,9 @@ public class ProjectController extends BaseController {
model.put("adminId", InterfaceUtil.getAdminId());
model.put("admin", InterfaceUtil.getAdmin());
model.put("deptList", deptService.findAll());
List<Admin> adminList = adminRepository.getAllEnable();
adminList = adminList.stream().filter(a-> !"admin".equals(a.getUserName())).collect(Collectors.toList());
model.put("adminList", adminList);
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
model.putIfAbsent("extend", "1");
Page<Project> page = projectService.list(searchInfo, pageNumber, pageSize);
@ -748,6 +753,16 @@ public class ProjectController extends BaseController {
return projectService.skipTask(projectId, json);
}
/**
*
*/
@ResponseBody
@RequestMapping("/batchUpdateApprove")
public ResponseMsg batchUpdateApprove(@RequestBody String json) {
return projectService.batchUpdateApprove(json);
}
/**
*
*/

View File

@ -29,4 +29,10 @@ public interface ProjectRepository extends JpaRepository<Project,Integer> {
@Query(value = "SELECT p.*, FORMAT(p.contract_amount,2) as contractRound, FORMAT(p.huazhi_product_amount,2) as huazhiRound, FORMAT(p.huizhi_product_amount,2) as huizhiRound, FORMAT(p.huasan_product_amount,2) as huasanRound, FORMAT(p.ziguang_other_amount,2) as ziguangRound, FORMAT(p.gross_profit,2) as grossProfitRound, FORMAT(p.gross_profit_margin,2) as grossProfitMarginRound, FORMAT(p.advance_interest_amount,2) as advanceInterestAmountRound, FORMAT(p.advance_peak_amount,2) as advancePeakAmountRound from project p where id = ?1 limit 1", nativeQuery = true)
Project findById(int id);
@Modifying
@Transactional(rollbackOn = Exception.class)
@Query(value = "update project set approve_id=?, approve_name=? where approve_id = ?", nativeQuery = true)
int batchUpdateApprove(int targetAdminId, String targetAdminName, int adminId);
}

View File

@ -150,7 +150,7 @@ public class ProjectService {
//自己创建的肯定能看见,配置的可以看见,系统管理员可以看见
SysRole sysRole = sysRoleRepository.findSysRoleById(roleId);
if(SysRole.ROLE_TYPE_SYSTEM != sysRole.getType()){
queryHelper.addCondition("(p.creator_id=? OR p.id in (SELECT pv1.project_id FROM project_visible pv1 WHERE pv1.type=1 AND pv1.tid=? UNION SELECT pv2.project_id FROM project_visible pv2 WHERE pv2.type=2 AND pv2.tid=?))", adminId, roleId, adminId);
queryHelper.addCondition("(p.creator_id=? OR p.approve_id=? OR p.id in (SELECT pv1.project_id FROM project_visible pv1 WHERE pv1.type=1 AND pv1.tid=? UNION SELECT pv2.project_id FROM project_visible pv2 WHERE pv2.type=2 AND pv2.tid=?))", adminId, adminId, roleId, adminId);
}
@ -535,4 +535,18 @@ public class ProjectService {
Project first = pagination.findFirst(queryHelper.getSql(), Project.class);
return first;
}
/**
*
*
* @param json
* @return
*/
public ResponseMsg batchUpdateApprove(String json) {
JSONObject obj = JSON.parseObject(json);
int adminId = obj.getIntValue("adminId");
Admin targetAdmin = adminRepository.findOne(adminId);
projectRepository.batchUpdateApprove(targetAdmin.getId(), targetAdmin.getRealName(), InterfaceUtil.getAdminId());
return ResponseMsg.buildSuccessMsg("指定成功");
}
}

View File

@ -57,6 +57,9 @@ public class ActUtil {
try {
List<ProjectInstanceRelation> relationList = projectInstanceRelationRepository
.findByProjectIdOrderByCreateTimeDesc(projectId);
if (relationList == null || relationList.isEmpty()) {
return null;
}
ProjectInstanceRelation projectInstanceRelation = relationList.get(0);
return taskService.createTaskQuery().processInstanceId(projectInstanceRelation.getProcessInsId()).singleResult();
} catch (Exception e) {

View File

@ -283,6 +283,12 @@
<span class="am-icon-pencil"></span> 待我审核的项目
</button>
</@shiro.hasPermission>
<button type="button" class="am-btn am-btn-default"
onclick="openChengjieModal()">
<span class="am-icon-refresh"></span> 批量指定承接人
</button>
</div>
</div>
</div>
@ -622,6 +628,41 @@
<!-- /.modal -->
<#--设置审批承接人弹窗-->
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="width: 500px">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">请选择承接账号</h4>
</div>
<input type="hidden" id="hqProjectId" name="hqProjectId" value=''/>
<div class="am-g am-form-group am-margin-top" style="display: flex;">
<div class="am-u-sm-6 am-u-md-6">
<select data-am-selected="{btnSize: 'sm',btnWidth: '150px',maxHeight: 300,searchBox: 1}"
id="approveAdminSelect">
<#list adminList as l>
<option value="${l.id}">${l.realName!}</option>
</#list>
</select>
</div>
<div class="am-u-sm-3 am-u-md-3 input-msg"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" data-am-modal-cancel>关闭</button>
<button type="button" class="btn btn-primary" data-am-modal-confirm onclick="batchUpdateApprove()">提交</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</@defaultLayout.layout>
<script type="text/javascript" src="../modal/js/modal.js"></script>
<script src="../assets/js/amazeui.switch.js"></script>
@ -782,6 +823,38 @@
};
/**
* 设置流程承接人 将自己审批的任务转交给别人
*/
var batchUpdateApprove = function () {
var adminId = $("#approveAdminSelect option:selected").val();
if (adminId == '') {
alert("请选择承接账号");
return;
}
var params = {
adminId: adminId
};
$.ajax({
url: '${base}/project/batchUpdateApprove',
data: JSON.stringify(params),
dataType: "json",
contentType: "application/json",
type: 'post',
async: false,
success: function (data) {
if (data.status == 0) {
alert(data.msg);
window.location.href=window.location.href;
} else if (data.status == 1) {
alert(data.msg);
}
}
});
};
//上传会签单
var generateFileupload = function (name) {
var progressArea = $("#progress-area-" + name);//div
@ -892,7 +965,19 @@
relatedElement: this,
onConfirm: function(id) {
console.log("提交");
projectNoCheck(id);
},
onCancel: function() {
console.log("取消");
}
});
};
var openChengjieModal = function() {
$('#myModal3').modal({
relatedElement: this,
onConfirm: function() {
console.log("提交");
},
onCancel: function() {
console.log("取消");