Commit 27ef8224 by duanhq

完善服务类占比 by duanht 2019/2/23

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@17675 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 7b11f0d6
package com.glsx.ordercenter.mapper;
import com.glsx.ordercenter.pojo.DictionaryData;
import java.util.List;
/**
*
* @Title DictionaryDataMapper.java
* @Package com.glsx.manager.mapper
* @Description TODO 字典数据mapper
* @author zhanghj
* @date 2019年1月22日 下午5:48:21
* @version 1.0.0
*/
public interface DictionaryDataMapper {
/**
*
* @author zhanghj
* @Title: save
* @Description: TODO 保存字典数据
* @param dictionaryData
* @return
* int
*
*/
int save(DictionaryData dictionaryData);
/**
*
* @author zhanghj
* @Title: update
* @Description: TODO 更新字典数据
* @param dictionaryData
* @return
* int
*
*/
int update(DictionaryData dictionaryData);
/**
*
* @author zhanghj
* @Title: delete
* @Description: TODO 删除字典数据
* @param dictionaryData
* @return
* int
*
*/
int delete(DictionaryData dictionaryData);
/**
*
* @author zhanghj
* @Title: get
* @Description: TODO 通过id获取字典数据
* @param dictionaryData
* @return
* DictionaryData
*
*/
DictionaryData get(DictionaryData dictionaryData);
/**
*
* @author zhanghj
* @Title: list
* @Description: TODO 获取字典数据列表
* @param dictionaryData
* @return
* List<DictionaryData>
*
*/
List<DictionaryData> list(DictionaryData dictionaryData);
/**
*
* @author zhanghj
* @Title: deleteByDictType 通过字典类型删除字典数据
* @Description: TODO
* @param dictionaryData
* @return
* int
*
*/
int deleteByDictType(DictionaryData dictionaryData);
/**
*
* @author duanht
* @Title: deleteByDictType 根据字典键值获取值
* @Description: TODO
* @param installDeviceType
* @return
* int
*
*/
String getDictValueByKey(String installDeviceType);
}
package com.glsx.ordercenter.pojo;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
/**
*
* @Title DictionaryData.java
* @Package com.glsx.manager.pojo.dictionary
* @Description TODO
* @author zhanghj
* @date 2019年1月22日 下午5:34:49
* @version 1.0.0
*/
public class DictionaryData extends BaseModel{
/**
* 主键id
*/
@NotNull(message="{param.not.null}", groups={GroupA.class})
private Integer id;
/**
* 字典类型
*/
@NotBlank(message="{param.not.null}", groups={Default.class, GroupA.class})
private String dictType;
/**
* 字典标签
*/
@NotBlank(message="{param.not.null}", groups={Default.class, GroupA.class})
private String dataValue;
/**
* 字典键值
*/
@NotBlank(message="{param.not.null}", groups={Default.class, GroupA.class})
private String dataKey;
/**
* 状态:1:启用,2:停用,3:删除
*/
@NotNull(message="{param.not.null}", groups={Default.class, GroupA.class})
private Integer dataStatus;
/**
* 顺序
*/
@NotNull(message="{param.not.null}", groups={Default.class, GroupA.class})
private Integer sort;
/**
* 字典名称
*/
private String name;
/**
* 查询:开始时间
*/
private String beginDate;
/**
* 查询:结束时间
*/
private String endDate;
public String getDictType() {
return dictType;
}
public void setDictType(String dictType) {
this.dictType = dictType == null ? null : dictType.trim();
}
public String getDataValue() {
return dataValue;
}
public void setDataValue(String dataValue) {
this.dataValue = dataValue == null ? null : dataValue.trim();
}
public String getDataKey() {
return dataKey;
}
public void setDataKey(String dataKey) {
this.dataKey = dataKey == null ? null : dataKey.trim();
}
public Integer getDataStatus() {
return dataStatus;
}
public void setDataStatus(Integer dataStatus) {
this.dataStatus = dataStatus;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBeginDate() {
return beginDate;
}
public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.ordercenter.pojo;
/**
*
* @Title GroupA.java
* @Package com.glsx.manager.pojo
* @Description TODO Hibernate-validator的分组
* @author zhanghj
* @date 2019年1月3日 下午7:46:57
* @version 1.0.0
*/
public interface GroupA {
}
...@@ -34,6 +34,7 @@ import java.util.Map; ...@@ -34,6 +34,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.glsx.ordercenter.mapper.*;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -64,12 +65,6 @@ import com.glsx.ordercenter.dto.ServiceItemScale; ...@@ -64,12 +65,6 @@ import com.glsx.ordercenter.dto.ServiceItemScale;
import com.glsx.ordercenter.dto.ShopBizAmount; import com.glsx.ordercenter.dto.ShopBizAmount;
import com.glsx.ordercenter.dto.SubOrders; import com.glsx.ordercenter.dto.SubOrders;
import com.glsx.ordercenter.dto.UnfinishedOrders; import com.glsx.ordercenter.dto.UnfinishedOrders;
import com.glsx.ordercenter.mapper.SysMechanicMapper;
import com.glsx.ordercenter.mapper.SysMerchantMapper;
import com.glsx.ordercenter.mapper.SysOrderMapper;
import com.glsx.ordercenter.mapper.SysOrderRepairMapper;
import com.glsx.ordercenter.mapper.SysOrderStatusMapper;
import com.glsx.ordercenter.mapper.SysUserMapper;
import com.glsx.ordercenter.pojo.SysOrder; import com.glsx.ordercenter.pojo.SysOrder;
import com.glsx.ordercenter.pojo.SysOrderExample; import com.glsx.ordercenter.pojo.SysOrderExample;
import com.glsx.ordercenter.pojo.SysOrderExample.Criteria; import com.glsx.ordercenter.pojo.SysOrderExample.Criteria;
...@@ -118,6 +113,9 @@ public class OrderServiceImpl implements IOrderService { ...@@ -118,6 +113,9 @@ public class OrderServiceImpl implements IOrderService {
@Autowired @Autowired
private UserClient userClient; private UserClient userClient;
@Autowired
private DictionaryDataMapper dictionaryDataMapper;
/** /**
* *
*/ */
...@@ -1268,6 +1266,8 @@ public class OrderServiceImpl implements IOrderService { ...@@ -1268,6 +1266,8 @@ public class OrderServiceImpl implements IOrderService {
float num = (float) (serviceItemInfo.getCount()) / (amount) * 100; float num = (float) (serviceItemInfo.getCount()) / (amount) * 100;
DecimalFormat df = new DecimalFormat("0.0"); DecimalFormat df = new DecimalFormat("0.0");
serviceItemInfo.setScale(df.format(num)); serviceItemInfo.setScale(df.format(num));
//根据服务项key获取值
serviceItemInfo.setInstallDeviceType( dictionaryDataMapper.getDictValueByKey(serviceItemInfo.getInstallDeviceType() ) );
} }
serviceItemScale.setAmount(amount); serviceItemScale.setAmount(amount);
serviceItemScale.setServiceItemInfoList(serviceItemInfoList); serviceItemScale.setServiceItemInfoList(serviceItemInfoList);
......
<?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">
<mapper namespace="com.glsx.ordercenter.mapper.DictionaryDataMapper">
<resultMap id="baseResultMap" type="com.glsx.ordercenter.pojo.DictionaryData">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="dict_type" jdbcType="VARCHAR" property="dictType" />
<result column="data_value" jdbcType="VARCHAR" property="dataValue" />
<result column="data_key" jdbcType="VARCHAR" property="dataKey" />
<result column="data_status" jdbcType="INTEGER" property="dataStatus" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="base_Column">
id, dict_type, data_value, data_key, data_status, sort, remark, create_by, create_time, update_by, update_time
</sql>
<select id="get" parameterType="java.lang.Integer" resultMap="baseResultMap">
select
<include refid="base_Column" />
from sys_dict_data
<where>
<if test="id != null">
id = #{id,jdbcType=INTEGER}
</if>
<if test="dataKey !=null and dataKey != ''">
and data_key = #{dataKey}
</if>
<if test="dictType != null and dictType != ''">
and dict_type = #{dictType}
</if>
</where>
</select>
<select id="list" parameterType="com.glsx.ordercenter.pojo.DictionaryData" resultMap="baseResultMap">
<if test="dataValue != null and dataValue != ''">
<bind name="pattern" value="'%' + dataValue + '%'" />
</if>
select
sdd.id, sdd.dict_type, sdd.data_value, sdd.data_key, sdd.data_status,
sdd.sort, sdd.remark, sdd.create_by, sdd.create_time, sdd.update_by,
sdd.update_time
from sys_dict_data sdd
left join sys_dict_type sdt on sdd.dict_type = sdt.dict_type
<where>
sdd.data_status != 3
<if test="name != null">
and sdt.name = #{name}
</if>
<if test="dictType != null">
and sdd.dict_type = #{dictType}
</if>
<if test="dataValue != null and dataValue != ''">
and sdd.data_value like #{pattern}
</if>
<if test="dataStatus != null">
and sdd.data_status = #{dataStatus}
</if>
<if test="beginDate != null and beginDate!= ''">
and DATE_FORMAT(sdd.create_time, '%Y-%m-%d') &gt;= #{beginDate}
</if>
<if test="endDate != null and endDate != ''">
and DATE_FORMAT(sdd.create_time, '%Y-%m-%d') &lt;= #{endDate}
</if>
order by sdd.sort asc, sdd.create_time asc
</where>
</select>
<insert id="save" parameterType="com.glsx.ordercenter.pojo.DictionaryData" useGeneratedKeys="true">
insert into sys_dict_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictType != null">
dict_type,
</if>
<if test="dataValue != null and dataValue != ''">
data_value,
</if>
<if test="dataKey != null and dataKey != ''">
data_key,
</if>
<if test="dataStatus != null">
data_status,
</if>
<if test="sort != null">
sort,
</if>
<if test="remark != null">
remark,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictType != null and dictType != ''">
#{dictType},
</if>
<if test="dataValue != null and dataValue!= ''">
#{dataValue},
</if>
<if test="dataKey != null and dataKey != ''">
#{dataKey},
</if>
<if test="dataStatus != null">
#{dataStatus},
</if>
<if test="sort != null">
#{sort},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="update" parameterType="com.glsx.ordercenter.pojo.DictionaryData">
update sys_dict_data
set
data_value = #{dataValue,jdbcType=VARCHAR},
data_status = #{dataStatus,jdbcType=TINYINT},
sort = #{sort},
remark = #{remark,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="delete" parameterType="com.glsx.ordercenter.pojo.DictionaryData">
update sys_dict_data
set data_status = 3,
update_by = #{updateBy},
update_time = #{updateTime}
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByDictType" parameterType="com.glsx.ordercenter.pojo.DictionaryData">
update sys_dict_data
set data_status = 3,
update_by = #{updateBy},
update_time = #{updateTime}
where dict_type = #{dictType}
</delete>
<select id="getDictValueByKey" parameterType="java.lang.String"
resultType="java.lang.String">
SELECT
data_value
FROM sys_dict_data
WHERE data_key = #{dataKey,jdbcType=VARCHAR}
AND data_status = 1
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!