|
|
package com.customization.csxg;
|
|
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
import com.engine.core.cfg.annotation.CommandDynamicProxy;
|
|
|
import com.engine.core.interceptor.AbstractCommandProxy;
|
|
|
import com.engine.core.interceptor.Command;
|
|
|
import com.engine.kq.cmd.shiftmanagement.GetShiftManagementBaseFormCmd;
|
|
|
import org.apache.tika.utils.StringUtils;
|
|
|
import weaver.conn.RecordSet;
|
|
|
import weaver.general.BaseBean;
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import static com.api.browser.util.ConditionType.CHECKBOX;
|
|
|
|
|
|
/**
|
|
|
* 打开班次基本信息页面时增加一个是否24小时制check按钮
|
|
|
*/
|
|
|
@CommandDynamicProxy(target = GetShiftManagementBaseFormCmd.class )
|
|
|
public class GetShiftManagementBaseFormCmdIntercept extends AbstractCommandProxy<Map<String,Object>> {
|
|
|
|
|
|
BaseBean basebean = new BaseBean();
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> execute(Command<Map<String, Object>> command) {
|
|
|
|
|
|
basebean.writeLog("-----GetShiftManagementBaseFormCmdIntercept Start-----");
|
|
|
|
|
|
GetShiftManagementBaseFormCmd cmd = (GetShiftManagementBaseFormCmd) command;
|
|
|
Map<String, Object> params = cmd.getParams();
|
|
|
Map<String, Object> result = nextExecute(cmd);
|
|
|
|
|
|
//增加一个是否24小时制的check按钮
|
|
|
String status = Util.null2String(result.get("status"));
|
|
|
basebean.writeLog("status: " + status);
|
|
|
|
|
|
if (StringUtils.isBlank(status)) {
|
|
|
basebean.writeLog("-----GetShiftManagementBaseFormCmdIntercept End-----");
|
|
|
return result;
|
|
|
}
|
|
|
List<Object> conditions = (List<Object>) result.get("condition");
|
|
|
basebean.writeLog("conditions: " + conditions);
|
|
|
|
|
|
Map<String,Object> condition = (Map<String, Object>) conditions.get(0);
|
|
|
basebean.writeLog("condition: " + condition);
|
|
|
|
|
|
List<SearchConditionItem> items = (List<SearchConditionItem>) condition.get("items");
|
|
|
basebean.writeLog("items: " + items);
|
|
|
|
|
|
String shiftMaId = Util.null2String(params.get("id"));
|
|
|
basebean.writeLog("shiftMaId: " + shiftMaId);
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
if (StringUtils.isBlank(shiftMaId)) {//新建班次
|
|
|
basebean.writeLog("shiftMaId is blank ");
|
|
|
|
|
|
//直接新增一个默认值为否的check按钮
|
|
|
SearchConditionItem scConItem = new SearchConditionItem();
|
|
|
scConItem.setConditionType(CHECKBOX);
|
|
|
String[] domkeyArr = {"is24HourView"};
|
|
|
scConItem.setDomkey(domkeyArr);
|
|
|
scConItem.setLabel("是否24小时制班次");
|
|
|
scConItem.setValue("0");
|
|
|
scConItem.setHelpfulTip("勾选后,则该班次为24小时制,第一次打卡时间到最后一次打卡时间之间的都算做工作时间");
|
|
|
items.add(scConItem);
|
|
|
} else {
|
|
|
basebean.writeLog("shiftMaId not is blank ");
|
|
|
|
|
|
//根据id去判断这个班次是否为24小时制
|
|
|
SearchConditionItem scConItem = new SearchConditionItem();
|
|
|
scConItem.setConditionType(CHECKBOX);
|
|
|
String[] domkeyArr = {"is24HourView"};
|
|
|
scConItem.setDomkey(domkeyArr);
|
|
|
scConItem.setLabel("是否24小时制班次");
|
|
|
scConItem.setHelpfulTip("勾选后,则该班次为24小时制,第一次打卡时间到最后一次打卡时间之间的都算做工作时间");
|
|
|
//查询是与否
|
|
|
Integer is24HourView = -1;
|
|
|
String acqSql = "select is24HourView from kq_ShiftManagement where id = ?";
|
|
|
basebean.writeLog("acqSql: " + acqSql );
|
|
|
|
|
|
rs.executeQuery(acqSql,shiftMaId);
|
|
|
while (rs.next()) {
|
|
|
is24HourView = Util.getIntValue(Util.null2String(rs.getString("is24HourView")));
|
|
|
}
|
|
|
basebean.writeLog("is24HourView: " + is24HourView );
|
|
|
|
|
|
if (is24HourView ==-1 || is24HourView == 0) {//否
|
|
|
scConItem.setValue("0");
|
|
|
} else {
|
|
|
scConItem.setValue("1");
|
|
|
}
|
|
|
|
|
|
items.add(scConItem);
|
|
|
}
|
|
|
basebean.writeLog("-----GetShiftManagementBaseFormCmdIntercept End-----");
|
|
|
return result;
|
|
|
}
|
|
|
}
|