dev_SaaS
cxt 6 years ago
commit 1fb0c4771a

@ -387,6 +387,14 @@ class EcYearsController < ApplicationController
new_egs.save! new_egs.save!
# 记录新旧对应关系,为之后的中间表做记录 # 记录新旧对应关系,为之后的中间表做记录
egs_record << [pre_egs.id, new_egs.id] egs_record << [pre_egs.id, new_egs.id]
prev_ersvss = EcRequireSubVsStandard.where(:ec_graduation_subitem_id => pre_egs.id)
prev_ersvss.each do |prev_ersvs|
new_ersvss = EcRequireSubVsStandard.new
new_ersvss.attributes = prev_ersvs.attributes.dup.except("id", "ec_graduation_subitem_id")
new_ersvss.ec_graduation_subitem_id = new_egs.id
new_ersvss.save!
end
end end
end end
@ -398,28 +406,29 @@ class EcYearsController < ApplicationController
new_eto.ec_year_id = ec_year.id new_eto.ec_year_id = ec_year.id
new_eto.save! new_eto.save!
# 复制 "毕业要去 vs 培养目标"
pre_ervsos = EcRequirementVsObjective.where(:ec_training_objective_id => pre_eto.id)
pre_ervsos.each do |ervso|
new_ervso = EcRequirementVsObjective.new
new_ervso.attributes = ervso.attributes.dup.except("id", "ec_training_objective_id", "ec_graduation_requirement_id")
new_ervso.ec_training_objective_id = new_eto.id
new_egr_id = -1
egr_record.each do |egr_id|
if egr_id[0] == ervso.id
new_egr_id = egr_id[1]
end
end
raise("找不对应的毕业要求") if new_egr_id == -1
new_ervso.ec_graduation_requirement_id = new_egr_id
end
# 复制 "培养目标分项" # 复制 "培养目标分项"
pre_eto.ec_training_subitems.try(:each) do |pre_ets| pre_eto.ec_training_subitems.try(:each) do |pre_ets|
new_ets = EcTrainingSubitem.new new_ets = EcTrainingSubitem.new
new_ets.attributes = pre_ets.attributes.dup.except("id", "ec_training_objective_id") new_ets.attributes = pre_ets.attributes.dup.except("id", "ec_training_objective_id")
new_ets.ec_training_objective_id = new_eto.id new_ets.ec_training_objective_id = new_eto.id
new_ets.save! new_ets.save!
# 复制 "毕业要去 vs 培养目标"
pre_ervsos = EcRequirementVsObjective.where(:ec_training_objective_id => pre_ets.id)
pre_ervsos.each do |ervso|
new_ervso = EcRequirementVsObjective.new
new_ervso.attributes = ervso.attributes.dup.except("id", "ec_training_objective_id", "ec_graduation_requirement_id")
new_ervso.ec_training_objective_id = new_ets.id
new_egr_id = -1
egr_record.each do |egr_id|
if egr_id[0] == ervso.ec_graduation_requirement_id
new_egr_id = egr_id[1]
end
end
raise("找不对应的毕业要求") if new_egr_id == -1
new_ervso.ec_graduation_requirement_id = new_egr_id
new_ervso.save!
end
end end
end end

@ -5,6 +5,7 @@ require 'digest'
class EcloudController < ApplicationController class EcloudController < ApplicationController
skip_before_filter :verify_authenticity_token skip_before_filter :verify_authenticity_token
before_filter check_sign
before_filter :user_setup before_filter :user_setup
before_filter :require_login, only: [:authorize] before_filter :require_login, only: [:authorize]
@ -35,31 +36,44 @@ class EcloudController < ApplicationController
# 企业开通 # 企业开通
# ecordercode 唯一标志一个企业的订购关系 # ecordercode 唯一标志一个企业的订购关系
def bs_new def bs_new
begin ActiveRecord::Base.transaction do
ecloud = Ecloud.create!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'], begin
trial: params['trial'], bossorderid: params['bossorderid'], custid: params['custid'], ecloud = Ecloud.create!(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
custcode: params['custcode'], registersource: params['registersource'], custname: params['custname'], trial: params['trial'], bossorderid: params['bossorderid'], custid: params['custid'], custtype: params['custtype'],
userid: params['userid'], username: params['username'], useralias: params['useralias'], mobile: params['mobile'], custcode: params['custcode'], registersource: params['registersource'], custname: params['custname'],
email: params['email'], productcode: params['productcode'], begintime: params['begintime'], userid: params['userid'], username: params['username'], useralias: params['useralias'], mobile: params['mobile'],
endtime: params['endtime']) email: params['email'], productcode: params['productcode'], begintime: params['begintime'],
EcloudService.create(opttype: params['services']['opttype'], code: params['services']['code'], begintime: params['services']['begintime'], endtime: params['endtime'])
endtime: params['services']['endtime'], ecloud_id: ecloud.try(:id)) services = params['services'].first
EcloudService.create(opttype: services['opttype'], code: services['code'], begintime: services['begintime'],
render :json => {result: true, errmsg: ""} endtime: services['endtime'], ecloud_id: ecloud.try(:id))
rescue Exception => e
logger.error(e.message) render :json => {result: true, errmsg: ""}
render :json => {code: 500, msg: "#{e.message}"} rescue Exception => e
logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"}
raise ActiveRecord::Rollback
end
end end
end end
# 企业更新 # 企业更新
def bs_update def bs_update
ecloud = Ecloud.where(custid: params['custid']).first ActiveRecord::Base.transaction do
ecloud.update_attribute(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'], begin
custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'], ecloud = Ecloud.where(custid: params['custid']).first
operatime: params['operatime'], effecttime: params['effecttime']) ecloud.update_attribute(applyno: params['applyno'], ecordercode: params['ecordercode'], opttype: params['opttype'],
ecloud.ecloud_services.update_attributes(packagecode: params['services']['packagecode'], bossorderid: params['services']['bossorderid']) custid: params['custid'], custcode: params['custcode'], productcode: params['productcode'],
operatime: params['operatime'], effecttime: params['effecttime'])
services = params['ervices'].first
ecloud.ecloud_services.update_attributes(packagecode: services['packagecode'], bossorderid: services['bossorderid'])
rescue Exception => e
logger.error(e.message)
render :json => {code: 500, msg: "#{e.message}"}
raise ActiveRecord::Rollback
end
end
end end
# 用户业务开通接口 # 用户业务开通接口
@ -171,7 +185,10 @@ class EcloudController < ApplicationController
end end
private private
def ecloudeuser_params def check_sign
{} public_key = '1022'
secret_key = '2112037a-6d7a-432b-9081-feb1153d8668'
timestamp = params['timestamp']
end end
end end

@ -1,6 +1,6 @@
#encoding: utf-8 #encoding: utf-8
class OauthController < ApplicationController class OauthController < ApplicationController
require
include ApplicationHelper include ApplicationHelper
before_filter :user_setup before_filter :user_setup

@ -1,3 +1,3 @@
class EcloudService < ActiveRecord::Base class EcloudService < ActiveRecord::Base
attr_accessible :begintime, :code, :endtime, :opttype attr_accessible :begintime, :code, :endtime, :opttype, :ecloud_id, :packagecode, :bossorderid
end end

@ -538,6 +538,7 @@ class GraduatesRequirement extends Component {
daChengYuZhi: response.data.calculation_value, daChengYuZhi: response.data.calculation_value,
daChengYuZhiSaved: response.data.calculation_value, daChengYuZhiSaved: response.data.calculation_value,
course_ids: response.data.course_ids, course_ids: response.data.course_ids,
is_manager: response.data.is_manager,
calculating: false, calculating: false,
}) })
} }
@ -583,13 +584,14 @@ class GraduatesRequirement extends Component {
} }
render() { render() {
const { match, history, current_user } = this.props const { match, history, current_user } = this.props
const { daChengYuZhiEditableMode, daChengYuZhi, daChengYuZhiSaved } = this.state const { daChengYuZhiEditableMode, daChengYuZhi, daChengYuZhiSaved, is_manager } = this.state
let { schooldata } =this.state; let { schooldata } =this.state;
let { example_major, template_major } = schooldata; let { example_major, template_major } = schooldata;
let showCalculateButton = false; let showCalculateButton = is_manager;
if (example_major && current_user.admin || !example_major && template_major) { // let showCalculateButton = false;
showCalculateButton = true; // if (example_major && current_user.admin || !example_major && template_major) {
} // showCalculateButton = true;
// }
return ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">
<div className="educontent mb290"> <div className="educontent mb290">

Loading…
Cancel
Save