Commit e7ad33ab by duanhq

技工统计完善 by duanht 2019/2/28

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@17988 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent e3bfa12f
......@@ -309,16 +309,6 @@ public class OrderController extends BaseController {
List<MechanicBusiness> mechanicBusinessList = orderService.getMechanicBusiness(selectType, dateStart, dateEnd, userId);
//技工总数
mechanicStatistics.setMechanicCount(mechanicBusinessList.size());
//平均单量
int count = 0;
for (MechanicBusiness mechanicBusiness : mechanicBusinessList) {
count += mechanicBusiness.getCount();
}
if(mechanicBusinessList.size() == 0){
mechanicStatistics.setAvgBusiness(0);
}else{
mechanicStatistics.setAvgBusiness(count / mechanicBusinessList.size());
}
com.github.pagehelper.Page<MechanicBusiness> pages = (com.github.pagehelper.Page<MechanicBusiness>) mechanicBusinessList;
page.setTotalCount((int) pages.getTotal());
mechanicStatistics.setMechanicBusinessList(mechanicBusinessList);
......
......@@ -18,11 +18,6 @@ public class MechanicStatistics {
*/
private Integer mechanicCount;
/**
*平均单量
*/
private Integer avgBusiness;
private List<MechanicBusiness> mechanicBusinessList = new ArrayList<>();
public Integer getMechanicCount() {
......@@ -33,14 +28,6 @@ public class MechanicStatistics {
this.mechanicCount = mechanicCount;
}
public Integer getAvgBusiness() {
return avgBusiness;
}
public void setAvgBusiness(Integer avgBusiness) {
this.avgBusiness = avgBusiness;
}
public List<MechanicBusiness> getMechanicBusinessList() {
return mechanicBusinessList;
}
......
......@@ -630,22 +630,23 @@
<select id="getMechanicBusiness" resultType="com.glsx.ordercenter.dto.MechanicBusiness">
SELECT
mechanic_id mechanicId,
COUNT(mechanic_id) count
ssm.mechanic_id mechanicId,
COUNT(so.mechanic_id) count
FROM
sys_order
sys_service_mechanic ssm LEFT JOIN
sys_order so
ON ssm.mechanic_id = so.mechanic_id
WHERE
order_type = 1
AND active_status = 8
AND merchant_id = #{userId}
<if test="dateStart != null and dateEnd!=null and dateStart !='' and dateEnd !=''">
and sys_order.create_time between #{dateStart,jdbcType=TIMESTAMP} and #{dateEnd,jdbcType=TIMESTAMP}
</if>
<if test="mechanicId != null">
and mechanic_id = #{mechanicId}
and ssm.service_id = #{mechanicId}
</if>
GROUP BY
mechanic_id
so.mechanic_id
ORDER BY count desc
</select>
......
......@@ -25,7 +25,6 @@ public enum ResultCodeEnum {
USERNAME_OR_PASSWORD_NOT_RIGHT(2001, "用户名或密码错误"),
USER_DISABLE(2002, "账户被停用"),
ROLE_USE(2003,"所选角色正在被使用"),
INSTALL_PARAM_ERROR(2004, "请输入0-1000的正数"),
SMS_VERIFY_CODE_TIMEOUT(2005, "短信验证码已过期"),
SMS_VERIFY_CODE_NOT_RIGHT(2006, "短信验证码错误"),
PHONE_NUMBER_NOT_USE(2007, "该手机号码未注册"),
......
......@@ -262,7 +262,6 @@ public class UserController extends BaseController {
*/
@RequestMapping(value = "/saveSysMechanic")
@ResponseBody
@AuthCheck
public ResultObject saveSysMechanic(@RequestBody @Validated(value = {Default.class}) SysMechanic sysMechanic, BindingResult bindingResult, Integer serviceId) {
if (bindingResult.hasErrors()) {
Map<String, String> errorMap = getErrors(bindingResult);
......@@ -273,15 +272,6 @@ public class UserController extends BaseController {
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg());
}
//验证服务项安装时间
for (SysUserServices sysUserServices : sysMechanic.getUserService()) {
if (sysUserServices.getInstallTime() != null) {
if (sysUserServices.getInstallTime() < 0 || sysUserServices.getInstallTime() > 1000) {
return new ResultObject(ResultCodeEnum.INSTALL_PARAM_ERROR.getCode(), ResultCodeEnum.INSTALL_PARAM_ERROR.getMsg());
}
}
}
//通过pc注册的技工归属在当前账号下
if (serviceId == null) {
serviceId = UserUtils.getUserId(request);
......@@ -295,7 +285,6 @@ public class UserController extends BaseController {
if (!sysUserService.findByUserName(sysMechanic.getUsername()).isEmpty()) {
return new ResultObject(ResultCodeEnum.FAIL.getCode(), "技工信息已存在");
}
sysMechanic.setUserStatus(Constants.SYS_USER_STATUS_NORMAL);
sysMechanic.setPassword(sysUserService.encryptPassword(sysMechanic.getPhoneNumber()));
sysMechanic.setCreateTime(DateUtil.getCurrentTime());
sysMechanic.setCreateBy(UserUtils.getUserName(request));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!