Java 请求的不通方式的对象
2020-12-23 21:27
标签:ali 停用 mod rac ati control get fine etc Java 请求的不通方式的对象 标签:ali 停用 mod rac ati control get fine etc 原文地址:https://www.cnblogs.com/LowKeyCXY/p/13211969.html//提交防疫人员申请
function submitForm(){
var address = $("#address").val();
var userName= $("#userName").val() ;
var sex=$("#sex").attr("data-values");
if(userName =="" || userName == null){
$.modal.msgError("请填写姓名");
return false;
}else{
if(userName.length 22 ){
$.modal.msgError("请填写正确的姓名");
return false;
}
}
var userPhone=$.trim($("#phone").val());
if (userPhone == "" || userPhone== null){
$.modal.msgError("请输入手机号");
return false;
}
if(!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(userPhone))){
$.modal.msgError("手机号码输入错误请重新填写");
return false;
}
var idCard = $("#idCard").val();
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if(!reg.test(idCard))
{
$.modal.msgError("身份证输入不合法");
return false;
}
var mingzhu=$("#mingzhu").attr("data-values");
if(mingzhu=="" || mingzhu==undefined)
{
$.modal.msgError("请选择民族");
return false;
}
if(sex=="" || sex==undefined)
{
$.modal.msgError("请选择性别");
return false;
}
if ($("#province").attr("value") == "" || $("#province").attr("value") == null){
$.modal.msgError("请填写区县");
return false;
}
if ($("#city").val() == "" || $("#city").val() == null){
$.modal.msgError("请填写街道");
return false;
}
if(address == "" || address == null){
$.modal.msgError("请填写详细地址");
return false;
}
var data = new Object();
data={
"phone":$("#userPhone").val(),
"name":$("#userName").val(),
"idcard":$.trim($("#idCard").val()),
"sex":$.trim($("#sex").val()),
"nation":$("#mingzhu").val(),
"dateofbirth":$("#birthday").val(),
"bayonetid":$("#bayonetid").val(),
"phone":$("#phone").val(),
"address":$("#address").val(),
"countyid":$("#province").attr("data-values"),
"townid":$("#city").attr("data-values")
};
$.showLoading("正在提交...");
$.ajax({
url: ctx+‘wechat/epidemic/addAntiepidemicpstaff‘,
data :JSON.stringify(data),
type : ‘post‘,
contentType: "application/json",
success : function(result) {
if (result.code ==200)
{
$.hideLoading();
$.modal.msgSuccess(result.msg);
//$(location).attr(‘href‘, ctx+‘wechat/epidemicContent/success?id=‘+ controller.id);
}
else{
$.hideLoading();
$.modal.msgError(result.msg);
}
}
});
}/**
* 新增保存防疫工作人员信息
*/
@RequestMapping("/addAntiepidemicpstaff")
@ResponseBody
public JSONObject addSave(@RequestBody NtcodeAntiepidemicpstaff staff)
{
JSONObject jsonObject=new JSONObject();
try
{
NtcodeAntiepidemicpstaff antiepidemi=new NtcodeAntiepidemicpstaff();
if(!StringUtils.isBlank(staff.getIdcard()))
{
antiepidemi.setIdcard(staff.getIdcard());
}
List
if(list.size()
{
staff.setUsestatus("00");//(00:申请中待审批,01:启用,02:停用, 03:驳回)
staff.setUuid(staff.getIdcard());//南通百通的UUID
staff.setCreateBy(staff.getName());
staff.setUpdateBy(staff.getName());
staff.setCreateTime(new Date());
staff.setUpdateTime(new Date());
staff.setDeleteflag("0");//0 代表未删除
staff.setDateofbirth(staff.getDateofbirth());
int count= ntcodeAntiepidemicpstaffService.insertNtcodeAntiepidemicpstaff(staff);
if(count>0)
{
jsonObject.set("code",200);
jsonObject.set("msg","申请通过后将通过...方式通知您");
return jsonObject;
}
else
{
jsonObject.set("code",-99);
jsonObject.set("msg","添加失败");
return jsonObject;
}
}
else
{
jsonObject.set("code",-99);
jsonObject.set("msg","该防疫人员已经存在请重新添加");
return jsonObject;
}
}
catch (Exception ex)
{
jsonObject.set("code",-99);
jsonObject.set("msg","添加申请人员发生异常:"+ex.getStackTrace());
return jsonObject;
}
}/**
* 查询街道/镇 列表
*/
@RequestMapping("/getStreetList")
@ResponseBody
public JSONObject getStreetList(NtcodeTown ntcodeTown)
{
JSONObject jsonObject=new JSONObject();
try
{
List
jsonObject.set("code",200);
jsonObject.set("msg","获取成功");
jsonObject.set("list",list);
return jsonObject;
}
catch (Exception ex)
{
jsonObject.set("code",-99);
jsonObject.set("msg","获取街道镇发生异常:"+ex.getStackTrace());
return jsonObject;
}
}$("#city").select({
title: "选择城市",
items: [{}]
})
//进行获取区县列表
function getPrinviceList()
{
$.ajax({
url: ctx+‘wechat/epidemic/getNtcodeCountyList‘,
data:{},
type: ‘post‘,
success: function (result) {
if (result.code==200)
{
controller.getPrinviceList=[];
var lists=new Array();
for(var i=0;i
{
var obj=new Object();
obj.title= result.list[i].countyname;
obj.value= result.list[i].countyid;
lists.push(obj);
}
controller.getPrinviceList=lists;
//进行获取区县
$("#province").select({
title: "选择行政区县",
items: controller.getPrinviceList,
onChange: function () {
var provinceId = $("#province").attr("data-values");
$("#city").attr("data-values", "");
$("#city").attr("value", "");
$("#city").val("");
//获取街道
getStreetList(provinceId);
}
});
}
else
{
$.modal.msgError(result.msg);
}
}
});
}
//进行获取街道数据
function getStreetList(countyid)
{
//进行获取下拉的街道
$.ajax({
url: ctx+‘wechat/epidemic/getStreetList‘,
data:{"countyid":countyid},
type: ‘post‘,
dataType:"json",
success: function (result) {
if (result.code==200)
{
controller.getStreetList=[];
var lists=new Array();
for(var i=0;i
{
var obj=new Object();
obj.title= result.list[i].townname;
obj.value= result.list[i].townid;
lists.push(obj);
}
controller.getStreetList=lists;
//进行获取区县
$("#city").select("update",{
title: "选择街道",
items: controller.getStreetList
});
}
else
{
$.modal.msgError(result.msg);
}
}
});
}// 获取微信用户信息
function getWxUserInfo(requestCode) {
$.ajax({
url: ctx+‘wechat/epidemic/getUserInfo?requestCode=‘+requestCode,
data:{},
type: ‘post‘,
success: function (result) {
console.log(JSON.stringify(result)+"======");
if (result.code==200)
{
$("#userName").val(result.name);
$("#idCard").val(result.idCard);
$("#mingzhu").val(result.mingzhu);
$("#sex").attr("data-values",result.sex);
$("#sex").attr("value",result.sex);
$("#birthday").val(result.brithday);
$("#phone").valid(result.phone);
$("#province").val(result.province);//区或者县
$("#city").val(result.province);//街道或者镇
$("#address").val(result.address);//详细地址
} else {
$.modal.msgError(result.msg);
}
}
});
}
上一篇:多线程详解(一)