对比新文件 |
| | |
| | | package com.thhy.staff.config; |
| | | |
| | | import com.thhy.staff.modules.biz.face.controller.GetUserTask; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Timer; |
| | | |
| | | @Configuration |
| | | public class StartListener implements ApplicationRunner { |
| | | |
| | | |
| | | @Value("${file.vfprefix}") |
| | | private String vfPrefix; |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | GetUserTask gutask = new GetUserTask(vfPrefix); |
| | | Timer timer = new Timer(); |
| | | timer.schedule(gutask,1000,300000); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | @RequestMapping("/allPerson") |
| | | public JSONObject allPerson(@RequestBody String mess){ |
| | | faceServer.allPerson(mess); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("code",0); |
| | | jsonObject.put("msg","OK"); |
| | | jsonObject.put("success",true); |
| | | return jsonObject; |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.thhy.staff.modules.biz.face.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.thhy.general.utils.SpringContextUtils; |
| | | import com.thhy.staff.config.EmqxConfig; |
| | | import com.thhy.staff.modules.biz.face.mapper.FaceDeviceMapper; |
| | | import com.thhy.staff.utils.MqUtils; |
| | | import java.util.List; |
| | | import java.util.TimerTask; |
| | | |
| | | public class GetUserTask extends TimerTask { |
| | | |
| | | private String prefix; |
| | | |
| | | private FaceDeviceMapper faceDeviceMapper; |
| | | |
| | | public FaceDeviceMapper getFaceDeviceMapper() { |
| | | return SpringContextUtils.getBean(FaceDeviceMapper.class); |
| | | } |
| | | |
| | | private EmqxConfig emqxConfig; |
| | | |
| | | public EmqxConfig getEmqxConfig() { |
| | | return SpringContextUtils.getBean(EmqxConfig.class); |
| | | } |
| | | |
| | | public GetUserTask(String urlPrefix) { |
| | | this.prefix = urlPrefix; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("method","get_person_all"); |
| | | |
| | | JSONObject dataJson = new JSONObject(); |
| | | dataJson.put("path",prefix+"allPerson"); |
| | | jsonObject.put("data",dataJson); |
| | | jsonObject.put("params",new JSONObject()); |
| | | EmqxConfig emqxConfig = getEmqxConfig(); |
| | | FaceDeviceMapper faceDeviceMapper = getFaceDeviceMapper(); |
| | | List<String> sns = faceDeviceMapper.queryDevSn(); |
| | | MqUtils.createClient(emqxConfig,sns,jsonObject.toJSONString()); |
| | | } |
| | | } |
| | |
| | | void removeNotify(String mess); |
| | | |
| | | String queryOriStrById(String id); |
| | | |
| | | void allPerson(String mess); |
| | | } |
| | |
| | | import com.thhy.staff.modules.biz.face.mapper.FaceDeviceMapper; |
| | | import com.thhy.staff.modules.biz.face.service.FaceServer; |
| | | import com.thhy.staff.modules.biz.platuser.entity.DoorLis; |
| | | import com.thhy.staff.modules.biz.platuser.entity.PlatUser; |
| | | import com.thhy.staff.modules.biz.platuser.mapper.PlatUserMapper; |
| | | import com.thhy.staff.utils.MqUtils; |
| | | import org.checkerframework.checker.units.qual.A; |
| | |
| | | return userMapper.queryOriStrById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void allPerson(String mess) { |
| | | JSONObject jsonObject = JSONObject.parseObject(mess); |
| | | JSONArray jsonArray = jsonObject.getJSONArray("person_list"); |
| | | for(Object obj : jsonArray){ |
| | | JSONObject personJson = JSON.parseObject(obj.toString()); |
| | | String faceId = personJson.getString("person_id"); |
| | | int count = userMapper.countByFaceId(faceId); |
| | | if(count>0)continue; |
| | | PlatUser platUser = new PlatUser(); |
| | | platUser.setFaceId(faceId); |
| | | platUser.setIdNo(personJson.getString("id_card")); |
| | | platUser.setRealName(personJson.getString("name")); |
| | | userMapper.insertSamplePlatUser(platUser); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("method","delete_person"); |
| | |
| | | private Integer isLogin; |
| | | |
| | | private String phone; |
| | | |
| | | private String faceId; |
| | | } |
| | |
| | | void syncFail(@Param("userId") String userId,@Param("syncFailReason")String syncFailReason); |
| | | |
| | | String queryOriStrById(String id); |
| | | |
| | | int countByFaceId(String faceId); |
| | | |
| | | void insertSamplePlatUser(PlatUser platUser); |
| | | } |
| | |
| | | update sys_plat_user set sync_success = 2,sync_fail_reason = #{syncFailReason} where user_id = #{userId} |
| | | </update> |
| | | |
| | | <select id="countByFaceId" resultType="int"> |
| | | select count(user_id) from sys_plat_user where face_id = #{faceId} |
| | | </select> |
| | | |
| | | <insert id="insertSamplePlatUser"> |
| | | insert into sys_plat_user |
| | | <trim prefix="(" suffixOverrides="," suffix=")"> |
| | | <if test="userId != null and userId != ''"> |
| | | user_id, |
| | | </if> |
| | | <if test="realName != null and realName != ''"> |
| | | real_name, |
| | | </if> |
| | | <if test="faceId != null and faceId != ''"> |
| | | face_id, |
| | | </if> |
| | | <if test="idNo != null and idNo != ''"> |
| | | id_no, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffixOverrides="," suffix=")"> |
| | | <if test="userId != null and userId != ''"> |
| | | #{userId}, |
| | | </if> |
| | | <if test="realName != null and realName != ''"> |
| | | #{realName}, |
| | | </if> |
| | | <if test="faceId != null and faceId != ''"> |
| | | #{faceId}, |
| | | </if> |
| | | <if test="idNo != null and idNo != ''"> |
| | | #{idNo}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | </mapper> |
| | |
| | | package com.thhy.usercore.modules.sys.sysmenu.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.parser.JSONToken; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.thhy.general.utils.PagingUtils; |
| | | import com.thhy.general.common.BasicResult; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.Serializable; |
| | | import java.io.*; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | return BasicResult.success(sysMenusList); |
| | | } |
| | | |
| | | @RequestMapping("syncMenu") |
| | | public BasicResult syncMenu(){ |
| | | String value = ""; |
| | | try { |
| | | InputStream ins = new FileInputStream(new File("D:\\dd.txt")); |
| | | byte[] bytes = new byte[ins.available()]; |
| | | ins.read(bytes); |
| | | value = new String(bytes,"UTF-8"); |
| | | |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | List<MenuTreeVo> sysMenusList = JSONArray.parseArray(value,MenuTreeVo.class); |
| | | sysMenusService.syncMenu(sysMenusList); |
| | | return BasicResult.success(sysMenusList); |
| | | } |
| | | |
| | | @RequestMapping("allRoleMenu") |
| | | public BasicResult allRoleMenu(@RequestBody MenuDto menuDto){ |
| | | menuDto.setParentId("0"); |
| | |
| | | |
| | | void insert(SysMenus sysmenus); |
| | | |
| | | void insertVo(MenuTreeVo menuTreeVo); |
| | | |
| | | void update(SysMenus sysmenus); |
| | | |
| | | int deletelogic(Serializable menuId); |
| | |
| | | package com.thhy.usercore.modules.sys.sysmenu.service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.thhy.usercore.modules.sys.sysmenu.entity.*; |
| | | import com.thhy.usercore.modules.sys.sysmenubutton.entity.MenuButtonVo; |
| | | |
| | |
| | | |
| | | List<MenuTreeVo> findAllTree(MenuDto menuDto); |
| | | |
| | | void syncMenu(List<MenuTreeVo> sysMenusList); |
| | | |
| | | List<MenuButtonTreeVo> allRoleMenu(MenuDto menuDto); |
| | | |
| | | List<MenuButtonVo> MenuEnableButtons(MenuButtonDto menuButtonDto); |
| | |
| | | package com.thhy.usercore.modules.sys.sysmenu.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.thhy.general.utils.UserInfoUtils; |
| | | import com.thhy.general.common.BasicStatus; |
| | | import com.thhy.general.exception.BasicException; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void syncMenu(List<MenuTreeVo> sysMenusList) { |
| | | for(MenuTreeVo tree : sysMenusList){ |
| | | |
| | | sysMenusMapper.insertVo(tree); |
| | | if(tree.getChildrens().size()>0){ |
| | | |
| | | syncMenu(tree.getChildrens()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<MenuButtonTreeVo> allRoleMenu(MenuDto menuDto) { |
| | | List<MenuButtonTreeVo> sysMenusList = sysMenusMapper.menuRoleTree(menuDto); |
| | | for(MenuButtonTreeVo mv : sysMenusList){ |
| | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <insert id="insertVo"> |
| | | insert into sys_menus |
| | | <trim prefix="(" suffix=")" suffixOverrides="," > |
| | | <if test="menuId != null"> |
| | | menu_id, |
| | | </if> |
| | | <if test="isUse != null"> |
| | | is_use, |
| | | </if> |
| | | <if test="path != null"> |
| | | path, |
| | | </if> |
| | | <if test="name != null"> |
| | | name, |
| | | </if> |
| | | <if test="hidden != null"> |
| | | hidden, |
| | | </if> |
| | | <if test="redirect != null"> |
| | | redirect, |
| | | </if> |
| | | <if test="parentId != null"> |
| | | parent_id, |
| | | </if> |
| | | <if test="title != null"> |
| | | title, |
| | | </if> |
| | | <if test="icon != null"> |
| | | icon, |
| | | </if> |
| | | <if test="component != null"> |
| | | component, |
| | | </if> |
| | | <if test="level != null"> |
| | | level, |
| | | </if> |
| | | <if test="isDefault != null"> |
| | | is_default, |
| | | </if> |
| | | </trim> |
| | | |
| | | <trim prefix="values (" suffix=")" suffixOverrides="," > |
| | | <if test="menuId != null"> |
| | | #{menuId}, |
| | | </if> |
| | | <if test="isUse != null"> |
| | | #{isUse}, |
| | | </if> |
| | | <if test="path != null"> |
| | | #{path}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name}, |
| | | </if> |
| | | <if test="hidden != null"> |
| | | #{hidden}, |
| | | </if> |
| | | <if test="redirect != null"> |
| | | #{redirect}, |
| | | </if> |
| | | <if test="parentId != null"> |
| | | #{parentId}, |
| | | </if> |
| | | <if test="title != null"> |
| | | #{title}, |
| | | </if> |
| | | <if test="icon != null"> |
| | | #{icon}, |
| | | </if> |
| | | <if test="component != null"> |
| | | #{component}, |
| | | </if> |
| | | <if test="level != null"> |
| | | #{level}, |
| | | </if> |
| | | <if test="isDefault != null"> |
| | | #{isDefault}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <!--更新操作--> |
| | | <update id="update"> |
| | | update sys_menus |
| | |
| | | |
| | | @Around("pointcut()") |
| | | public Object invoke(ProceedingJoinPoint invocation) throws Throwable { |
| | | String methodName = invocation.getSignature().getName(); |
| | | /*String methodName = invocation.getSignature().getName(); |
| | | |
| | | if(methodName.contains("insert")||methodName.contains("Insert")){ |
| | | Object j = invocation.getArgs()[0]; |
| | |
| | | return invocation.proceed(); |
| | | }else{ |
| | | return invocation.proceed(); |
| | | } |
| | | }*/ |
| | | return invocation.proceed(); |
| | | } |
| | | |
| | | |