增加 查询

bgs_it_pm
wanghao 3 weeks ago
parent 99d846c2b6
commit e8626f43fc

@ -57,5 +57,5 @@ dependencies {
implementation 'com.github.xuexiangjys:XUpdate:2.1.4'
implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-easy:1.0.1'
implementation 'com.github.bumptech.glide:glide:4.16.0'
implementation 'com.contrarywind:Android-PickerView:4.1.9'
}

@ -1,30 +1,94 @@
package com.example.beijing_daxing;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.bumptech.glide.Glide;
import com.example.beijing_daxing.base.BaseActivity;
import com.example.beijing_daxing.base.MyRecultCall;
import com.example.beijing_daxing.base.MyResult;
import com.example.beijing_daxing.been.PmBasePenaltyType;
import com.example.beijing_daxing.been.PmBasePersonInfo;
import com.example.beijing_daxing.been.PmRecordPenalty;
import com.example.beijing_daxing.databinding.ActivitySelectPersonInfoBinding;
import com.example.beijing_daxing.dialog.TakePictureDialog;
import com.example.beijing_daxing.dialog.LookPictureDialog;
import com.example.beijing_daxing.uitls.SharedPreferencesUtils;
import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
public class SelectPersonInfoActivity extends BaseActivity {
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import okhttp3.RequestBody;
public class SelectPersonInfoActivity extends BaseActivity implements OnOptionsSelectListener {
private ActivitySelectPersonInfoBinding binding;
private TakePictureDialog pictureDialog;
private LookPictureDialog pictureDialog;
private PmBasePersonInfo personInfo;
private List<String> list1;
private List<List<String>> list2;
private OptionsPickerView opv;
private List<PmBasePenaltyType> list;
private PmRecordPenalty recordPenalty;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_select_person_info);
pictureDialog=new TakePictureDialog(this);
pictureDialog = new LookPictureDialog(this);
opv= new OptionsPickerBuilder(this, this).build();
initCheckList();
recordPenalty=new PmRecordPenalty();
recordPenalty.setCreateBy(SharedPreferencesUtils.getstring("user",""));
}
private void initCheckList() {
OkGo.<MyResult>post(url + "/selectPenaltyTypeList")
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
MyResult body = response.body();
if (body.getCode() == 0) {
list = gson.fromJson(body.getJson(), new TypeToken<List<PmBasePenaltyType>>() {
}.getType());
list1 = new ArrayList<>();
list2 = new ArrayList<>();
Map<Long, String> map = new HashMap<>();
list.forEach(penaltyType -> {
String penaltyInfo = penaltyType.getPenaltyInfo();// 处罚说明
Long parentId = penaltyType.getParentId();// 父id
Long penaltyTypeId = penaltyType.getPenaltyTypeId();// 自id
if (parentId == null) {// 如果是一级菜单
if (!list1.contains(penaltyInfo)) {
list1.add(penaltyInfo);
map.put(penaltyTypeId, penaltyInfo);
list2.add(new ArrayList<>());
}
} else {// 如果是二级菜单
String tag = map.get(parentId);
int i = list1.indexOf(tag);
String penaltyTypeCode = penaltyType.getPenaltyTypeCode();
list2.get(i).add(penaltyTypeCode+"-"+penaltyInfo);
}
});
opv.setPicker(list1, list2, null);
return;
}
Toast.makeText(SelectPersonInfoActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
@ -33,15 +97,18 @@ public class SelectPersonInfoActivity extends BaseActivity {
binding.selectInfoEpc.setText(bytes2HexString);
OkGo.<MyResult>post(url + "/selectPersonInfo")
.params("epc", bytes2HexString)
.params("user", SharedPreferencesUtils.getstring("user", ""))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
MyResult body = response.body();
if (body.getCode() == 0) {
PmBasePersonInfo personInfo =gson.fromJson(body.getJson(), PmBasePersonInfo.class);
personInfo = gson.fromJson(body.getJson(), PmBasePersonInfo.class);
recordPenalty.setBasePersonId(personInfo.getBasePersonId());
binding.setPersonInfo(personInfo);
Glide.with(SelectPersonInfoActivity.this).load(url.replace("/api", "")+personInfo.getPhotoPath()).into(binding.selectInfoPhoto);
Glide.with(SelectPersonInfoActivity.this).load(url.replace("/api", "") + personInfo.getPhotoPath()).into(binding.selectInfoPhoto);
return;
}
Toast.makeText(SelectPersonInfoActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
@ -50,10 +117,55 @@ public class SelectPersonInfoActivity extends BaseActivity {
}
public void selectInfoPhoto(View view) {
if (personInfo == null) {
Toast.makeText(this, "请先查询人员信息", Toast.LENGTH_SHORT).show();
return;
}
pictureDialog.setPath(url.replace("/api", "") + personInfo.getPhotoPath());
pictureDialog.show();
}
public void checkSelect(View view) {
if (personInfo == null) {
Toast.makeText(this, "请先查询人员信息", Toast.LENGTH_SHORT).show();
return;
}
opv.show();
}
public void selectInfoSubmit(View view) {
OkGo.<MyResult>post(url + "/insertRrecordPenalty")
.upRequestBody(RequestBody.create(JSON, gson.toJson(recordPenalty)))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<MyResult> response) {
super.onSuccess(response);
MyResult body = response.body();
if (body.getCode() == 0) {
finish();
}
Toast.makeText(SelectPersonInfoActivity.this, body.getMsg(), Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onOptionsSelect(int options1, int options2, int options3, View v) {
String type = list1.get(options1);
String s = list2.get(options1).get(options2);
binding.selectPenalty.setText(s);
s = s.substring(s.indexOf("-")+1,s.length());
Log.e("TAG", "onOptionsSelect:" + type + ", " + s);
PmBasePenaltyType penaltyType = new PmBasePenaltyType();
penaltyType.setPenaltyInfo(s);
int index = list.indexOf(penaltyType);
PmBasePenaltyType penaltyType1 = list.get(index);
// 设置处罚类型
recordPenalty.setPenaltyType(type);
recordPenalty.setPenaltyTypeCode(penaltyType1.getPenaltyTypeCode());
recordPenalty.setPenaltyInfo(penaltyType1.getPenaltyInfo());
recordPenalty.setPenaltyAmount(penaltyType1.getPenaltyAmount());
}
}

@ -0,0 +1,109 @@
package com.example.beijing_daxing.been;
import java.math.BigDecimal;
import java.util.Objects;
/**
* pm_base_penalty_type
*
* @author ruoyi
* @date 2025-11-27
*/
public class PmBasePenaltyType {
/**
*
*/
private Long penaltyTypeId;
/** 父菜单ID */
private Long parentId;
/**
*
*/
private String penaltyTypeCode;
/**
*
*/
private String penaltyInfo;
/**
*
*/
private Double penaltyAmount;
/**
*
*/
private String typeState;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PmBasePenaltyType that = (PmBasePenaltyType) o;
return Objects.equals(penaltyInfo, that.penaltyInfo);
}
@Override
public int hashCode() {
return penaltyInfo != null ? penaltyInfo.hashCode() : 0;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Long getPenaltyTypeId() {
return penaltyTypeId;
}
public void setPenaltyTypeId(Long penaltyTypeId) {
this.penaltyTypeId = penaltyTypeId;
}
public String getPenaltyTypeCode() {
return penaltyTypeCode;
}
public void setPenaltyTypeCode(String penaltyTypeCode) {
this.penaltyTypeCode = penaltyTypeCode;
}
public String getPenaltyInfo() {
return penaltyInfo;
}
public void setPenaltyInfo(String penaltyInfo) {
this.penaltyInfo = penaltyInfo;
}
public Double getPenaltyAmount() {
return penaltyAmount;
}
public void setPenaltyAmount(Double penaltyAmount) {
this.penaltyAmount = penaltyAmount;
}
public String getTypeState() {
return typeState;
}
public void setTypeState(String typeState) {
this.typeState = typeState;
}
}

@ -0,0 +1,120 @@
package com.example.beijing_daxing.been;
/**
* pm_record_penalty
*
* @author ruoyi
* @date 2025-11-27
*/
public class PmRecordPenalty {
/**
*
*/
private Long recordPenaltyId;
/**
*
*/
private String penaltyType;
/**
*
*/
private String penaltyTypeCode;
/**
*
*/
private String penaltyInfo;
/**
*
*/
private Double penaltyAmount;
/**
*
*/
private Long basePersonId;
/**
*
*/
private String processState;
private String createBy;
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Long getRecordPenaltyId() {
return recordPenaltyId;
}
public void setRecordPenaltyId(Long recordPenaltyId) {
this.recordPenaltyId = recordPenaltyId;
}
public String getPenaltyType() {
return penaltyType;
}
public void setPenaltyType(String penaltyType) {
this.penaltyType = penaltyType;
}
public String getPenaltyTypeCode() {
return penaltyTypeCode;
}
public void setPenaltyTypeCode(String penaltyTypeCode) {
this.penaltyTypeCode = penaltyTypeCode;
}
public String getPenaltyInfo() {
return penaltyInfo;
}
public void setPenaltyInfo(String penaltyInfo) {
this.penaltyInfo = penaltyInfo;
}
public Double getPenaltyAmount() {
return penaltyAmount;
}
public void setPenaltyAmount(Double penaltyAmount) {
this.penaltyAmount = penaltyAmount;
}
public Long getBasePersonId() {
return basePersonId;
}
public void setBasePersonId(Long basePersonId) {
this.basePersonId = basePersonId;
}
public String getProcessState() {
return processState;
}
public void setProcessState(String processState) {
this.processState = processState;
}
}

@ -150,13 +150,34 @@
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="10dp">
<!-- <Button
<TextView
style="@style/info_text"
android:layout_width="110dp"
android:layout_height="45dp"
android:layout_gravity="center"
android:text="处罚说明:" />
<TextView
android:id="@+id/select_penalty"
style="@style/info_text1"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_gravity="center"
android:drawableEnd="@mipmap/icon_select"
android:onClick="checkSelect"
android:paddingEnd="8dp"/>
</LinearLayout>
<Button
style="@style/button_style"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_margin="20dp"
android:onClick="selectInfoSubmit"
android:text="回库" />-->
android:text="处罚提交" />
</LinearLayout>
</layout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Loading…
Cancel
Save