| | |
| | | |
| | | private List<UserAttrDto> userAttrs; |
| | | |
| | | private String bId; |
| | | |
| | | private String belongCommunityId; |
| | | |
| | | |
| | | |
| | | public String getUserId() { |
| | |
| | | public void setStaffId(String staffId) { |
| | | this.staffId = staffId; |
| | | } |
| | | |
| | | public String getbId() { |
| | | return bId; |
| | | } |
| | | |
| | | public void setbId(String bId) { |
| | | this.bId = bId; |
| | | } |
| | | |
| | | public String getBelongCommunityId() { |
| | | return belongCommunityId; |
| | | } |
| | | |
| | | public void setBelongCommunityId(String belongCommunityId) { |
| | | this.belongCommunityId = belongCommunityId; |
| | | } |
| | | } |
| | |
| | | </insert> |
| | | <!-- 删除实例客户信息 cust --> |
| | | <update id="deleteDataToCustAttr" parameterType="com.java110.entity.user.CustAttr"> |
| | | delete * from cust_attr ct where 1=1 |
| | | <if test="custId != null and custId != ''"> |
| | | and ct.custId = #{custId} |
| | | </if> |
| | | <if test="attrCd != null and attrCd != ''"> |
| | | and ct.attrCd = #{attrCd} |
| | | </if> |
| | | delete * from cust_attr ct where 1=1 |
| | | <if test="custId != null and custId != ''"> |
| | | and ct.custId = #{custId} |
| | | </if> |
| | | <if test="attrCd != null and attrCd != ''"> |
| | | and ct.attrCd = #{attrCd} |
| | | </if> |
| | | </update> |
| | | <!--根据客户ID 查询客户信息,其中包括 cust 和custAttr 数据--> |
| | | <select id="queryDataToCust" parameterType="com.java110.entity.user.Cust" resultMap="custMap"> |
| | | |
| | | select c.custId,c.name,c.email,c.cellphone,c.realName,c.sex,c.password,c.lanId,c.custAdress,c.custType,c.openId, |
| | | ca.custId,ca.attrCd,ca.value |
| | | from cust c, cust_attr ca where c.custId= ca.custId |
| | | select c.custId,c.name,c.email,c.cellphone,c.realName,c.sex,c.password,c.lanId,c.custAdress,c.custType,c.openId, |
| | | ca.custId,ca.attrCd,ca.value |
| | | from cust c, cust_attr ca where c.custId= ca.custId |
| | | <if test="custId != null and custId != ''"> |
| | | and c.custId = #{custId} |
| | | </if> |
| | | <if test="versionId != null and versionId != ''"> |
| | | and c.versionId = #{versionId} |
| | | </if> |
| | | and c.status_cd = '0' |
| | | and c.status_cd = '0' |
| | | |
| | | </select> |
| | | |
| | | <!-- 查询客户过程数据 --> |
| | | <select id="queryBoCust" parameterType="com.java110.entity.user.BoCust" resultType="com.java110.entity.user.BoCust"> |
| | | select bc.boId,bc.custId,bc.name,bc.email,bc.cellphone,bc.realName,bc.sex,bc.password,bc.lanId,bc.custAdress,bc.custType,bc.openId,bc.create_dt |
| | | select |
| | | bc.boId,bc.custId,bc.name,bc.email,bc.cellphone,bc.realName,bc.sex,bc.password,bc.lanId,bc.custAdress,bc.custType,bc.openId,bc.create_dt |
| | | from bo_cust bc where 1=1 |
| | | <if test="boId != null and boId != ''"> |
| | | and bc.boId = #{boId} |
| | |
| | | </if> |
| | | </select> |
| | | <!-- 查询客户属性过程表--> |
| | | <select id="queryBoCustAttr" parameterType="com.java110.entity.user.BoCustAttr" resultType="com.java110.entity.user.BoCustAttr"> |
| | | <select id="queryBoCustAttr" parameterType="com.java110.entity.user.BoCustAttr" |
| | | resultType="com.java110.entity.user.BoCustAttr"> |
| | | select bca.boId,bca.custId,bca.attrCd,bca.value,bca.state,bca.create_dt from bo_cust_attr bca where 1=1 |
| | | <if test="boId !=null and boId != ''"> |
| | | and bca.boId = #{boId} |
| | |
| | | </select> |
| | | |
| | | <!-- 查询客户属性信息 --> |
| | | <select id="queryDataToCustAttr" parameterType="com.java110.entity.user.CustAttr" resultType="com.java110.entity.user.CustAttr"> |
| | | <select id="queryDataToCustAttr" parameterType="com.java110.entity.user.CustAttr" |
| | | resultType="com.java110.entity.user.CustAttr"> |
| | | select * from cust_attr ca where 1=1 |
| | | <if test="custId != null and custId != ''"> |
| | | and ca.custId = #{custId} |
| | |
| | | <!-- 实例数据 --> |
| | | <insert id="saveUserInfoInstance" parameterType="map"> |
| | | insert into u_user(user_id,name,email,address,password,location_cd,age,sex,tel,level_cd,b_id,status_cd) |
| | | select bu.user_id,bu.name,bu.email,bu.address,bu.password,bu.location_cd,bu.age,bu.sex,bu.tel,bu.level_cd,bu.b_id,'0' from business_user bu where bu.operate = 'ADD' and bu.b_id=#{b_id} |
| | | select |
| | | bu.user_id,bu.name,bu.email,bu.address,bu.password,bu.location_cd,bu.age,bu.sex,bu.tel,bu.level_cd,bu.b_id,'0' |
| | | from business_user bu where bu.operate = 'ADD' and bu.b_id=#{b_id} |
| | | </insert> |
| | | |
| | | <insert id="saveUserAttrInstance" parameterType="map"> |
| | | insert into u_user_attr(attr_id,user_id,spec_cd,value,b_id,status_cd) |
| | | select bua.attr_id,bua.user_id,bua.spec_cd,bua.value,bua.b_id,'0' from business_user_attr bua where bua.operate='ADD' and bua.b_id=#{b_id} |
| | | select bua.attr_id,bua.user_id,bua.spec_cd,bua.value,bua.b_id,'0' from business_user_attr bua where |
| | | bua.operate='ADD' and bua.b_id=#{b_id} |
| | | </insert> |
| | | |
| | | <update id="updateUserInfoInstance" parameterType="map"> |
| | |
| | | </update> |
| | | |
| | | |
| | | |
| | | <!-- 查询用户信息 Business --> |
| | | <select id="queryBusinessUserInfo" parameterType="map" resultType="map"> |
| | | select u.user_id,u.name,u.email,u.address,u.password,u.location_cd, |
| | | u.age,u.sex,u.tel,u.level_cd,u.b_id,u.operate |
| | | from business_user u where 1 = 1 |
| | | <if test="operate != null and operate != ''"> |
| | | and u.operate = #{operate} |
| | | and u.operate = #{operate} |
| | | </if> |
| | | <if test="bId != null and bId !=''"> |
| | | and u.b_id = #{bId} |
| | |
| | | |
| | | <!-- 查询用户信息 --> |
| | | <select id="queryUserInfo" parameterType="map" resultType="map"> |
| | | select u.user_id, u.user_id userId,u.name,u.name userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd, |
| | | select u.user_id, u.user_id userId,u.name,u.name |
| | | userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd, |
| | | u.age,u.sex,u.tel,u.level_cd,u.b_id |
| | | from u_user u where 1= 1 |
| | | <if test="bId != null and bId !=''"> |
| | |
| | | </if> |
| | | <if test="userIds != null and userIds != null"> |
| | | and u.user_id in |
| | | <foreach collection="userIds" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | <foreach collection="userIds" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!-- 查询用户属性信息 --> |
| | |
| | | </update> |
| | | |
| | | |
| | | |
| | | <!--保存用户证件信息 add by wuxw 2018-06-29 --> |
| | | <insert id="saveBusinessUserCredentials" parameterType="map"> |
| | | insert into business_user_credentials(credentials_id,b_id,user_id,credentials_cd,value,operate) |
| | |
| | | <select id="getStaffCount" parameterType="Map" resultType="Map"> |
| | | select count(1) count |
| | | from |
| | | u_user a |
| | | ,u_org uo |
| | | ,u_org_staff_rel uosr |
| | | ,u_org puo |
| | | u_user a |
| | | ,u_org uo |
| | | ,u_org_staff_rel uosr |
| | | ,u_org puo |
| | | where a.level_cd = '01' |
| | | and a.user_id = uosr.staff_id |
| | | and a.user_id = uosr.staff_id |
| | | <if test="storeId !=null and storeId != ''"> |
| | | and uosr.store_id = #{storeId} |
| | | and uosr.org_id = uo.org_id |
| | | and uo.parent_org_id = puo.org_id |
| | | </if> |
| | | and uosr.org_id = uo.org_id |
| | | and uo.parent_org_id = puo.org_id |
| | | <if test="parentOrgId !=null and parentOrgId != ''"> |
| | | and uo.parent_org_id = #{parentOrgId} |
| | | </if> |
| | | and a.status_cd = '0' |
| | | and uo.status_cd = '0' |
| | | and uosr.status_cd = '0' |
| | | and puo.status_cd = '0' |
| | | and a.status_cd = '0' |
| | | and uo.status_cd = '0' |
| | | and uosr.status_cd = '0' |
| | | and puo.status_cd = '0' |
| | | <if test="tel !=null and tel != ''"> |
| | | and a.tel= #{tel} |
| | | </if> |
| | |
| | | <if test="orgId !=null and orgId != ''"> |
| | | and uo.org_id = #{orgId} |
| | | </if> |
| | | <if test="bId != null and bId !=''"> |
| | | and u.b_id = #{bId} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 查询员工总量 --> |
| | | <select id="getStaffs" parameterType="Map" resultType="Map"> |
| | | select uo.org_id orgId,uo.org_name,uo.org_name orgName,u.user_id, u.user_id userId,u.name,u.name userName,u.email,u.address,u.location_cd,u.location_cd locationCd, |
| | | u.age,u.sex,u.tel,u.level_cd,u.b_id,puo.org_id parentOrgId,puo.org_name parentOrgName |
| | | select uo.org_id orgId,uo.org_name,uo.org_name orgName,u.user_id, u.user_id userId,u.name,u.name |
| | | userName,u.email,u.address,u.location_cd,u.location_cd locationCd, |
| | | u.age,u.sex,u.tel,u.level_cd,u.b_id,puo.org_id parentOrgId,puo.org_name parentOrgName,puo.belong_community_id belongCommunityId, |
| | | uosr.store_id storeId |
| | | from |
| | | u_user u |
| | | ,u_org uo |
| | | ,u_org_staff_rel uosr |
| | | ,u_org puo |
| | | where u.level_cd = '01' |
| | | and u.user_id = uosr.staff_id |
| | | u_user u |
| | | ,u_org uo |
| | | ,u_org_staff_rel uosr |
| | | ,u_org puo |
| | | where u.level_cd = '01' |
| | | and u.user_id = uosr.staff_id |
| | | <if test="storeId !=null and storeId != ''"> |
| | | and uosr.store_id = #{storeId} |
| | | and uosr.org_id = uo.org_id |
| | | and uo.parent_org_id = puo.org_id |
| | | </if> |
| | | and uosr.org_id = uo.org_id |
| | | and uo.parent_org_id = puo.org_id |
| | | <if test="parentOrgId !=null and parentOrgId != ''"> |
| | | and uo.parent_org_id = #{parentOrgId} |
| | | </if> |
| | | and u.status_cd = '0' |
| | | and uo.status_cd = '0' |
| | | and uosr.status_cd = '0' |
| | | and puo.status_cd = '0' |
| | | and u.status_cd = '0' |
| | | and uo.status_cd = '0' |
| | | and uosr.status_cd = '0' |
| | | and puo.status_cd = '0' |
| | | <if test="tel !=null and tel != ''"> |
| | | and u.tel= #{tel} |
| | | </if> |
| | |
| | | <if test="orgId !=null and orgId != ''"> |
| | | and uo.org_id = #{orgId} |
| | | </if> |
| | | <if test="bId != null and bId !=''"> |
| | | and u.b_id = #{bId} |
| | | </if> |
| | | order by u.create_time desc |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | |
| | | |
| | | <!-- 查询用户 --> |
| | | <select id="getUsers" parameterType="Map" resultType="Map"> |
| | | select u.user_id, u.user_id userId,u.name,u.name userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd, |
| | | select u.user_id, u.user_id userId,u.name,u.name |
| | | userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd, |
| | | u.age,u.sex,u.tel,u.level_cd,u.b_id |
| | | from u_user u |
| | | <if test="openId != null and openId !=''"> |
| | |
| | | |
| | | <!-- 查询用户密码 --> |
| | | <select id="getUserHasPwd" parameterType="Map" resultType="Map"> |
| | | select u.user_id, u.user_id userId,u.name,u.name userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd, |
| | | select u.user_id, u.user_id userId,u.name,u.name |
| | | userName,u.email,u.address,u.password,u.location_cd,u.location_cd locationCd, |
| | | u.age,u.sex,u.tel,u.level_cd levelCd,u.b_id,u.password |
| | | from u_user u |
| | | <if test="openId != null and openId !=''"> |
| New file |
| | |
| | | package com.java110.job.task.staffToMachine; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.smo.common.IMachineInnerServiceSMO; |
| | | import com.java110.core.smo.common.IMachineTranslateInnerServiceSMO; |
| | | import com.java110.core.smo.community.ICommunityInnerServiceSMO; |
| | | import com.java110.core.smo.community.IRoomInnerServiceSMO; |
| | | import com.java110.core.smo.order.IOrderInnerServiceSMO; |
| | | import com.java110.core.smo.user.IOrgCommunityInnerServiceSMO; |
| | | import com.java110.core.smo.user.IUserInnerServiceSMO; |
| | | import com.java110.dto.CommunityMemberDto; |
| | | import com.java110.dto.machine.MachineDto; |
| | | import com.java110.dto.machine.MachineTranslateDto; |
| | | import com.java110.dto.order.OrderDto; |
| | | import com.java110.dto.org.OrgCommunityDto; |
| | | import com.java110.dto.task.TaskDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.job.quartz.TaskSystemQuartz; |
| | | import com.java110.utils.util.DateUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @ClassName TransalateOwnerPhotoToMachine |
| | | * @Description TODO 传输员工图片到门禁 任务 |
| | | * @Author wuxw |
| | | * @Date 2020/6/3 20:59 |
| | | * @Version 1.0 |
| | | * add by wuxw 2020/6/3 |
| | | **/ |
| | | @Component |
| | | public class TranslateStaffPhotoToMachineTemplate extends TaskSystemQuartz { |
| | | |
| | | private static Logger logger = LoggerFactory.getLogger(TranslateStaffPhotoToMachineTemplate.class); |
| | | |
| | | @Autowired |
| | | private IOrderInnerServiceSMO orderInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IRoomInnerServiceSMO roomInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IMachineInnerServiceSMO machineInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IMachineTranslateInnerServiceSMO machineTranslateInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOrgCommunityInnerServiceSMO orgCommunityInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | | protected void process(TaskDto taskDto) throws Exception { |
| | | |
| | | logger.debug("任务在执行" + taskDto.toString()); |
| | | |
| | | OrderDto orderDto = new OrderDto(); |
| | | String[] businessTypeCds = new String[]{"100100030001", |
| | | "100100040001"}; |
| | | orderDto.setBusinessTypeCds(businessTypeCds); |
| | | List<OrderDto> orderDtos = orderInnerServiceSMOImpl.queryOrderByBusinessType(orderDto); |
| | | |
| | | for (OrderDto tmpOrderDto : orderDtos) { |
| | | try { |
| | | logger.debug("开始处理订单" + JSONObject.toJSONString(tmpOrderDto)); |
| | | |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setbId(tmpOrderDto.getbId()); |
| | | List<UserDto> userDtos = userInnerServiceSMOImpl.getStaffs(userDto); |
| | | |
| | | if (userDtos == null || userDtos.size() < 1) { |
| | | orderInnerServiceSMOImpl.updateBusinessStatusCd(tmpOrderDto); |
| | | logger.debug("没有数据数据直接刷为C1" + JSONObject.toJSONString(tmpOrderDto)); |
| | | continue; |
| | | } |
| | | dealData(tmpOrderDto, userDtos.get(0)); |
| | | //刷新 状态为C1 |
| | | orderInnerServiceSMOImpl.updateBusinessStatusCd(tmpOrderDto); |
| | | logger.debug("处理订单结束" + JSONObject.toJSONString(tmpOrderDto)); |
| | | |
| | | } catch (Exception e) { |
| | | logger.error("执行订单任务失败", e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 将员工数据同步给所有该小区设备 |
| | | * |
| | | * @param tmpOrderDto |
| | | * @param userDto |
| | | */ |
| | | private void dealData(OrderDto tmpOrderDto, UserDto userDto) { |
| | | |
| | | List<String> communityIds = new ArrayList<>(); |
| | | |
| | | if ("9999".equals(userDto.getBelongCommunityId())) { |
| | | CommunityMemberDto communityMemberDto = new CommunityMemberDto(); |
| | | communityMemberDto.setMemberId(userDto.getStoreId()); |
| | | communityMemberDto.setAuditStatusCd("1100");//审核通过的 |
| | | List<CommunityMemberDto> communityMemberDtos = communityInnerServiceSMOImpl.getCommunityMembers(communityMemberDto); |
| | | |
| | | if (communityMemberDtos == null || communityMemberDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | for (CommunityMemberDto tmpCommunityMemberDto : communityMemberDtos) { |
| | | communityIds.add(tmpCommunityMemberDto.getCommunityId()); |
| | | } |
| | | } else { |
| | | OrgCommunityDto orgCommunityDto = new OrgCommunityDto(); |
| | | orgCommunityDto.setOrgId(userDto.getParentOrgId()); |
| | | orgCommunityDto.setStoreId(userDto.getStoreId()); |
| | | List<OrgCommunityDto> orgCommunityDtos = orgCommunityInnerServiceSMOImpl.queryOrgCommunitys(orgCommunityDto); |
| | | |
| | | if (orgCommunityDtos == null || orgCommunityDtos.size() < 1) { |
| | | return; |
| | | } |
| | | |
| | | for (OrgCommunityDto tmpOrgCommunityDto : orgCommunityDtos) { |
| | | communityIds.add(tmpOrgCommunityDto.getCommunityId()); |
| | | } |
| | | } |
| | | |
| | | for (String communityId : communityIds) { |
| | | //根据小区ID查询现有设备 |
| | | MachineDto machineDto = new MachineDto(); |
| | | machineDto.setCommunityId(communityId); |
| | | List<MachineDto> machineDtos = machineInnerServiceSMOImpl.queryMachines(machineDto); |
| | | |
| | | |
| | | for (MachineDto tmpMachineDto : machineDtos) { |
| | | if (!"9997".equals(tmpMachineDto.getMachineTypeCd())) { |
| | | continue; |
| | | } |
| | | saveMachineTranslate(tmpOrderDto, tmpMachineDto, userDto); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | private void saveMachineTranslate(OrderDto tmpOrderDto, MachineDto tmpMachineDto, UserDto userDto) { |
| | | // MachineTranslateDto machineTranslateDto = new MachineTranslateDto(); |
| | | |
| | | |
| | | // machineTranslateDto.setMachineId(tmpMachineDto.getMachineId()); |
| | | // machineTranslateDto.setObjId(userDto.getUserId()); |
| | | // machineTranslateDto.setStatusCd("0"); |
| | | // |
| | | // int count = machineTranslateInnerServiceSMOImpl.queryMachineTranslatesCount(machineTranslateDto); |
| | | // if (count > 0) { |
| | | // updateMachineTranslate(tmpMachineDto, userDto); |
| | | // return; |
| | | // } |
| | | // Map info = new HashMap(); |
| | | //machine_id,machine_code,status_cd,type_cd,machine_translate_id,obj_id,obj_name,state,community_id,b_id |
| | | MachineTranslateDto tmpMachineTranslateDto = new MachineTranslateDto(); |
| | | tmpMachineTranslateDto.setMachineTranslateId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_machineTranslateId)); |
| | | tmpMachineTranslateDto.setMachineId(tmpMachineDto.getMachineId()); |
| | | tmpMachineTranslateDto.setMachineCode(tmpMachineDto.getMachineCode()); |
| | | tmpMachineTranslateDto.setTypeCd("5566"); //访客人脸 |
| | | tmpMachineTranslateDto.setObjId(userDto.getUserId()); |
| | | tmpMachineTranslateDto.setObjName(userDto.getName()); |
| | | tmpMachineTranslateDto.setState("10000"); |
| | | tmpMachineTranslateDto.setCommunityId(tmpMachineDto.getCommunityId()); |
| | | tmpMachineTranslateDto.setbId("-1"); |
| | | tmpMachineTranslateDto.setObjBId(tmpOrderDto.getbId()); |
| | | machineTranslateInnerServiceSMOImpl.saveMachineTranslate(tmpMachineTranslateDto); |
| | | |
| | | } |
| | | |
| | | private void updateMachineTranslate(MachineDto tmpMachineDto, UserDto userDto) { |
| | | MachineTranslateDto machineTranslateDto = new MachineTranslateDto(); |
| | | machineTranslateDto.setMachineId(tmpMachineDto.getMachineId()); |
| | | machineTranslateDto.setObjId(userDto.getUserId()); |
| | | machineTranslateDto.setState("10000"); |
| | | machineTranslateDto.setCommunityId(tmpMachineDto.getCommunityId()); |
| | | machineTranslateDto.setUpdateTime(DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | machineTranslateInnerServiceSMOImpl.updateMachineTranslateState(machineTranslateDto); |
| | | |
| | | } |
| | | } |