apk调试
This commit is contained in:
parent
732c3531ba
commit
42eef81b7f
|
|
@ -1,21 +1,34 @@
|
|||
package com.bonus.boot.manager.basic.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.boot.manager.basic.dao.PersonnelLibraryDao;
|
||||
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
|
||||
import com.bonus.boot.manager.basic.entity.ZNode;
|
||||
import com.bonus.boot.manager.basic.service.PersonnelLibraryService;
|
||||
import com.bonus.boot.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.boot.manager.manager.controller.HttpClientUtils;
|
||||
import com.bonus.boot.manager.manager.entity.R;
|
||||
import com.bonus.boot.manager.manager.entity.UnifyBean;
|
||||
import com.bonus.boot.manager.manager.model.SysUser;
|
||||
import com.bonus.boot.manager.manager.service.UserService;
|
||||
import com.bonus.boot.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.boot.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.boot.manager.task.UnifyTask;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.bonus.boot.manager.manager.controller.UserController.login;
|
||||
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
|
||||
|
||||
/**
|
||||
* 包名称:com.bonus.boot.manager.basic.controller
|
||||
* 类名称:PersonnelLibraryController
|
||||
|
|
@ -31,9 +44,13 @@ public class PersonnelLibraryController {
|
|||
@Resource
|
||||
private PersonnelLibraryService service;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Resource
|
||||
private PersonnelLibraryDao daoDao;
|
||||
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getMsgContent")
|
||||
@ApiOperation(value = "体检人员库-列表")
|
||||
|
|
@ -45,7 +62,7 @@ public class PersonnelLibraryController {
|
|||
@RequestMapping(value = "addInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "体检人员库-新增")
|
||||
public AjaxRes addInfo(@RequestBody PersonnelLibraryBean bean) {
|
||||
public AjaxRes addInfo(@RequestBody PersonnelLibraryBean bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.addInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
|
|
@ -63,6 +80,33 @@ public class PersonnelLibraryController {
|
|||
if (cb == 6) {
|
||||
ar.setFailMsg("姓名已存在");
|
||||
}
|
||||
|
||||
int ks = 0;
|
||||
UnifyTask unifyTask = new UnifyTask();
|
||||
if (cb != 3 && cb != 5){
|
||||
String token = login();
|
||||
String isActive = addUser(bean.getPersonName(), bean.getPhone(),token);
|
||||
if(isActive.equals("1")){
|
||||
ks = 1;
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}else{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
isActive = addUser(bean.getPersonName(), bean.getPhone(),token);
|
||||
if(isActive.equals("1")){
|
||||
ks = 1;
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//三次都未推送成功 修改推送状态
|
||||
if(ks!=1){
|
||||
userService.updateUnify(Long.valueOf(bean.getHospId()));
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
}else {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
|
@ -70,7 +114,7 @@ public class PersonnelLibraryController {
|
|||
@RequestMapping(value = "updateInfo", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "体检人员库-修改")
|
||||
public AjaxRes updateInfo(@RequestBody PersonnelLibraryBean bean) {
|
||||
public AjaxRes updateInfo(@RequestBody PersonnelLibraryBean bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = service.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
|
|
@ -83,6 +127,33 @@ public class PersonnelLibraryController {
|
|||
ar.setFailMsg("手机号已存在");
|
||||
}
|
||||
|
||||
int ks = 0;
|
||||
if (cb != 3 && cb != 5){
|
||||
String token = login();
|
||||
String isActive = addUser(bean.getPersonName(), bean.getPhone(),token);
|
||||
if(isActive.equals("1")){
|
||||
ks = 1;
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}else{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
isActive = addUser(bean.getPersonName(), bean.getPhone(),token);
|
||||
if(isActive.equals("1")){
|
||||
ks = 1;
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//三次都未推送成功 修改推送状态
|
||||
if(ks!=1){
|
||||
userService.updateUnify(Long.valueOf(bean.getId()));
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
}else {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
|
@ -107,14 +178,38 @@ public class PersonnelLibraryController {
|
|||
@ApiOperation(value = "体检人员库-删除")
|
||||
public AjaxRes delById(PersonnelLibraryBean bean) {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
try {
|
||||
Long userId = Long.valueOf(bean.getId());
|
||||
SysUser userDto = daoDao.getEyId(userId);
|
||||
|
||||
// 尝试删除操作
|
||||
String token = login();
|
||||
String isActive = deldctUnifyUser(userDto.getUsername(), userDto.getPhone(), token, "移动端");
|
||||
|
||||
// 循环重试机制
|
||||
int ks = 0;
|
||||
while (!isActive.equals("1") && ks < 3) {
|
||||
isActive = deldctUnifyUser(userDto.getUsername(), userDto.getPhone(), token, "移动端");
|
||||
ks++;
|
||||
}
|
||||
// 如果尝试了3次仍然失败,则返回失败信息
|
||||
if (ks == 3) {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
} else {
|
||||
int result = service.delById(bean);
|
||||
if (result == 1) {
|
||||
ar.setSucceedMsg(GlobalConst.DATA_SUCCEED);
|
||||
} else {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 异常处理
|
||||
ar.setFailMsg("Delete operation failed due to an internal error.");
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("resetPassword")
|
||||
|
|
@ -144,4 +239,80 @@ public class PersonnelLibraryController {
|
|||
return ar;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param phone 手机号
|
||||
* @param token token
|
||||
* @return 是否成功
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public String addUser(String userName, String phone, String token) throws Exception {
|
||||
String isActive = "";
|
||||
List<UnifyBean> list = new ArrayList<>();
|
||||
UnifyBean userVo = new UnifyBean();
|
||||
userVo.setUserName(userName);
|
||||
userVo.setPhone(phone);
|
||||
userVo.setSystemName("健康体检");
|
||||
String permissionQuery = userService.getPermissionQuery(userVo);
|
||||
userVo.setAuth(permissionQuery);
|
||||
userVo.setIsBlacklist("0");
|
||||
userVo.setAccountStatus("1");
|
||||
list.add(userVo);
|
||||
String s = JSON.toJSONString(list);
|
||||
String encrypt = AESCBCUtils.encrypt(s, AESCBCUtils.sKey);
|
||||
String params = "{'params':'" + encrypt + "'}";
|
||||
JSONObject object = JSON.parseObject(params);
|
||||
// String result = HttpClientUtils.doHttpPost("http://112.29.103.165:1616/ynuw/sys/api/putUser", object, token);
|
||||
String result = HttpClientUtils.doHttpPost("http://112.29.103.165:1616/ynuw/sys/api/putUser", object, token);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String code = jsonObject.getString("code");
|
||||
System.err.println("新增code="+code);
|
||||
if("200".equals(code)){
|
||||
JSONArray data = jsonObject.getJSONArray("data");
|
||||
System.err.println("新增data="+data);
|
||||
if(data.size() == 0){
|
||||
isActive = "1";
|
||||
}else{
|
||||
isActive = "0";
|
||||
}
|
||||
}else{
|
||||
isActive = "0";
|
||||
}
|
||||
return isActive;
|
||||
}
|
||||
|
||||
private String deldctUnifyUser(String userName, String phone, String token, String auth) throws Exception {
|
||||
String isActive = "";
|
||||
List<UnifyBean> list = new ArrayList<>();
|
||||
UnifyBean userVo = new UnifyBean();
|
||||
userVo.setUserName(userName);
|
||||
userVo.setPhone(phone);
|
||||
userVo.setSystemName("健康体检");
|
||||
userVo.setAuth(auth);
|
||||
list.add(userVo);
|
||||
String s = JSON.toJSONString(list);
|
||||
String encrypt = AESCBCUtils.encrypt(s, AESCBCUtils.sKey);
|
||||
String params = "{'params':'" + encrypt + "'}";
|
||||
JSONObject object = JSON.parseObject(params);
|
||||
// String result = HttpClientUtils.doHttpPost("http://112.29.103.165:1616/ynuw/sys/api/delUser", object, token);
|
||||
String result = HttpClientUtils.doHttpPost("http://112.29.103.165:1616/ynuw/sys/api/delUser", object, token);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String code = jsonObject.getString("code");
|
||||
System.err.println("删除code="+code);
|
||||
if(code.equals("200")){
|
||||
JSONArray data = jsonObject.getJSONArray("data");
|
||||
System.err.println("删除data="+data);
|
||||
if(data.size() == 0){
|
||||
isActive = "1";
|
||||
}else{
|
||||
isActive = "0";
|
||||
}
|
||||
}else{
|
||||
isActive = "0";
|
||||
}
|
||||
return isActive;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.boot.manager.basic.dao;
|
|||
|
||||
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
|
||||
import com.bonus.boot.manager.basic.entity.ZNode;
|
||||
import com.bonus.boot.manager.manager.model.SysUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -39,4 +40,6 @@ public interface PersonnelLibraryDao {
|
|||
int AddInf(PersonnelLibraryBean bean);
|
||||
|
||||
int updatete(PersonnelLibraryBean bean);
|
||||
|
||||
SysUser getEyId(Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ public class EmployeeHealthCheckController {
|
|||
System.out.println(imageFiles);
|
||||
dao.updatePDFAddress(nameList.get(i).split("-")[1],imageFiles);
|
||||
// String linkPath = "http://112.31.106.186:1616/yntj/";//正式环境
|
||||
String linkPath = "http://192.168.0.14:1616/yntj";//测试环境
|
||||
String linkPath = "http://192.168.0.14:18077/yntj";//测试环境
|
||||
String phone = dao.getPersonPhoneNumber(nameList.get(i).split("-")[1]);
|
||||
String msg = nameList.get(i).split("-")[0]+"您的体检结果已生成,请点击查看"+linkPath;
|
||||
SendPhoneMessageUtil.SendPhoneMsg(phone,msg);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@
|
|||
|
||||
<insert id="addInfo" keyProperty="hospId" useGeneratedKeys="true">
|
||||
<!-- 插入到pm_base_physical表 -->
|
||||
insert into pm_base_physical(phy_name,idcard,age,depart_id,sex,if_higher,telep_number,if_job,special_job,phy_password,is_active,status,nosocomium,set_meal,personnel_type)
|
||||
values (#{personName},#{idNumber},#{age},#{departmentId},#{sex},#{higherJob},#{phone},#{personType},#{specialPost},#{password},'1','1',#{hospital},#{setMeal},#{personnelType})
|
||||
|
||||
insert into
|
||||
pm_base_physical(phy_name,idcard,age,depart_id,sex,if_higher,telep_number,if_job,special_job,phy_password,is_active,status,nosocomium,set_meal,personnel_type,pushStatus)
|
||||
values
|
||||
(#{personName},#{idNumber},#{age},#{departmentId},#{sex},#{higherJob},#{phone},#{personType},#{specialPost},#{password},'1','1',#{hospital},#{setMeal},#{personnelType},'1')
|
||||
</insert>
|
||||
<insert id="addresult">
|
||||
insert into pm_physical_result(physical_id) values (#{id})
|
||||
insert into pm_physical_result(physical_id)
|
||||
values (#{id})
|
||||
</insert>
|
||||
<insert id="AddInf">
|
||||
<!-- 判断特定条件是否满足,然后再插入记录到pm_occupation_phy_result表 -->
|
||||
|
|
@ -17,38 +19,52 @@
|
|||
VALUES (#{hospId},#{personName}, #{departmentId}, #{sex}, #{idNumber}, #{phone}, #{specialPost})
|
||||
</insert>
|
||||
<update id="updateInfo">
|
||||
update pm_base_physical set
|
||||
depart_id = #{departmentId},
|
||||
update pm_base_physical
|
||||
set depart_id = #{departmentId},
|
||||
if_higher =#{higherJob},
|
||||
if_job = #{personType},
|
||||
special_job = #{specialPost},
|
||||
nosocomium = #{hospital},
|
||||
personnel_type = #{personnelType},
|
||||
set_meal = #{setMeal}
|
||||
where id = #{id} and is_active='1'
|
||||
where id = #{id}
|
||||
and is_active = '1'
|
||||
</update>
|
||||
<update id="resetPassword">
|
||||
update pm_base_physical set phy_password = #{password} where id = #{id}
|
||||
update pm_base_physical
|
||||
set phy_password = #{password}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="delById">
|
||||
update pm_base_physical set is_active = '0' where id = #{id}
|
||||
update pm_base_physical
|
||||
set is_active = '0'
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePersonExport" >
|
||||
insert into pm_base_physical(phy_name,idcard,depart_id,sex,telep_number,phy_password,if_job,age,special_job,is_active)
|
||||
values (#{personName},#{idNumber},#{department},#{sex},#{phone},#{password},#{personType},#{age},#{specialPost},'1')
|
||||
<update id="updatePersonExport">
|
||||
insert into pm_base_physical(phy_name, idcard, depart_id, sex, telep_number, phy_password, if_job, age,
|
||||
special_job, is_active)
|
||||
values (#{personName}, #{idNumber}, #{department}, #{sex}, #{phone}, #{password}, #{personType}, #{age},
|
||||
#{specialPost}, '1')
|
||||
</update>
|
||||
<update id="updatephyInfo">
|
||||
update pm_base_physical set
|
||||
phy_name=#{personName},idcard=#{idNumber},depart_id=#{department},telep_number=#{phone},
|
||||
if_job=#{personType},age=#{age},special_job=#{specialPost}
|
||||
where telep_number=#{phone} and is_active='1'
|
||||
update pm_base_physical
|
||||
set phy_name=#{personName},
|
||||
idcard=#{idNumber},
|
||||
depart_id=#{department},
|
||||
telep_number=#{phone},
|
||||
if_job=#{personType},
|
||||
age=#{age},
|
||||
special_job=#{specialPost}
|
||||
where telep_number = #{phone}
|
||||
and is_active = '1'
|
||||
</update>
|
||||
<update id="updatete">
|
||||
update pm_occupation_phy_result set
|
||||
depart = #{departmentId},
|
||||
update pm_occupation_phy_result
|
||||
set depart = #{departmentId},
|
||||
special_job = #{specialPost}
|
||||
where phy_id = #{id} and is_active='1'
|
||||
where phy_id = #{id}
|
||||
and is_active = '1'
|
||||
</update>
|
||||
|
||||
<select id="getList" resultType="com.bonus.boot.manager.basic.entity.PersonnelLibraryBean">
|
||||
|
|
@ -93,8 +109,7 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="getListById" resultType="com.bonus.boot.manager.basic.entity.PersonnelLibraryBean">
|
||||
select
|
||||
pbp.id,
|
||||
select pbp.id,
|
||||
pbp.phy_name as personName,
|
||||
pbp.idcard as idNumber,
|
||||
pbp.age,
|
||||
|
|
@ -112,29 +127,43 @@
|
|||
from pm_base_physical pbp
|
||||
left join pm_base_special_job pbsj on pbsj.id = pbp.special_job and pbsj.is_active = '1'
|
||||
left join pm_phy_organization po on po.id = pbp.depart_id
|
||||
where pbp.is_active = '1' and pbp.id = #{id}
|
||||
where pbp.is_active = '1'
|
||||
and pbp.id = #{id}
|
||||
</select>
|
||||
<select id="getDepartmentTree" resultType="com.bonus.boot.manager.basic.entity.ZNode">
|
||||
SELECT
|
||||
ID,
|
||||
SELECT ID,
|
||||
`NAME`,
|
||||
PARENT_ID as pId,
|
||||
0 as type
|
||||
FROM
|
||||
pm_organization
|
||||
WHERE
|
||||
IS_ACTIVE = '1'
|
||||
FROM pm_organization
|
||||
WHERE IS_ACTIVE = '1'
|
||||
</select>
|
||||
<select id="getinfoByidcard" resultType="java.lang.Integer">
|
||||
SELECT count(1) from pm_base_physical where
|
||||
is_active='1'
|
||||
and telep_number=#{phone}
|
||||
SELECT count(1)
|
||||
from pm_base_physical
|
||||
where is_active = '1'
|
||||
and telep_number = #{phone}
|
||||
</select>
|
||||
<select id="getdepartmentName" resultType="java.lang.String">
|
||||
select id from pm_phy_organization where `name` =#{department} and is_active='1' limit 1
|
||||
select id
|
||||
from pm_phy_organization
|
||||
where `name` = #{department}
|
||||
and is_active = '1'
|
||||
limit 1
|
||||
</select>
|
||||
<select id="getspecJobName" resultType="java.lang.String">
|
||||
select id from pm_base_special_job where job_name=#{specJob} and is_active='1' limit 1
|
||||
select id
|
||||
from pm_base_special_job
|
||||
where job_name = #{specJob}
|
||||
and is_active = '1'
|
||||
limit 1
|
||||
</select>
|
||||
<select id="getEyId" resultType="com.bonus.boot.manager.manager.model.SysUser">
|
||||
SELECT
|
||||
phy_name AS username,
|
||||
telep_number AS phone
|
||||
FROM pm_base_physical
|
||||
WHERE id = #{userId};
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,6 @@
|
|||
|
||||
function login(obj) {
|
||||
$(obj).attr("disabled", true);
|
||||
debugger;
|
||||
var username = $.trim($('#username').val());
|
||||
var password = $.trim($('#password').val());
|
||||
if (username == "" || password == "") {
|
||||
|
|
|
|||
|
|
@ -144,7 +144,6 @@
|
|||
|
||||
var fileUploadPath = "";
|
||||
|
||||
debugger
|
||||
function setParam(filePath, fileNames, fileTimes, fileDownloadName){
|
||||
var suffix ="";
|
||||
if(fileNames !=null && fileNames !=undefined && fileNames !='null' && fileNames !='undefined'){
|
||||
|
|
|
|||
Loading…
Reference in New Issue