Commit a12ef574 by lixinming

no message

parent 26bdf550
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
<sign>xxx90909082fsdahfjosadjfpoiwausjorip2hjklrhn1ioud0u124rx0qwejfokasjfolksaujfoas</sign> <sign>xxx90909082fsdahfjosadjfpoiwausjorip2hjklrhn1ioud0u124rx0qwejfokasjfolksaujfoas</sign>
</db> </db>
<imgUrl>http://123.207.147.179:40003/</imgUrl> <imgUrl>http://123.207.147.179:40003/</imgUrl>
<fileIP>http://192.168.0.71:40004</fileIP> <fileIP>http://192.168.0.105:40004</fileIP>
</config> </config>
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
import { OPERATIONALDATATYPE, TABLENAME } from "../config/dbEnum"; import { OPERATIONALDATATYPE, TABLENAME } from "../config/dbEnum";
import { UPTYPE } from "../config/enum";
import { ERRORENUM } from "../config/errorEnum"; import { ERRORENUM } from "../config/errorEnum";
import { systemConfig } from "../config/systemConfig"; import { systemConfig } from "../config/systemConfig";
import { selectData } from "../middleware/databaseSuccess"; import { selectData } from "../middleware/databaseSuccess";
...@@ -36,7 +37,7 @@ export async function branchSystemDetsils(bsId:number, token:string, userid:stri ...@@ -36,7 +37,7 @@ export async function branchSystemDetsils(bsId:number, token:string, userid:stri
let clomun = ["bsId", "systemTitle", "fileName"]; let clomun = ["bsId", "systemTitle", "fileName"];
let branchSystemInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.支部制度表, {bsId}, clomun); let branchSystemInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.支部制度表, {bsId}, clomun);
if(!branchSystemInfo || !branchSystemInfo.bsId) throw new BizError(ERRORENUM.库中不存在对应数据, `制度细则中不存在id=${bsId}的数据`); if(!branchSystemInfo || !branchSystemInfo.bsId) throw new BizError(ERRORENUM.库中不存在对应数据, `制度细则中不存在id=${bsId}的数据`);
let fileNameList = getFileUrl(branchSystemInfo.fileName, token, userid); let fileNameList = getFileUrl(branchSystemInfo.fileName, token, UPTYPE.支部制度, userid);
branchSystemInfo.fileName = fileNameList; branchSystemInfo.fileName = fileNameList;
return branchSystemInfo; return branchSystemInfo;
} }
......
...@@ -11,6 +11,8 @@ import * as verificationEnumTools from "../util/verificationEnum"; ...@@ -11,6 +11,8 @@ import * as verificationEnumTools from "../util/verificationEnum";
import * as configEnum from "../config/enum"; import * as configEnum from "../config/enum";
import { systemConfig } from "../config/systemConfig"; import { systemConfig } from "../config/systemConfig";
import { getFileUrl } from "../middleware/getUrl"; import { getFileUrl } from "../middleware/getUrl";
import { BizError } from "../util/bizError";
import { ERRORENUM } from "../config/errorEnum";
/** /**
...@@ -22,20 +24,20 @@ import { getFileUrl } from "../middleware/getUrl"; ...@@ -22,20 +24,20 @@ import { getFileUrl } from "../middleware/getUrl";
* @returns rateLearningList:[{"contentTitle":"学习课题名称", "fileName":["视频地址", ......], "rateOfLearning":0, "learningCompleted":0}] * @returns rateLearningList:[{"contentTitle":"学习课题名称", "fileName":["视频地址", ......], "rateOfLearning":0, "learningCompleted":0}]
*/ */
export async function memberLearningList(pmId:string, courseEntryType:number, courseTypeName:number, contentTitle:string, token:string, userid:string) { export async function memberLearningList(pmId:string, courseEntryType:number, courseTypeName:number, contentTitle:string, token:string, userid:string) {
let rateColumn = ["rlId", "mlId", "rateOfLearning", "learningCompleted"]; let rateColumn = ["rlId", "mlId", "rateOfLearning", "learningCompleted", "textSchedule"];
let rateLearningInfo = await selectData(OPERATIONALDATATYPE.查询多个, TABLENAME.学习进度表, {pmId}, rateColumn); let rateLearningInfo = await selectData(OPERATIONALDATATYPE.查询多个, TABLENAME.学习进度表, {pmId}, rateColumn);
let rateLearningList = []; let rateLearningList = [];
let rateLearningMap = {}; let rateLearningMap = {};
rateLearningInfo.forEach(info => { rateLearningInfo.forEach(info => {
let {rlId, mlId, rateOfLearning, learningCompleted} = info; let {rlId, mlId, rateOfLearning, learningCompleted, textSchedule} = info;
rateLearningMap[mlId] = {rlId, rateOfLearning, learningCompleted} rateLearningMap[mlId] = {rlId, rateOfLearning, learningCompleted, textSchedule};
}); });
let param = {courseEntryType}; let param = {courseEntryType};
if(courseTypeName) param["courseTypeName"] = courseTypeName; if(courseTypeName) param["courseTypeName"] = courseTypeName;
if(contentTitle) param["contentTitle"] = {"%like%": contentTitle}; if(contentTitle) param["contentTitle"] = {"%like%": contentTitle};
let clomun = ["mlId", "contentTitle", "fileName", "coverImage", "videoDuration"]; let clomun = ["mlId", "contentTitle", "fileName", "coverImage", "videoDuration", "courseEntryType"];
let memberLearningInfo = await selectData(OPERATIONALDATATYPE.查询多个, TABLENAME.党员学习表, param, clomun); let memberLearningInfo = await selectData(OPERATIONALDATATYPE.查询多个, TABLENAME.党员学习表, param, clomun);
for(let i = 0; i < memberLearningInfo.length; i++) { for(let i = 0; i < memberLearningInfo.length; i++) {
...@@ -47,28 +49,32 @@ export async function memberLearningList(pmId:string, courseEntryType:number, co ...@@ -47,28 +49,32 @@ export async function memberLearningList(pmId:string, courseEntryType:number, co
pmId, pmId,
mlId, mlId,
rateOfLearning:0, rateOfLearning:0,
learningCompleted: 1 learningCompleted: 1,
courseEntryType:'[]'
} }
await operationalData(OPERATIONALDATATYPE.增加, TABLENAME.学习进度表, addInfo, {}); await operationalData(OPERATIONALDATATYPE.增加, TABLENAME.学习进度表, addInfo, {});
learningInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.学习进度表, {pmId, mlId}, rateColumn); learningInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.学习进度表, {pmId, mlId}, rateColumn);
console.log(learningInfo); console.log(learningInfo);
} }
let filename; let alanysisFileName;
let successFileList = [];//已完成
if (courseEntryType == 2) { if (courseEntryType == 2) {
filename = getFileUrl(fileName, token, userid); alanysisFileName = getFileUrl(fileName, token, configEnum.UPTYPE.党员学习 , userid);
successFileList = learningInfo.textSchedule ? JSON.parse(learningInfo.textSchedule) : [];
} else { } else {
filename = JSON.parse(filename); alanysisFileName = JSON.parse(fileName);
} }
//todo 这里 fileName不再是一个字符串 而是一个对象{}
rateLearningList.push({ rateLearningList.push({
rlId: learningInfo.rlId, rlId: learningInfo.rlId,
contentTitle, contentTitle,
fileName: filename, fileName: alanysisFileName,
rateOfLearning: learningInfo.rateOfLearning, rateOfLearning: learningInfo.rateOfLearning,
learningCompleted: learningInfo.learningCompleted, learningCompleted: learningInfo.learningCompleted,
coverImage, coverImage,
videoDuration videoDuration,
successFileList
}) })
} }
...@@ -152,6 +158,30 @@ export async function updateRateOfLearning(rlId:number, rateOfLearning:number) { ...@@ -152,6 +158,30 @@ export async function updateRateOfLearning(rlId:number, rateOfLearning:number) {
} }
export async function updateDocRateOfLearning(rlId:number, fileName:string) {
let rateLearningInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.学习进度表, {rlId}, ["pmId", "rlId", "textSchedule"]);
if (!rateLearningInfo || !rateLearningInfo.rlId) throw new BizError(ERRORENUM.目标数据不存在, `更新学习进度:rlid:${rlId}`);
let {pmId} = rateLearningInfo;
let learningInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.学习进度表, {pmId}, ["fileName", "pmId", "courseEntryType"]);
if (!learningInfo || !learningInfo.pmId) throw new BizError(ERRORENUM.目标数据不存在, `更新学习进度:pmId:${pmId}`);
if (learningInfo.courseEntryType != 2) throw new BizError(ERRORENUM.该进度不是文字学习, `${pmId}`);
let textSchedule = !rateLearningInfo.textSchedule ? [] : JSON.parse( rateLearningInfo.textSchedule);
let isUpdate = false;
if (textSchedule.indexOf(fileName) == -1) {
isUpdate = true;
textSchedule.push(fileName);
}
if (isUpdate) {
await operationalData(OPERATIONALDATATYPE.修改, TABLENAME.学习进度表, {textSchedule:JSON.stringify(textSchedule)}, {rlId});
}
return {isSuccess:true};
}
......
...@@ -58,7 +58,7 @@ export async function organlzationalLifeListDetsils(oId:number, token:string, us ...@@ -58,7 +58,7 @@ export async function organlzationalLifeListDetsils(oId:number, token:string, us
orgLifeInfo.themeType = verificationEnumTools.changeEnumValue(configEnum.THEMETYPE, orgLifeInfo.themeType); orgLifeInfo.themeType = verificationEnumTools.changeEnumValue(configEnum.THEMETYPE, orgLifeInfo.themeType);
orgLifeInfo.dataMonth = moment(orgLifeInfo.dataMonth).format("YYYY-MM-DD"); orgLifeInfo.dataMonth = moment(orgLifeInfo.dataMonth).format("YYYY-MM-DD");
orgLifeInfo.fileName = getFileUrl(orgLifeInfo.fileName, token, userid); orgLifeInfo.fileName = getFileUrl(orgLifeInfo.fileName, token, configEnum.UPTYPE.组织生活, userid);
return orgLifeInfo; return orgLifeInfo;
} }
......
...@@ -7,7 +7,7 @@ import { selectData } from "../middleware/databaseSuccess"; ...@@ -7,7 +7,7 @@ import { selectData } from "../middleware/databaseSuccess";
import { extractData } from "../util/piecemeal"; import { extractData } from "../util/piecemeal";
import * as splitResultConfig from "../config/splitResultConfig"; import * as splitResultConfig from "../config/splitResultConfig";
import moment = require("moment"); import moment = require("moment");
import { PBTYPE } from "../config/enum"; import { PBTYPE, UPTYPE } from "../config/enum";
import { systemConfig } from "../config/systemConfig"; import { systemConfig } from "../config/systemConfig";
import { getFileUrl } from "../middleware/getUrl"; import { getFileUrl } from "../middleware/getUrl";
...@@ -64,7 +64,7 @@ export async function partyBuildingDynamicDetsils(pbId:number, pbType:number, to ...@@ -64,7 +64,7 @@ export async function partyBuildingDynamicDetsils(pbId:number, pbType:number, to
if (pbType == PBTYPE.党建动态) partyBuildingDynamicInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.党建动态表, {pbId}, clomun); if (pbType == PBTYPE.党建动态) partyBuildingDynamicInfo = await selectData(OPERATIONALDATATYPE.查询单个, TABLENAME.党建动态表, {pbId}, clomun);
partyBuildingDynamicInfo.dataMonth = moment(partyBuildingDynamicInfo.dataMonth).format("YYYY-MM-DD"); partyBuildingDynamicInfo.dataMonth = moment(partyBuildingDynamicInfo.dataMonth).format("YYYY-MM-DD");
let fileNameList = getFileUrl(partyBuildingDynamicInfo.fileName, token, userid); let fileNameList = getFileUrl(partyBuildingDynamicInfo.fileName, token, UPTYPE.党建动态, userid);
partyBuildingDynamicInfo.fileName = fileNameList; partyBuildingDynamicInfo.fileName = fileNameList;
return partyBuildingDynamicInfo; return partyBuildingDynamicInfo;
......
...@@ -246,6 +246,13 @@ export enum PBTYPE { ...@@ -246,6 +246,13 @@ export enum PBTYPE {
export enum UPTYPE {
支部制度 = 1,
组织生活 = 2,
专题活动 = 3,
党建动态 = 4,
党员学习 = 5,
学习强国 = 6
}
...@@ -26,7 +26,8 @@ export enum ERRORENUM { ...@@ -26,7 +26,8 @@ export enum ERRORENUM {
未找到数据, 未找到数据,
库中不存在对应数据, 库中不存在对应数据,
表单校验失败, 表单校验失败,
暂无对应数据 暂无对应数据,
该进度不是文字学习
} }
export enum ERRORCODEENUM { export enum ERRORCODEENUM {
......
/** /**
* 获取数据层接口地址 * 获取数据层接口地址
*/ */
import { FILETYPE } from "../config/enum";
import { systemConfig } from "../config/systemConfig"; import { systemConfig } from "../config/systemConfig";
export enum urlEnum { export enum urlEnum {
...@@ -28,11 +29,10 @@ export function getUrl(url, urlName) { ...@@ -28,11 +29,10 @@ export function getUrl(url, urlName) {
* @param userid * @param userid
* @returns * @returns
*/ */
export function getFileUrl(data, token, userid) { export function getFileUrl(data, token, fileType, userid) {
let fileNameInfo = JSON.parse(data); let fileNameInfo = JSON.parse(data);
let fileNameList = []; let fileNameList = [];
for(let i = 0; i < fileNameInfo.length; i++) { for(let i = 0; i < fileNameInfo.length; i++) {
let fileType = fileNameInfo[i].slice(0, 1);
fileNameList.push(`${systemConfig.fileIP}/yfs/files/${fileType}/${fileNameInfo[i]}?token=${token}&userid=${userid}`); fileNameList.push(`${systemConfig.fileIP}/yfs/files/${fileType}/${fileNameInfo[i]}?token=${token}&userid=${userid}`);
} }
......
...@@ -12,6 +12,7 @@ export function setRouter(httpServer) { ...@@ -12,6 +12,7 @@ export function setRouter(httpServer) {
httpServer.post('/yfs/applet/memberlearning/branchranking', checkAppletToken, asyncHandler(getBranchRanking)); httpServer.post('/yfs/applet/memberlearning/branchranking', checkAppletToken, asyncHandler(getBranchRanking));
httpServer.post('/yfs/applet/memberlearning/monthranking', checkAppletToken, asyncHandler(getMonthRanking)); httpServer.post('/yfs/applet/memberlearning/monthranking', checkAppletToken, asyncHandler(getMonthRanking));
httpServer.post('/yfs/applet/memberlearning/updateschedule', checkAppletToken, asyncHandler(updateRateLearning)); httpServer.post('/yfs/applet/memberlearning/updateschedule', checkAppletToken, asyncHandler(updateRateLearning));
httpServer.post('/yfs/applet/memberlearning/updatefileschedule', checkAppletToken, asyncHandler(updateFileRateLearning));
} }
...@@ -73,6 +74,19 @@ async function updateRateLearning(req, res) { ...@@ -73,6 +74,19 @@ async function updateRateLearning(req, res) {
} }
/**
* 修改学习进度 文档学习
* @param req
* @param res
*/
async function updateFileRateLearning(req, res) {
let reqConf = {rlId:'Number', fileName:'String'};
let {rlId, fileName} = eccReqParamater(reqConf, req.body);
let result = await memberLearningBiz.updateDocRateOfLearning(rlId, fileName);
res.success(result);
}
......
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