apk调试

This commit is contained in:
jjLv 2024-09-29 15:48:58 +08:00
parent 732c3531ba
commit 42eef81b7f
6 changed files with 276 additions and 75 deletions

View File

@ -1,21 +1,34 @@
package com.bonus.boot.manager.basic.controller; 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.dao.PersonnelLibraryDao;
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean; import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
import com.bonus.boot.manager.basic.entity.ZNode; import com.bonus.boot.manager.basic.entity.ZNode;
import com.bonus.boot.manager.basic.service.PersonnelLibraryService; import com.bonus.boot.manager.basic.service.PersonnelLibraryService;
import com.bonus.boot.manager.manager.annotation.LogAnnotation; 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.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.AjaxRes;
import com.bonus.boot.manager.manager.utils.GlobalConst; import com.bonus.boot.manager.manager.utils.GlobalConst;
import com.bonus.boot.manager.task.UnifyTask;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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 * 包名称com.bonus.boot.manager.basic.controller
* 类名称PersonnelLibraryController * 类名称PersonnelLibraryController
@ -31,9 +44,13 @@ public class PersonnelLibraryController {
@Resource @Resource
private PersonnelLibraryService service; private PersonnelLibraryService service;
@Autowired
private UserService userService;
@Resource @Resource
private PersonnelLibraryDao daoDao; private PersonnelLibraryDao daoDao;
@LogAnnotation @LogAnnotation
@PostMapping("getMsgContent") @PostMapping("getMsgContent")
@ApiOperation(value = "体检人员库-列表") @ApiOperation(value = "体检人员库-列表")
@ -45,7 +62,7 @@ public class PersonnelLibraryController {
@RequestMapping(value = "addInfo", method = RequestMethod.POST) @RequestMapping(value = "addInfo", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "体检人员库-新增") @ApiOperation(value = "体检人员库-新增")
public AjaxRes addInfo(@RequestBody PersonnelLibraryBean bean) { public AjaxRes addInfo(@RequestBody PersonnelLibraryBean bean) throws Exception {
AjaxRes ar = new AjaxRes(); AjaxRes ar = new AjaxRes();
int cb = service.addInfo(bean); int cb = service.addInfo(bean);
ar.setFailMsg(GlobalConst.DATA_FAIL); ar.setFailMsg(GlobalConst.DATA_FAIL);
@ -63,6 +80,33 @@ public class PersonnelLibraryController {
if (cb == 6) { if (cb == 6) {
ar.setFailMsg("姓名已存在"); 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; return ar;
} }
@ -70,7 +114,7 @@ public class PersonnelLibraryController {
@RequestMapping(value = "updateInfo", method = RequestMethod.POST) @RequestMapping(value = "updateInfo", method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "体检人员库-修改") @ApiOperation(value = "体检人员库-修改")
public AjaxRes updateInfo(@RequestBody PersonnelLibraryBean bean) { public AjaxRes updateInfo(@RequestBody PersonnelLibraryBean bean) throws Exception {
AjaxRes ar = new AjaxRes(); AjaxRes ar = new AjaxRes();
int cb = service.updateInfo(bean); int cb = service.updateInfo(bean);
ar.setFailMsg(GlobalConst.DATA_FAIL); ar.setFailMsg(GlobalConst.DATA_FAIL);
@ -83,6 +127,33 @@ public class PersonnelLibraryController {
ar.setFailMsg("手机号已存在"); 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; return ar;
} }
@ -106,15 +177,39 @@ public class PersonnelLibraryController {
@PostMapping("delById") @PostMapping("delById")
@ApiOperation(value = "体检人员库-删除") @ApiOperation(value = "体检人员库-删除")
public AjaxRes delById(PersonnelLibraryBean bean) { public AjaxRes delById(PersonnelLibraryBean bean) {
AjaxRes ar = new AjaxRes(); AjaxRes ar = new AjaxRes();
int result = service.delById(bean); try {
if (result == 1) { Long userId = Long.valueOf(bean.getId());
ar.setSucceedMsg(GlobalConst.DATA_SUCCEED); SysUser userDto = daoDao.getEyId(userId);
} else {
ar.setFailMsg(GlobalConst.DATA_FAIL); // 尝试删除操作
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++;
} }
return ar; // 如果尝试了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);
}
}
} catch (Exception e) {
// 异常处理
ar.setFailMsg("Delete operation failed due to an internal error.");
} }
return ar;
}
@LogAnnotation @LogAnnotation
@PostMapping("resetPassword") @PostMapping("resetPassword")
@ -144,4 +239,80 @@ public class PersonnelLibraryController {
return ar; 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;
}
} }

View File

@ -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.PersonnelLibraryBean;
import com.bonus.boot.manager.basic.entity.ZNode; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -39,4 +40,6 @@ public interface PersonnelLibraryDao {
int AddInf(PersonnelLibraryBean bean); int AddInf(PersonnelLibraryBean bean);
int updatete(PersonnelLibraryBean bean); int updatete(PersonnelLibraryBean bean);
SysUser getEyId(Long userId);
} }

View File

@ -99,7 +99,7 @@ public class EmployeeHealthCheckController {
System.out.println(imageFiles); System.out.println(imageFiles);
dao.updatePDFAddress(nameList.get(i).split("-")[1],imageFiles); dao.updatePDFAddress(nameList.get(i).split("-")[1],imageFiles);
// String linkPath = "http://112.31.106.186:1616/yntj/";//正式环境 // 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 phone = dao.getPersonPhoneNumber(nameList.get(i).split("-")[1]);
String msg = nameList.get(i).split("-")[0]+"您的体检结果已生成,请点击查看"+linkPath; String msg = nameList.get(i).split("-")[0]+"您的体检结果已生成,请点击查看"+linkPath;
SendPhoneMessageUtil.SendPhoneMsg(phone,msg); SendPhoneMessageUtil.SendPhoneMsg(phone,msg);

View File

@ -4,12 +4,14 @@
<insert id="addInfo" keyProperty="hospId" useGeneratedKeys="true"> <insert id="addInfo" keyProperty="hospId" useGeneratedKeys="true">
<!-- 插入到pm_base_physical表 --> <!-- 插入到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) insert into
values (#{personName},#{idNumber},#{age},#{departmentId},#{sex},#{higherJob},#{phone},#{personType},#{specialPost},#{password},'1','1',#{hospital},#{setMeal},#{personnelType}) 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>
<insert id="addresult"> <insert id="addresult">
insert into pm_physical_result(physical_id) values (#{id}) insert into pm_physical_result(physical_id)
values (#{id})
</insert> </insert>
<insert id="AddInf"> <insert id="AddInf">
<!-- 判断特定条件是否满足然后再插入记录到pm_occupation_phy_result表 --> <!-- 判断特定条件是否满足然后再插入记录到pm_occupation_phy_result表 -->
@ -17,38 +19,52 @@
VALUES (#{hospId},#{personName}, #{departmentId}, #{sex}, #{idNumber}, #{phone}, #{specialPost}) VALUES (#{hospId},#{personName}, #{departmentId}, #{sex}, #{idNumber}, #{phone}, #{specialPost})
</insert> </insert>
<update id="updateInfo"> <update id="updateInfo">
update pm_base_physical set update pm_base_physical
depart_id = #{departmentId}, set depart_id = #{departmentId},
if_higher =#{higherJob}, if_higher =#{higherJob},
if_job = #{personType}, if_job = #{personType},
special_job = #{specialPost}, special_job = #{specialPost},
nosocomium = #{hospital}, nosocomium = #{hospital},
personnel_type = #{personnelType}, personnel_type = #{personnelType},
set_meal = #{setMeal} set_meal = #{setMeal}
where id = #{id} and is_active='1' where id = #{id}
and is_active = '1'
</update> </update>
<update id="resetPassword"> <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>
<update id="delById"> <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>
<update id="updatePersonExport" > <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) insert into pm_base_physical(phy_name, idcard, depart_id, sex, telep_number, phy_password, if_job, age,
values (#{personName},#{idNumber},#{department},#{sex},#{phone},#{password},#{personType},#{age},#{specialPost},'1') special_job, is_active)
values (#{personName}, #{idNumber}, #{department}, #{sex}, #{phone}, #{password}, #{personType}, #{age},
#{specialPost}, '1')
</update> </update>
<update id="updatephyInfo"> <update id="updatephyInfo">
update pm_base_physical set update pm_base_physical
phy_name=#{personName},idcard=#{idNumber},depart_id=#{department},telep_number=#{phone}, set phy_name=#{personName},
if_job=#{personType},age=#{age},special_job=#{specialPost} idcard=#{idNumber},
where telep_number=#{phone} and is_active='1' depart_id=#{department},
telep_number=#{phone},
if_job=#{personType},
age=#{age},
special_job=#{specialPost}
where telep_number = #{phone}
and is_active = '1'
</update> </update>
<update id="updatete"> <update id="updatete">
update pm_occupation_phy_result set update pm_occupation_phy_result
depart = #{departmentId}, set depart = #{departmentId},
special_job = #{specialPost} special_job = #{specialPost}
where phy_id = #{id} and is_active='1' where phy_id = #{id}
and is_active = '1'
</update> </update>
<select id="getList" resultType="com.bonus.boot.manager.basic.entity.PersonnelLibraryBean"> <select id="getList" resultType="com.bonus.boot.manager.basic.entity.PersonnelLibraryBean">
@ -71,13 +87,13 @@
else '' else ''
end as personnelType, end as personnelType,
case pbp.set_meal case pbp.set_meal
when '1' then '心血管' when '1' then '心血管'
when '2' then '肿瘤' when '2' then '肿瘤'
when '3' then '综合' when '3' then '综合'
else '' else ''
end as setMeal end as setMeal
from pm_base_physical pbp from pm_base_physical pbp
left join pm_base_hospital pbh on pbh.id = pbp.nosocomium left join pm_base_hospital pbh on pbh.id = pbp.nosocomium
left join sys_dic_detail sdd on sdd.id = pbp.if_job left join sys_dic_detail sdd on sdd.id = pbp.if_job
left join pm_base_special_job pbsj on pbsj.id = pbp.special_job and pbsj.is_active = '1' 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 left join pm_phy_organization po on po.id = pbp.depart_id
@ -93,48 +109,61 @@
</if> </if>
</select> </select>
<select id="getListById" resultType="com.bonus.boot.manager.basic.entity.PersonnelLibraryBean"> <select id="getListById" resultType="com.bonus.boot.manager.basic.entity.PersonnelLibraryBean">
select select pbp.id,
pbp.id, pbp.phy_name as personName,
pbp.phy_name as personName, pbp.idcard as idNumber,
pbp.idcard as idNumber, pbp.age,
pbp.age, pbp.sex,
pbp.sex, pbp.telep_number as phone,
pbp.telep_number as phone, pbp.depart_id as departmentId,
pbp.depart_id as departmentId, po.NAME as department,
po.NAME as department, pbp.if_higher as higherJob,
pbp.if_higher as higherJob, pbp.if_job as jobType,
pbp.if_job as jobType, pbp.special_job as specialPost,
pbp.special_job as specialPost, pbsj.job_name as specialPostName,
pbsj.job_name as specialPostName, pbp.nosocomium as hospital,
pbp.nosocomium as hospital, pbp.personnel_type as personnelType,
pbp.personnel_type as personnelType, pbp.set_meal as setMeal
pbp.set_meal as setMeal
from pm_base_physical pbp 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_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 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>
<select id="getDepartmentTree" resultType="com.bonus.boot.manager.basic.entity.ZNode"> <select id="getDepartmentTree" resultType="com.bonus.boot.manager.basic.entity.ZNode">
SELECT SELECT ID,
ID, `NAME`,
`NAME`, PARENT_ID as pId,
PARENT_ID as pId, 0 as type
0 as type FROM pm_organization
FROM WHERE IS_ACTIVE = '1'
pm_organization
WHERE
IS_ACTIVE = '1'
</select> </select>
<select id="getinfoByidcard" resultType="java.lang.Integer"> <select id="getinfoByidcard" resultType="java.lang.Integer">
SELECT count(1) from pm_base_physical where SELECT count(1)
is_active='1' from pm_base_physical
and telep_number=#{phone} where is_active = '1'
and telep_number = #{phone}
</select> </select>
<select id="getdepartmentName" resultType="java.lang.String"> <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>
<select id="getspecJobName" resultType="java.lang.String"> <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> </select>
</mapper> </mapper>

View File

@ -129,7 +129,6 @@
function login(obj) { function login(obj) {
$(obj).attr("disabled", true); $(obj).attr("disabled", true);
debugger;
var username = $.trim($('#username').val()); var username = $.trim($('#username').val());
var password = $.trim($('#password').val()); var password = $.trim($('#password').val());
if (username == "" || password == "") { if (username == "" || password == "") {

View File

@ -144,7 +144,6 @@
var fileUploadPath = ""; var fileUploadPath = "";
debugger
function setParam(filePath, fileNames, fileTimes, fileDownloadName){ function setParam(filePath, fileNames, fileTimes, fileDownloadName){
var suffix =""; var suffix ="";
if(fileNames !=null && fileNames !=undefined && fileNames !='null' && fileNames !='undefined'){ if(fileNames !=null && fileNames !=undefined && fileNames !='null' && fileNames !='undefined'){