Merge remote-tracking branch 'origin/master-prod-new' into master-prod-new
New file |
| | |
| | | package com.hx.phip.dao.mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.model.micro.MicroRecord; |
| | | |
| | | public interface MicroRecordMapper { |
| | | /**新增,返回主键*/ |
| | | int insert(MicroRecord microRecord); |
| | | /**新增,返回主键*/ |
| | | int insertById(MicroRecord microRecord); |
| | | /**查询条数*/ |
| | | int selectCount(SqlSentence sqlSentence); |
| | | /**查询条数*/ |
| | | int selectCountSql(SqlSentence sqlSentence); |
| | | /**查询列表,返回实体类的List*/ |
| | | List<MicroRecord> selectList(SqlSentence sqlSentence); |
| | | /**查询列表,返回Map的List*/ |
| | | List<Map<String,Object>> selectListMap(SqlSentence sqlSentence); |
| | | /**查询,返回单个实体*/ |
| | | MicroRecord selectOne(SqlSentence sqlSentence); |
| | | /**查询,返回单个map*/ |
| | | Map<String,Object> selectOneMap(SqlSentence sqlSentence); |
| | | /**查询,返回实体类没有大数据的*/ |
| | | MicroRecord selectOneByKey(Object object); |
| | | /**查询,返回实体类有大数据的*/ |
| | | MicroRecord selectOneByKeyBlob(Object object); |
| | | /**更新,返回更新数量*/ |
| | | int updateWhere(SqlSentence sqlSentence); |
| | | /**更新,返回更新数量*/ |
| | | int updateAll(MicroRecord microRecord); |
| | | /**删除,返回删除数量*/ |
| | | int deleteWhere(SqlSentence sqlSentence); |
| | | /**删除,返回删除数量*/ |
| | | int deleteById(Object object); |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <!-- namespace:该mapper.xml映射文件的 唯一标识 --> |
| | | <mapper namespace="com.hx.phip.dao.mapper.MicroRecordMapper"> |
| | | |
| | | <!-- 整个实体类修改,表字段=实体类字段--> |
| | | <sql id="Update_Column_All"> |
| | | <trim prefixOverrides=","> |
| | | ,userId = #{userId},userName = #{userName},CIQ = #{CIQ},userLevel = #{userLevel},userStatus = #{userStatus},userConsultantId = #{userConsultantId},userConsultantName = #{userConsultantName},userShopId = #{userShopId},userShopName = #{userShopName},platformType = #{platformType},opId = #{opId},opName = #{opName},opShopId = #{opShopId},opRoleId = #{opRoleId},opRoleStr = #{opRoleStr},visitOrderId = #{visitOrderId},isView = #{isView},isDraft = #{isDraft},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime} |
| | | </trim> |
| | | </sql> |
| | | |
| | | <!-- 后续通过 namespace.id--> |
| | | <!--parameterType:输入参数的类型 |
| | | resultType:查询返回结果值的类型 ,返回类型 --> |
| | | <insert id="insert" parameterType="com.hx.phiappt.model.micro.MicroRecord"> |
| | | <selectKey keyProperty="id" resultType="String" order="BEFORE"> |
| | | select replace(uuid(),'-','') from dual |
| | | </selectKey> |
| | | insert into micro_record (id,userId,userName,CIQ,userLevel,userStatus,userConsultantId,userConsultantName,userShopId,userShopName,platformType,opId,opName,opShopId,opRoleId,opRoleStr,visitOrderId,isView,isDraft,isDel,createTime,editTime) values (#{id},#{userId},#{userName},#{CIQ},#{userLevel},#{userStatus},#{userConsultantId},#{userConsultantName},#{userShopId},#{userShopName},#{platformType},#{opId},#{opName},#{opShopId},#{opRoleId},#{opRoleStr},#{visitOrderId},#{isView},#{isDraft},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <insert id="insertById" parameterType="com.hx.phiappt.model.micro.MicroRecord"> |
| | | insert into micro_record (id,userId,userName,CIQ,userLevel,userStatus,userConsultantId,userConsultantName,userShopId,userShopName,platformType,opId,opName,opShopId,opRoleId,opRoleStr,visitOrderId,isView,isDraft,isDel,createTime,editTime) values (#{id},#{userId},#{userName},#{CIQ},#{userLevel},#{userStatus},#{userConsultantId},#{userConsultantName},#{userShopId},#{userShopName},#{platformType},#{opId},#{opName},#{opShopId},#{opRoleId},#{opRoleStr},#{visitOrderId},#{isView},#{isDraft},#{isDel},#{createTime},#{editTime}) |
| | | </insert> |
| | | |
| | | <select id="selectList" resultType="com.hx.phiappt.model.micro.MicroRecord" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOne" resultType="com.hx.phiappt.model.micro.MicroRecord" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | select |
| | | COUNT(*) |
| | | from micro_record |
| | | WHERE ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" > |
| | | ${sqlSentence} |
| | | </select> |
| | | |
| | | <select id="selectOneByKey" resultType="com.hx.phiappt.model.micro.MicroRecord" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,userName,CIQ,userLevel,userStatus,userConsultantId,userConsultantName,userShopId,userShopName,platformType,opId,opName,opShopId,opRoleId,opRoleStr,visitOrderId,isView,isDraft,isDel,createTime,editTime |
| | | from micro_record |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.micro.MicroRecord" parameterType="java.lang.Object" > |
| | | select |
| | | id,userId,userName,CIQ,userLevel,userStatus,userConsultantId,userConsultantName,userShopId,userShopName,platformType,opId,opName,opShopId,opRoleId,opRoleStr,visitOrderId,isView,isDraft,isDel,createTime,editTime |
| | | from micro_record |
| | | WHERE id = #{value} |
| | | </select> |
| | | |
| | | <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | update |
| | | micro_record |
| | | SET ${sqlSentence} |
| | | </update> |
| | | |
| | | <update id="updateAll" parameterType="com.hx.phiappt.model.micro.MicroRecord"> |
| | | update micro_record |
| | | SET <include refid="Update_Column_All"/> |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteWhere" parameterType="com.hx.mybatisTool.SqlSentence"> |
| | | delete from micro_record WHERE ${sqlSentence} |
| | | </delete> |
| | | |
| | | <delete id="deleteById" parameterType="java.lang.Object"> |
| | | delete from micro_record WHERE id = #{value} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | values.put("userId", dto.getUserId()); |
| | | |
| | | StringBuffer sql = new StringBuffer(); |
| | | sql.append(" select id, userName, opName, createTime, editTime,isView ") |
| | | sql.append(" select id, userName, opName, createTime, editTime,isView,isDraft ") |
| | | .append(" from micro_record where isDel = 0 and userId = #{m.userId} "); |
| | | |
| | | if(StringUtils.noNull(dto.getStartTime())){ |
| | |
| | | if(StringUtils.noNull(dto.getEndTime())){ |
| | | values.put("endTime", DateUtil.dayToEnd(DateUtil.parseString_2(dto.getEndTime()))); |
| | | sql.append(" and createTime <= #{m.endTime} "); |
| | | } |
| | | |
| | | // 是否草稿 |
| | | if (dto.getIsDraft() != null){ |
| | | values.put("isDraft", dto.getIsDraft()); |
| | | sql.append(" and isDraft <= #{m.isDraft} "); |
| | | } |
| | | |
| | | sqlSentence.setSqlSentence(sql.toString()); |
| | |
| | | sqlSentence.setM(values); |
| | | values.put("microRecordId", dto.getId()); |
| | | |
| | | sqlSentence.setSqlSentence(" select id, userId, userName, createTime from micro_record where id = #{m.microRecordId} "); |
| | | sqlSentence.setSqlSentence(" select id, userId, userName, createTime,isDraft from micro_record where id = #{m.microRecordId} "); |
| | | |
| | | Map<String, Object> infoMap = commonService.selectOneMap(MicroRecordMapper.class, sqlSentence); |
| | | if(infoMap == null || infoMap.size() < 1){ |
| | |
| | | microRecord.setUserConsultantName(EmployeeTool.getCnName(microRecord.getUserConsultantId(), commonService)); |
| | | microRecord.setUserShopId(user.getShopId()); |
| | | microRecord.setUserShopName(ShopTool.getShopName(microRecord.getUserShopId(), commonService)); |
| | | |
| | | // 草稿 |
| | | if (dto.getIsDraft() != null){ |
| | | microRecord.setIsDraft(dto.getIsDraft()); |
| | | } |
| | | //新增 |
| | | mircoRecordService.add(microRecord); |
| | | |
| | |
| | | import com.hx.phiappt.dao.mapper.MicroPlanItemMapper; |
| | | import com.hx.phiappt.dao.mapper.MicroPlanMapper; |
| | | import com.hx.phiappt.dao.mapper.MicroRecordMapper; |
| | | import com.hx.phiappt.model.BaseEntity; |
| | | import com.hx.phiappt.model.micro.MicroPlan; |
| | | import com.hx.phiappt.model.micro.MicroPlanIndication; |
| | | import com.hx.phiappt.model.micro.MicroPlanItem; |
| | |
| | | //新增规划数据 |
| | | addPlanData(microRecord); |
| | | |
| | | //不是草稿就发送通知 |
| | | if (BaseEntity.NO.equals(microRecord.getIsDraft())){ |
| | | this.sentGZHNotice(microRecord); |
| | | } |
| | | } |
| | | |
| | | /** 编辑 */ |
| | | @Override |
| | | public void edit(MicroRecord microRecord) { |
| | | // 获取下之前的数据 |
| | | MicroRecord checkMicroRecord = commonDao.selectOneByKey(MicroRecordMapper.class, microRecord.getId()); |
| | | if (checkMicroRecord == null){ |
| | | throw new TipsException("更新微整规划记录信息不存在!"); |
| | | } |
| | | |
| | | // 处理数据 |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String, Object> values = new HashMap<>(); |
| | | sqlSentence.setM(values); |
| | | values.put("id", microRecord.getId()); |
| | | values.put("isDraft", microRecord.getIsDraft()); |
| | | sqlSentence.setSqlSentence(" isDraft = #{m.isDraft},editTime = now() where id = #{m.id} "); |
| | | if(commonDao.updateWhere(MicroRecordMapper.class, sqlSentence) != 1){ |
| | | throw new TipsException("更新微整规划记录信息失败!"); |
| | | } |
| | | |
| | | //删除旧的颜值规划 |
| | | delPlanData(microRecord.getId(), sqlSentence, values); |
| | | |
| | | //再重新新增 |
| | | addPlanData(microRecord); |
| | | |
| | | //之前是草稿现在不是草稿就发送通知 |
| | | if (BaseEntity.YES.equals(checkMicroRecord.getIsDraft()) && BaseEntity.NO.equals(microRecord.getIsDraft())){ |
| | | this.sentGZHNotice(microRecord); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发送公众号通知 |
| | | * @param microRecord 微整规划记录 |
| | | */ |
| | | private void sentGZHNotice(MicroRecord microRecord) { |
| | | //查询有美际记录才发送通知 |
| | | Date now = new Date(); |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | |
| | | //发送通知用户 |
| | | GzhNoticeSendTool.createSendTimeItem(commonService, GzhNoticeSendTool.SEND_TYPE_YZ_GH, microRecord.getId(), microRecord.getUserId()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** 编辑 */ |
| | | @Override |
| | | public void edit(MicroRecord microRecord) { |
| | | SqlSentence sqlSentence = new SqlSentence(); |
| | | Map<String, Object> values = new HashMap<>(); |
| | | sqlSentence.setM(values); |
| | | values.put("id", microRecord.getId()); |
| | | sqlSentence.setSqlSentence(" editTime = now() where id = #{m.id} "); |
| | | if(commonDao.updateWhere(MicroRecordMapper.class, sqlSentence) != 1){ |
| | | throw new TipsException("更新微整规划记录信息失败!"); |
| | | } |
| | | |
| | | //删除旧的颜值规划 |
| | | delPlanData(microRecord.getId(), sqlSentence, values); |
| | | |
| | | //再重新新增 |
| | | addPlanData(microRecord); |
| | | |
| | | } |
| | | |
| | | /** 删除 */ |