问题修改

This commit is contained in:
tqzhang 2025-01-21 19:15:46 +08:00
parent 63cc944674
commit 25f09f395b
18 changed files with 251 additions and 25 deletions

View File

@ -34,4 +34,11 @@ public class EvaluateDataBean {
private String isTwoApprove;
private String name;
private String evaluateType;
private String leaderName;
private String totalScore;
private String evaluateMonth;
private String evaluateDate;
private String year;
private String month;
private String titleName;
}

View File

@ -72,4 +72,9 @@ public class OutSourceBean {
private String isReject;
private String isBusinessDivision;
private String status;
private String filePath;
private String fileName;
private String type;
private String createTime;
}

View File

@ -41,6 +41,7 @@ public class EvalSummaryController extends BaseController<EvaluateBean> {
@ResponseBody
public AjaxRes addEvalSummary(@RequestParam("evaluateTitle") String evaluateTitle,
@RequestParam("date") String date,
@RequestParam("evaluateDept") String evaluateDept,
@RequestParam("file") MultipartFile file) {
AjaxRes ar = getAjaxRes();
if (file != null && !file.isEmpty()) {
@ -64,7 +65,7 @@ public class EvalSummaryController extends BaseController<EvaluateBean> {
// 返回文件路径
String pathname = targetFile.getAbsolutePath();
ar.setSucceedMsg("文件上传成功");
int result = service.addEvalSummary(pathname, date, evaluateTitle);
int result = service.addEvalSummary(pathname, date, evaluateTitle,evaluateDept);
ar.setSucceed(result);
} catch (Exception e) {
logger.error(e.toString(), e);
@ -91,6 +92,43 @@ public class EvalSummaryController extends BaseController<EvaluateBean> {
}
return ar;
}
/**
* 线下评价汇总列表
* @param bean 查询条件
* @return AjaxRes
*/
@RequestMapping(path = "offlineSummaryList", method = RequestMethod.GET)
@ResponseBody
public AjaxRes offlineSummaryList(EvalSummaryBean bean) {
AjaxRes ar = getAjaxRes();
try {
List<OutSourceBean> list = service.getOfflineSummaryList(bean);
ar.setListSucceed(list);
} catch (Exception e) {
logger.error(e.toString(), e);
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}
@RequestMapping("deleteOffEvaluateById")
@ResponseBody
public AjaxRes deleteOffEvaluateById(String id) {
AjaxRes ar = new AjaxRes();
try {
int result = service.deleteOffEvaluateById(id);
if(result > 0) {
ar.setRes(GlobalConst.SUCCEED);
ar.setResMsg("删除成功");
}else {
ar.setFailMsg(GlobalConst.DATA_FAIL);
ar.setResMsg("删除失败,请联系系统管理员");
}
}catch(Exception e) {
ar.setFailMsg(GlobalConst.DATA_FAIL);
}
return ar;
}
}

View File

@ -1,5 +1,7 @@
package com.bonus.gs.sub.evaluate.evaluate.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bonus.gs.sub.evaluate.evaluate.beans.*;
import com.bonus.gs.sub.evaluate.evaluate.dao.OutsourcerEvaluateDao;
import com.bonus.gs.sub.evaluate.evaluate.service.OutsourcerEvaluateService;
@ -9,6 +11,7 @@ import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
import com.bonus.gs.sub.evaluate.manager.utils.GlobalConst;
import com.bonus.gs.sub.evaluate.manager.utils.UserUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -199,6 +203,35 @@ public class OutsourcerEvaluateController extends BaseController<EvaluateSubBean
} else if (startId == 0 && "2".equals(evaluateType)) {
//汇总审核结束 更新状态
outsourcerEvaluateDao.updateEvaluateRecordByEvaluateId("2",o.getEvaluateId());
//添加到月度排名表
EvaluateSubBean subBean = new EvaluateSubBean();
subBean.setEvaluateId(o.getEvaluateId());
subBean.setTemplateId(o.getTemplateId());
subBean.setType("total");
AjaxRes ajaxRes = getCollectTitle(subBean);
JSONArray childDataList = new JSONArray();
childDataList = JSONArray.parseArray(ajaxRes.getResMsg());
List<EvaluateDataBean> dataBeanList = outsourcerEvaluateDao.getEvaluateSubInfo(o);
o.setUserName(UserUtil.getLoginUser().getNickname());
System.out.println("childDataList==" + childDataList);
System.out.println("o==" + o);
System.out.println("dataBeanList==" + dataBeanList);
JSONArray finalChildDataList = childDataList;
dataBeanList.forEach(dataBean -> {
finalChildDataList.forEach(item ->{
if ( dataBean.getSubId().equals(((JSONObject) item).getString("subId"))) {
//取出item中的所有包含total的数据
dataBean.setTotalScore(String.format("%.2f", ((JSONObject) item).getDouble("totalScore")));
dataBean.setTitleName(dataBean.getEvaluateDate() + "对标得分");
}
});
});
String deptId = outsourcerEvaluateDao.getOrgIddByEvaluateId(o.getEvaluateId());
o.setDeptId(deptId);
int code1 = outsourcerEvaluateDao.addMonthRank(o,dataBeanList);
System.out.println("dataBean==" + dataBeanList);
System.out.println("o==" + o);
}else{
//过程中 暂不做处理

View File

@ -29,4 +29,8 @@ public interface EvalSummaryDao {
* @return AjaxRes
*/
List<OutSourceBean> getEvalSummaryList(EvalSummaryBean bean);
List<OutSourceBean> getOfflineSummaryList(EvalSummaryBean bean);
int deleteOffEvaluateById(String id);
}

View File

@ -1,6 +1,7 @@
package com.bonus.gs.sub.evaluate.evaluate.dao;
import com.alibaba.fastjson.JSONArray;
import com.bonus.gs.sub.evaluate.evaluate.beans.*;
import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
import org.apache.ibatis.annotations.Mapper;
@ -134,4 +135,8 @@ public interface OutsourcerEvaluateDao {
int getIsRejectionByDeptId(@Param("bean") EvaluateDataBean o,@Param("dataBean") EvaluateDataBean dataBean);
int isCheckOneIsAudit(EvaluateDataBean o);
List<EvaluateDataBean> getEvaluateSubInfo(EvaluateDataBean o);
int addMonthRank(@Param("bean") EvaluateDataBean bean,@Param("list") List<EvaluateDataBean> list);
}

View File

@ -21,7 +21,7 @@ public interface EvalSummaryService {
* @param pathname 文件路径
* @return AjaxRes
*/
int addEvalSummary(String pathname, String date, String evaluateTitle);
int addEvalSummary(String pathname, String date, String evaluateTitle, String evaluateDept);
/**
* 线下评价汇总列表
@ -29,4 +29,8 @@ public interface EvalSummaryService {
* @return AjaxRes
*/
List<OutSourceBean> getEvalSummaryList(EvalSummaryBean bean);
List<OutSourceBean> getOfflineSummaryList(EvalSummaryBean bean);
int deleteOffEvaluateById(String id);
}

View File

@ -31,11 +31,11 @@ public class EvalSummaryServiceImpl implements EvalSummaryService {
* @return AjaxRes
*/
@Override
public int addEvalSummary(String pathname, String date, String evaluateTitle) {
public int addEvalSummary(String pathname, String date, String evaluateTitle, String evaluateDept) {
EvalSummaryBean bean = new EvalSummaryBean();
bean.setEvaluateMonth(date);
bean.setEvaluateTitle(evaluateTitle);
bean.setEvaluateDept(UserUtil.getLoginUser().getDeptId());
bean.setEvaluateDept(evaluateDept);
bean.setPathName(pathname);
return dao.addEvalSummary(bean);
}
@ -50,4 +50,14 @@ public class EvalSummaryServiceImpl implements EvalSummaryService {
public List<OutSourceBean> getEvalSummaryList(EvalSummaryBean bean) {
return dao.getEvalSummaryList(bean);
}
@Override
public List<OutSourceBean> getOfflineSummaryList(EvalSummaryBean bean) {
return dao.getOfflineSummaryList(bean);
}
@Override
public int deleteOffEvaluateById(String id) {
return dao.deleteOffEvaluateById(id);
}
}

View File

@ -6,6 +6,7 @@ import com.bonus.gs.sub.evaluate.evaluate.beans.*;
import com.bonus.gs.sub.evaluate.evaluate.dao.OutsourcerEvaluateDao;
import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
import com.bonus.gs.sub.evaluate.manager.utils.UserUtil;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.BeanUtils;
@ -494,7 +495,9 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
for (Map<String, Object> map : list){
Map<String, Object> childMap = new LinkedHashMap<>();
childMap.put("subName", map.get("subName"));
childMap.put("subId", map.get("subId"));
childMap.put("proName", map.get("proName"));
childMap.put("proId", map.get("proId"));
Float score = 0.0F;
for (String title : sortList) {
childMap.put(title, map.get(title));
@ -546,6 +549,8 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
for (Map<String, Object> map : list){
Map<String, Object> childMap = new LinkedHashMap<>();
childMap.put("subName", map.get("subName"));
childMap.put("subId", map.get("subId"));
childMap.put("proId", map.get("proId"));
Float score = 0.0F;
for (String title : sortList) {
childMap.put(title, map.get(title));
@ -565,6 +570,18 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
for (String subName : subNameSet) {
Map<String, Object> childMap = new LinkedHashMap<>();
childMap.put("subName", subName);
//从childDataList中获取subId proId 根据subName
String subId = "";
String proId = "";
for (Map<String, Object> map : childDataList) {
if (subName.equals(map.get("subName").toString())) {
subId = map.get("subId").toString();
proId = map.get("proId").toString();
}
}
childMap.put("subId",subId);
childMap.put("proId", proId);
Float score = 0.0F;
for (String title : sortList) {
//从oneList中获取title的countType standardScore
@ -705,6 +722,10 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
childMap.put("subName", dataBean.getSubName());
//添加工程名称
childMap.put("proName", dataBean.getProName());
//添加分包商
childMap.put("subId", dataBean.getSubId());
//添加工程名称
childMap.put("proId", dataBean.getProId());
//对部门下的数据进行循环赋值
for (String title : titleSet) {
System.out.println(title);

View File

@ -1,11 +1,11 @@
server.port=18081
server.port=1803
server.servlet.context-path=/GsSubEvaluate
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/gs_sub_evaluate?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
#spring.datasource.username=root
#spring.datasource.password=bonus@admin123!%
spring.datasource.url=jdbc:mysql://192.168.0.14:1115/gs_sub_evaluate?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
spring.datasource.url=jdbc:mysql://192.168.0.14:4419/gs_sub_evaluate?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=xbzadmin@szedu14!
spring.datasource.password=Bonus@admin123!
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.max-idle=10
spring.datasource.max-wait=60000

View File

@ -6,6 +6,9 @@
insert into pj_offline(type, file_path, evaluate_title, year_and_month, upload_time, update_time)
values (#{evaluateDept}, #{pathName}, #{evaluateTitle}, #{evaluateMonth}, now(),now())
</insert>
<delete id="deleteOffEvaluateById">
update pj_offline set is_active = 0 where offline_id = #{id}
</delete>
<select id="getEvalSummaryList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.OutSourceBean">
select
per.evaluate_id as id,
@ -67,4 +70,24 @@
</if>
order by MAX(per.create_time) desc
</select>
<select id="getOfflineSummaryList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.OutSourceBean">
select
offline_id as id,
poi.name as evaluateDept,
year_and_month as evaluateMonth,
evaluate_title as evaluateTitle,
file_path as filePath,
type as type,
upload_time as createTime
from pj_offline po
left join pm_org_info poi on po.type = poi.id
where po.is_active = 1
<if test="evaluateDeptId != null and evaluateDeptId != ''">
and type = #{evaluateDeptId}
</if>
<if test="evaluateTitle != null and evaluateTitle != ''">
and evaluateTitle like concat('%', #{evaluateTitle}, '%' )
</if>
</select>
</mapper>

View File

@ -626,6 +626,15 @@
insert into pj_task_examine(evaluat_task_id,evaluate_id,post_id,user_list,evaluate_type,evaluate_node)
values (#{evaluatTaskId},#{evaluateId},#{postId},#{userList},#{evaluateType},#{evaluateNode})
</insert>
<insert id="addMonthRank">
insert into
pj_summary_compare(business_id,evaluate_id,sub_id,sub_name,leader_name,evaluate_date,year,month,title_name,score,user_id,user_name) values
<foreach collection="list" item="item" separator=",">
(#{bean.deptId}, #{bean.evaluateId}, #{item.subId}, #{item.subName}, #{item.leaderName},
#{item.evaluateDate}, #{item.year}, #{item.month},
#{item.titleName}, #{item.totalScore}, #{bean.userId}, #{bean.userName})
</foreach>
</insert>
<select id="getExaminePersonByDeptAndRoleName" parameterType="string" resultType="string">
select userId from sys_role_user where userId in (
@ -718,6 +727,28 @@
select count(1) from pj_evaluate_details where evaluate_id = #{evaluateId} and post_id = #{deptId} and
check_one = '1' and sub_evaluate_id = #{templateId}
</select>
<select id="getEvaluateSubInfo" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.EvaluateDataBean">
select
pes.sub_id as subId,
pes.sub_name as subName,
pes.pro_id as proId,
pes.pro_name as proName,
pa.corporateName as leaderName,
per.year_and_month as evaluateMonth,
DATE_FORMAT(CONCAT(per.year_and_month,"-",'01'),'%Y年%c月') as evaluateDate,
DATE_FORMAT(CONCAT(per.year_and_month,"-",'01'),'%Y') as year,
DATE_FORMAT(CONCAT(per.year_and_month,"-",'01'),'%m') as month,
per.dept_id as deptId
from
pj_evaluate_sub pes
left join pm_org_info poi on pes.sub_id = poi.id
left join project_assignment pa on pa.id = poi.lk_id
left join pj_evaluate_record per on pes.evaluate_id = per.evaluate_id
where
pes.evaluate_id = #{evaluateId}
group by
pes.sub_id
</select>
<update id="updateEvaluateRecordByEvaluateId">
update pj_evaluate_record set task_status = #{taskStatus} where evaluate_id = #{evaluateId}

View File

@ -19,7 +19,7 @@ function search(type) {
form.render('select');
}
table.reload('baseTable', {
url: ctxPath + '/backstage/evaluate/evalSummaryList',
url: ctxPath + '/backstage/evaluate/offlineSummaryList',
page: {
curr: 1
},
@ -34,7 +34,7 @@ function initTable() {
//渲染表格
table.render({
elem: '#baseTable'
, url: ctxPath + '/backstage/evaluate/evalSummaryList' //数据接口
, url: ctxPath + '/backstage/evaluate/offlineSummaryList' //数据接口
, method: 'get' //方式默认是get
, toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
, where: {} //post请求必须加where post请求需要的参数
@ -50,9 +50,12 @@ function initTable() {
fixed: 'right', width: 180, title: '操作', align: 'center', templet: d => {
let text = "";
text += '<a lay-event="evaluation" style="color: #009688;cursor: pointer;font-size: 15px"' +
' id="evaluationv">查看</a>';
' id="evaluation">查看</a>';
text += '<a lay-event="viewReviews" style="color: #009688;cursor: pointer;font-size: 15px;margin-left: 10px"' +
' id="viewReviews">下载</a>';
text += '<a lay-event="del" style="color: #009688;cursor: pointer;font-size: 15px;margin-left:' +
' 10px"' +
' id="del">删除</a>';
return text;
}
},
@ -94,16 +97,39 @@ function initTable() {
case 'viewReviews':
downloadFile(data);
break;
case 'del':
del(data);
break;
default:
console.warn(`未知事件: ${layEvent}`);
}
});
function del(data) {
layer.confirm('确认删除吗?', function (index) {
$.ajax({
type: "POST",
url: ctxPath + '/backstage/evaluate/deleteOffEvaluateById',
data: {id: data.id},
success: function (data) {
layer.close(index);
if (data.res === 1) {
layer.msg(data.resMsg, {icon: 1, time: 2000});
search(1);
} else {
layer.msg(data.resMsg, {icon: 2, time: 2000});
}
}
});
});
}
//查看子页面
function ViewReviews(data) {
try {
// let fileUrl = data.pathName;
const fileUrl = '/2024/12/26/外包商对标打分统计表9月_20241226104522A025.xlsx';
let fileUrl = data.filePath;
console.log('fileUrl:', data);
// const fileUrl = '/2024/12/26/外包商对标打分统计表9月_20241226104522A025.xlsx';
// 避免将敏感信息存储在 localStorage 中
sessionStorage.setItem("fileUrl", fileUrl);
@ -123,8 +149,8 @@ function initTable() {
}
function downloadFile(data) {
// let fileUrl = data.pathName;
let fileUrl = '/2024/12/26/外包商对标打分统计表9月_20241226104522A025.xlsx';
let fileUrl = data.pathName;
// let fileUrl = '/2024/12/26/外包商对标打分统计表9月_20241226104522A025.xlsx';
//解析fileUrl获取文件名
let fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
let truePath;
@ -142,11 +168,11 @@ function initTable() {
function add() {
layer.open({
type: 2,
title: "新增企业",
title: "新增",
content: './addEvalSummary.html?id=0',
btn: ["确定"],
maxmin: false,
area: ['30%', '50%'],
area: ['40%', '60%'],
success: function (layero, index) {
},
yes: function (index, layero) {

View File

@ -170,7 +170,6 @@ let titleArr = ['新增项目', '新增外包商', "新增班组", '更换班长
function addForm(type, obj) {
let area = ['50%', '70%'];
if (type === 0) {
obj = {type: type};
area = ['70%', '80%'];
} else if (type === 1) {
area = ['50%', '50%'];

View File

@ -89,7 +89,7 @@ var Base64 = {
}
}
var filePreviewPath = "http://192.168.0.14:21626/file/statics";
var filePreviewPath = "http://36.33.26.201:21624/GsSubEvaluate/statics";
var filePreviewPathAll = "http://192.168.0.14:8012/onlinePreview?url=";

View File

@ -9,6 +9,15 @@
<body>
<div style="padding: 10px;">
<form class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label"><span style="color: red">*</span>事业部:</label>
<div class="layui-input-block">
<select id="evaluateDeptId" name="evaluateDeptId" lay-verify="required">
</select>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label"><span style="color: red">*</span>评价标题:</label>
@ -52,6 +61,7 @@
<script type="text/javascript" src="../../../js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../../js/jq.js"></script>
<script src="../../../js/publicJs.js"></script>
<script src="../../../js/select.js"></script>
<script src="../../../js/common_methon.js"></script>
<script src="../../../js/common.js"></script>
<script type="text/javascript" src="../../../js/my/permission.js"></script>
@ -67,6 +77,8 @@
laydate.render({
elem: '#date',
});
// 获取事业部下拉框数据
businessDivisionPullDown(form, null);
// 让点击上传按钮触发文件输入框的点击事件
$('#uploadBtn').on('click', function() {
$('#fileInput').click();
@ -106,6 +118,7 @@
return false;
}
const formData = data.field; // 获取表单数据
formData.evaluateDept = formData.evaluateDeptId;
const formDataWithFile = new FormData();
for (const key in formData) {
formDataWithFile.append(key, formData[key]);

View File

@ -13,7 +13,7 @@
<fieldset>
<input type="hidden" id="id" name="id">
<div class="form-group">
<label class="col-md-2 control-label">角色</label>
<label class="col-md-2 control-label"><span style="color: red">*</span>角色</label>
<div class="col-md-10">
<div class="layui-input-inline" style="width: 60%;">
<select id="roleId" style="width: 100%;" name="roleId" class="layui-select" lay-search lay-verify="required">
@ -102,6 +102,10 @@
if (!bootstrapValidator.isValid()) {
return;
}
if ($("#roleId").val() == -1 || $("#roleId").val() == null || $("#roleId").val() == "") {
layer.msg("请先选择角色!", {shift: -1, time: 1000});
return;
}
var formdata = $("#form").serializeObject();
formdata.permissionIds = getCheckedMenuIds();
@ -128,6 +132,9 @@
},
success: function (data) {
var html = "";
if(data.length == 0){
html += "<option value='" + -1 + "' disabled style='min-height: 20px'>当前暂无可选角色</option>";
}
for (var i = 0; i < data.length; i++) {
html += "<option value='" + data[i].id + "'>" + data[i].name + "</option>";
}

View File

@ -30,12 +30,12 @@
</div>
</form>
</td>
<td align="right">
<button class="layui-btn layui-btn-sm" onclick="location.href='addUser.html'"
permission="sys:user:add">
<i class="layui-icon">&#xe608;</i> 添加
</button>
</td>
<!-- <td align="right">-->
<!-- <button class="layui-btn layui-btn-sm" onclick="location.href='addUser.html'"-->
<!-- permission="sys:user:add">-->
<!-- <i class="layui-icon">&#xe608;</i> 添加-->
<!-- </button>-->
<!-- </td>-->
</tr>
</table>
</div>