You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
3.5 KiB
Java
76 lines
3.5 KiB
Java
![]()
1 year ago
|
package weaver.haikang.cronjob;
|
||
|
|
||
|
import cn.hutool.core.date.DateUtil;
|
||
|
import com.weaver.file.Prop;
|
||
|
import weaver.conn.RecordSet;
|
||
|
import weaver.formmode.setup.ModeRightInfo;
|
||
|
import weaver.general.Util;
|
||
|
import weaver.integration.logging.Logger;
|
||
|
import weaver.integration.logging.LoggerFactory;
|
||
|
|
||
|
import java.util.Date;
|
||
|
|
||
|
/**
|
||
|
* 定时合计 讲师津贴 盛世科技
|
||
|
*/
|
||
|
public class LectureAllowanceService {
|
||
|
private final Logger log = LoggerFactory.getLogger(LectureAllowanceService.class);
|
||
|
|
||
|
private static final String pxjlmxname = Prop.getPropValue("jiangshixinchou","pxjlmxname");
|
||
|
private static final String pxjlname = Prop.getPropValue("jiangshixinchou","pxjlname");
|
||
|
private static final String jmid = Prop.getPropValue("jiangshixinchou","jmid");
|
||
|
private static final String jsdaname = Prop.getPropValue("jiangshixinchou","jsdaname");
|
||
|
|
||
|
private static final String jsjtname = Prop.getPropValue("jiangshixinchou","jsjtname");
|
||
|
|
||
|
|
||
|
|
||
|
public synchronized void execute(String currentYm) {
|
||
|
//培训记录uf_pxjl
|
||
|
//培训记录明细uf_pxjl_dt1
|
||
|
//讲师档案uf_jsda
|
||
|
log.error("howec::::::讲师津贴合计月份:"+currentYm);
|
||
|
RecordSet recordSeta = new RecordSet();
|
||
|
RecordSet recordSetb = new RecordSet();
|
||
|
RecordSet recordSetc = new RecordSet();
|
||
|
RecordSet recordSetd = new RecordSet();
|
||
|
String sql1 = "select d.nums * d.jtbzks as jt,d.pxjsnx,d.pxsj, d.nums, d.jtbzks from " +
|
||
|
"( SELECT SUM(b.ksh) as nums, b.pxjsnx, b.pxsj, b.ksh, b.zxzt, c.jtbzks FROM "+pxjlmxname+" a INNER JOIN "+pxjlname+" b " +
|
||
|
"ON a.mainid = b.id INNER JOIN "+jsdaname+" c ON c.xm = b.pxjsnx where " +
|
||
|
"b.zxzt = 2 AND LEFT(b.pxsj,7)= '"+currentYm+"' group by b.pxjsnx ) d";
|
||
|
log.error("howec::::::讲师津贴合计月份:sql1:"+sql1);
|
||
|
recordSeta.executeQuery(sql1);
|
||
|
while (recordSeta.next()) {
|
||
|
String ny = recordSeta.getString("pxsj"); //年月
|
||
|
String pxjsnx = recordSeta.getString("pxjsnx"); //讲师(内训)
|
||
|
Double nums = recordSeta.getDouble("nums");//总数量
|
||
|
Double jtbzks = recordSeta.getDouble("jtbzks");//标准
|
||
|
Double jt = recordSeta.getDouble("jt");//津贴
|
||
|
String sql2 = "select count(id) as nums from "+jsjtname+" where xm = '"+pxjsnx+"' and ny = '"+currentYm+"'";
|
||
|
log.error("howec::::::讲师津贴合计月份:sql2:"+sql2);
|
||
|
recordSetb.executeQuery(sql2);
|
||
|
recordSetb.next();
|
||
|
if(recordSetb.getInt("nums") == 0) {
|
||
|
String sql = "insert into "+jsjtname+" (ny,xm,kcschj,jtbz,jsjt,formmodeid,modedatacreater,modedatacreatertype,modedatacreatedate,modedatacreatetime) values (?,?,?,?,?,?,?,?,?,?)";
|
||
|
recordSetc.executeUpdate(sql,currentYm,pxjsnx,nums,jtbzks,jt,
|
||
|
jmid,"1","0", DateUtil.today(),DateUtil.formatTime(new Date()));
|
||
|
|
||
|
String idSql = "SELECT max(id) as mid from "+jsjtname+" order by id desc";
|
||
|
recordSetd.executeQuery(idSql);
|
||
|
String id = recordSetd.getString("mid");
|
||
|
// 权限重构
|
||
|
permissionReconstruction(Util.getIntValue(id));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
/**
|
||
|
* 权限重构
|
||
|
* @param billId
|
||
|
*/
|
||
|
private void permissionReconstruction(int billId) {
|
||
|
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||
|
ModeRightInfo.setNewRight(true);
|
||
|
ModeRightInfo.editModeDataShare(1, Util.getIntValue(jmid),billId);
|
||
|
}
|
||
|
}
|