app 考勤与休息提交

This commit is contained in:
fl 2025-06-25 10:17:08 +08:00
parent 3ede74352f
commit ec720453fe
3 changed files with 107 additions and 60 deletions

View File

@ -103,20 +103,31 @@ public class AttendanceRestAdapter extends BaseAdapter {
}else {
holder.time.setText(bean.getAddTime());
}
if (Strings.已打卡.equals(bean.getStatus())) {
if ("1".equals(bean.getStatus())) {
holder.status.setTextColor(context.getResources().getColor(R.color.green));
holder.status.setText(bean.getStatus());
} else if ("未打卡".equals(bean.getStatus())){
holder.status.setText("计日打卡");
}else if ("2".equals(bean.getStatus())) {
holder.status.setTextColor(context.getResources().getColor(R.color.green));
holder.status.setText("计件打卡");
}else if ("3".equals(bean.getStatus())) {
holder.status.setTextColor(context.getResources().getColor(R.color.green));
holder.status.setText("停窝工打卡");
}else if ("4".equals(bean.getStatus())) {
holder.status.setTextColor(context.getResources().getColor(R.color.green));
holder.status.setText("休息打卡");
} else if ("5".equals(bean.getStatus())){
holder.status.setTextColor(RED);
holder.status.setText(bean.getStatus());
holder.status.setText("未打卡");
}else {
holder.status.setTextColor(Color.parseColor("#F99F01"));
holder.status.setText(bean.getStatus());
holder.status.setText("异常状态");
}
holder.lay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if ("未打卡".equals(bean.getStatus())){
if ("5".equals(bean.getStatus())){
AlertDialog.Builder builder = new AlertDialog.Builder(context);
View custom = LayoutInflater.from(context).inflate(R.layout.dialog_login_revise, null);
final SuperButton cancel = custom.findViewById(R.id.cancel);
@ -142,7 +153,7 @@ public class AttendanceRestAdapter extends BaseAdapter {
}
});
dialog.show();
}else if ("休息".equals(bean.getStatus())){
}else if ("4".equals(bean.getStatus())){
AlertDialog.Builder builder = new AlertDialog.Builder(context);
View custom = LayoutInflater.from(context).inflate(R.layout.dialog_login_revise, null);
final SuperButton cancel = custom.findViewById(R.id.cancel);
@ -185,17 +196,20 @@ public class AttendanceRestAdapter extends BaseAdapter {
FormBody body = new FormBody.Builder()
.add("idNumber", bean.getIdNumber())
.add("proId", bean.getProId())
.add("currentDay", time)
.add("addTime", "")
.add("currentDay", time.split(" ")[0])
.add("userId",userDao.selectUser().getId())
.add("name",bean.getName())
.add("subId",bean.getSubId())
.add("teamId", bean.getTeamId())
.add("checkMode", "5")
.add("dataType", "5")
.build();
String result = service.httpPost(url,body);
if(!StringHelper.isEmptyAndNull(result)){
try {
JSONObject jsonObject = new JSONObject(result);
String status = jsonObject.getString("resMsg");
if ("success".equals(status)){
String status = jsonObject.getString("res");
if ("1".equals(status)){
XToastUtils.success("已成功取消!");
//刷新
AttendanceRestFragment.instance.initNoExamineData();
@ -219,23 +233,22 @@ public class AttendanceRestAdapter extends BaseAdapter {
FormBody body = new FormBody.Builder()
.add("idNumber", bean.getIdNumber())
.add("proId", bean.getProId())
.add("currentDay", time)
.add("addTime", time)
.add("userId",userDao.selectUser().getId())
.add("name",bean.getName())
.add("subId",bean.getSubId())
.add("teamId", bean.getTeamId())
.add("checkMode", "4")
.add("dataType", "4")
.build();
String result = service.httpPost(url,body);
if(!StringHelper.isEmptyAndNull(result)){
try {
JSONObject jsonObject = new JSONObject(result);
String status = jsonObject.getString("resMsg");
if ("success".equals(status)){
String status = jsonObject.getString("res");
if ("1".equals(status)){
XToastUtils.success("已置为休息!");
//刷新
AttendanceRestFragment.instance.initNoExamineData();
}else {
XToastUtils.error(status);
}

View File

@ -16,6 +16,7 @@ import com.bonus.gzvis.app.adapter.CustomAdpter;
import com.bonus.gzvis.app.application.gzvisApplication;
import com.bonus.gzvis.app.base.BaseFragment;
import com.bonus.gzvis.app.db.dao.basic.UserDao;
import com.bonus.gzvis.app.entity.MapBean;
import com.bonus.gzvis.app.entity.UserBean;
import com.bonus.gzvis.app.entity.person.FaceAttendanceNoExamineBean;
import com.bonus.gzvis.app.util.DateTimeHelper;
@ -68,7 +69,7 @@ public class AttendanceRestFragment extends BaseFragment {
AttendanceRestAdapter attendanceRestAdapter;
List<FaceAttendanceNoExamineBean> noReviewedList;
String type = "no";
String status = "全部";
String status = "";
String teamId = "";
MaterialDialog showDialog;
UserDao userDao = new UserDao(gzvisApplication.getDBHelper());
@ -160,10 +161,16 @@ public class AttendanceRestFragment extends BaseFragment {
*/
public void initSpinner(){
List<String> strList = new ArrayList<>();
strList.add("全部");
strList.add("已打卡");
strList.add("未打卡");
strList.add("休息");
List<MapBean> dataTypeList = new ArrayList<>();
dataTypeList.add(new MapBean("","全部"));
dataTypeList.add(new MapBean("1","计日打卡"));
dataTypeList.add(new MapBean("2","计件打卡"));
dataTypeList.add(new MapBean("3","停窝工打卡"));
dataTypeList.add(new MapBean("4","休息打卡"));
dataTypeList.add(new MapBean("5","未打卡"));
for(int i = 0;i < dataTypeList.size();i++){
strList.add(dataTypeList.get(i).getValue());
}
ArrayAdapter<String> adpter = new CustomAdpter<String>(getActivity(), android.R.layout.simple_spinner_item, strList);
//绑定 Adapter到控件
WidgetUtils.setSpinnerDropDownVerticalOffset(statusSpinner);
@ -172,7 +179,7 @@ public class AttendanceRestFragment extends BaseFragment {
statusSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
status = strList.get(i);
status = dataTypeList.get(i).getKey();
}
@Override
@ -182,6 +189,7 @@ public class AttendanceRestFragment extends BaseFragment {
});
}
/**
* 获取数据
*/
@ -190,7 +198,8 @@ public class AttendanceRestFragment extends BaseFragment {
new Thread(new Runnable() {
@Override
public void run() {
String url = gzamaUrl + "workPerson/selectAttendanceData";
// String url = gzamaUrl + "workPerson/selectAttendanceData";
String url = gzamaUrl + "personAtt/selectAttendanceData";
FormBody body = new FormBody.Builder()
.add("teamId", teamId)
.add("proId", userBean.getProId())
@ -259,8 +268,8 @@ public class AttendanceRestFragment extends BaseFragment {
noReviewedList = new ArrayList<>();
JSONObject noReviewedObj = (JSONObject)msg.obj;
try {
String status = noReviewedObj.getString("resMsg");
if ("success".equals(status)) {
String status = noReviewedObj.getString("res");
if ("1".equals(status)) {
JSONArray jsonArray = noReviewedObj.getJSONArray("obj");
if(jsonArray.length() != 0){
for (int i = 0;i < jsonArray.length();i++){
@ -292,6 +301,7 @@ public class AttendanceRestFragment extends BaseFragment {
showDialog.dismiss();
}
} catch (JSONException e) {
showDialog.dismiss();
e.printStackTrace();
}
break;

View File

@ -2,41 +2,68 @@ package com.bonus.gzvis.app.util;
public class WorkConfig {
/** 正式库 */
// protected static final String GZRAMA_URL = "http://140.210.209.102:1919/hnAma/";
// protected static final String GZRAMA_URL = "http://116.63.172.211:1919/hnAma/"; // 正式环境
// protected static final String GZRAMA_URL = "http://192.168.0.137:1917/hnAma/"; // 方亮
protected static final String GZRAMA_URL = "http://192.168.0.14:1917/hnAma/"; // 测试环境
// protected static final String GZRAMA_URL = "http://172.16.0.235:1919/hnAma/";
//线上内测
// protected static final String GZRAMA_URL = "http://122.9.137.129:1920/hnAma/";
/** 测试库 */
// protected static final String GZRAMA_URL = "http://192.168.0.14:1917/hnAma/";
/** 领导履职系统地址 */
protected static final String GZRAMA_URL_LEADER = "https://www.hnsbd.com.cn/prod-api/token";
//临时
// protected static final String GZRAMA_URL = "http://192.168.2.146:1917/hnAma/";
/** 本地库 */
// protected static final String GZRAMA_URL = "http://192.168.0.15:1917/hnAma/";
/** 上传文件路径 */
protected static final String UPLOAD_FILE_URL = GZRAMA_URL + "user/uploadPhoto";
/** 上传文件-- 返回路径 */
protected static final String UPLOAD_FILE_URL_RETURN = GZRAMA_URL + "user/upload";
/** 上传日志文件路径 */
protected static final String UPLOAD_LOG_FILE_URL = GZRAMA_URL + "user/uploadLog";
/**
* 当前环境
* local 本地
* test 测试
* prod 固定
*/
// @Value("${environment}")
// public static String environment;
public static String environment = "local";
//获取工资支付回执单附件pdf(线上)
// protected static final String pdfUrl = "http://122.9.137.129:1919/hnAma/";
//线上内测
// protected static final String pdfUrl = "http://122.9.137.129:1921/hnBmw/";
protected static final String GZRAMA_URL_LOCAL = "http://192.168.0.137:1917/hnAma/";
protected static final String GZRAMA_URL_TEST = "http://192.168.0.14:1917/hnAma/";
protected static final String GZRAMA_URL_PROD = "http://116.63.172.211:1919/hnAma/";
/** 正式库 */
// protected static final String GZRAMA_URL = "http://140.210.209.102:1919/hnAma/";
//获取工资支付回执单附件pdf(公司测试)
// protected static final String pdfUrl = "http://192.168.0.14:1917/hnAma/";
protected static final String pdfUrlTest = "http://192.168.0.14:1917/hnAma/";
//获取工资支付回执单附件pdf(线上)
protected static final String pdfUrlProd = "http://122.9.137.129:1919/hnAma/";
/** 领导履职系统地址 */
protected static final String GZRAMA_URL_LEADER = "https://www.hnsbd.com.cn/prod-api/token";
/** 上传文件路径 */
protected static final String UPLOAD_FILE_URL = getSystemVisit() + "user/uploadPhoto";
/** 上传文件-- 返回路径 */
protected static final String UPLOAD_FILE_URL_RETURN = getSystemVisit() + "user/upload";
/** 上传日志文件路径 */
protected static final String UPLOAD_LOG_FILE_URL = getSystemVisit() + "user/uploadLog";
public static String getGzramaUrl() {
return GZRAMA_URL;
return getSystemVisit();
}
public static String getPayReceiptUrl() {
return getSystemVisit();
}
public static String getLeaderUrl() {
if(environment.contains("prod")){
return GZRAMA_URL_LEADER;
}else if(environment.contains("test")){
return GZRAMA_URL_LEADER;
}else{
return GZRAMA_URL_LEADER;
}
}
public static String getSystemVisit(){
if(environment.contains("prod")){
return GZRAMA_URL_PROD;
}else if(environment.contains("test")){
return GZRAMA_URL_TEST;
}else{
return GZRAMA_URL_LOCAL;
}
}
//下面是不用切换环境的静态路径
public static String getUploadFileUrl() {
return UPLOAD_FILE_URL;
}
@ -49,11 +76,8 @@ public class WorkConfig {
return UPLOAD_LOG_FILE_URL;
}
public static String getPayReceiptUrl() {
return GZRAMA_URL;
}
public static String getLeaderUrl() {
return GZRAMA_URL_LEADER;
}
}