沈斌
2018-05-08 b9baa2c78a067e9e67c7c824a28c8fd36682ecc8
test
3 files modified
47 ■■■■ changed files
src/main/java/com/moral/config/MvcConfiguration.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/controller/MobileController.java 18 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/mapper/ProfessionMapper.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/config/MvcConfiguration.java
@@ -1,10 +1,14 @@
package com.moral.config;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import com.moral.common.convert.StringToDateConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.bind.support.ConfigurableWebBindingInitializer;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.*;
@@ -12,6 +16,8 @@
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
@Configuration
@EnableWebMvc
@@ -42,6 +48,25 @@
                    .getConversionService();
            genericConversionService.addConverter(new StringToDateConverter());
        }
    }
//    @Override
//    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
//        //converters.clear();
//        converters.add(new StringHttpMessageConverter());
//        converters.add(new FastJsonHttpMessageConverter());
//    }
//    @Override
//    public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
//        //converters.add(new StringHttpMessageConverter());
//
//        FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
//        List<MediaType> supportedMediaTypes = new ArrayList<>();
//        supportedMediaTypes.add(MediaType.APPLICATION_JSON);
//        supportedMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
//        supportedMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
//        fastConverter.setSupportedMediaTypes(supportedMediaTypes);
//        converters.add(fastConverter);
//    }
}
src/main/java/com/moral/controller/MobileController.java
@@ -68,7 +68,7 @@
     * @param newpassword the newpassword
     * @return the result bean
     */
    @PostMapping("upPassword")
    @RequestMapping("upPassword")
    public AppData<OperateUser> updatePassword(Integer uid, String password, String newpassword) {
        OperateUser operateUser = operateUserService.updatePassword(uid,password,newpassword);
        return new AppData<OperateUser>(operateUser); 
@@ -86,7 +86,7 @@
     * @param monitorpoint
     * @return
     */
    @PostMapping("reportDevice")
    @RequestMapping("reportDevice")
    public AppData<String> installDevice(
            HttpServletRequest request ,
            @RequestParam(value ="uid") Integer uid,
@@ -118,7 +118,7 @@
     * @param pageSize the page size
     * @return the install devices by operate user
     */
    @PostMapping("myRelease")
    @RequestMapping("myRelease")
    public AppData<List<Device>> getInstallDevicesByOperateUser(@RequestParam(value="uid", required=true)Integer uid, 
            @RequestParam(defaultValue="0")Integer pageIndex, @RequestParam(defaultValue="0")Integer pageSize) {
        List<Device> devices = deviceService.getInstallDevicesByOperateUser(uid, pageIndex, pageSize);
@@ -131,7 +131,7 @@
     * @param mac the mac
     * @return the device by mac
     */
    @GetMapping("getEquInfoByMac")
    @RequestMapping("getEquInfoByMac")
    public AppData<Map> getDeviceByMac(@RequestParam(value="mac", required=true)String mac) {
        Device device = deviceService.getDeviceByMac(mac,false);//不从缓存取
        Map<String,Object> deviceMap = new HashMap<>(BeanMap.create(device));
@@ -146,7 +146,7 @@
     * @param request the area name
     * @return the monitor points by area name
     */
    @GetMapping("getMpointsByAreaName")
    @RequestMapping("getMpointsByAreaName")
    public AppData<List<MonitorPoint>> getMonitorPointsByAreaName(HttpServletRequest request) {
        Map<String, Object> parameters = getParametersStartingWith(request, null);
        List<MonitorPoint> monitorPoints = monitorPointService.getMonitorPointsByAreaName(parameters);
@@ -159,7 +159,7 @@
     * @param request the area name
     * @return the organizations by area name
     */
    @GetMapping("getOrgsByAreaName")
    @RequestMapping("getOrgsByAreaName")
    public AppData<List<Organization>> getOrganizationsByAreaName(HttpServletRequest request) {
        Map<String, Object> parameters = getParametersStartingWith(request, null);
        List<Organization> organizations = organizationService.getOrganizationsByAreaName(parameters);
@@ -172,7 +172,7 @@
     * @param mobile
     * @return
     */
    @PostMapping("sendSms")
    @RequestMapping("sendSms")
    public AppData<String> sendSms(String mobile) {
        AppData apiData = new AppData();
@@ -222,7 +222,7 @@
     * @param code
     * @return
     */
    @PostMapping("password")
    @RequestMapping("password")
    public AppData<String> password(String username, String password, String code){
        AppData apiData = new AppData();
@@ -257,7 +257,7 @@
        }
    }
    @GetMapping("profession")
    @RequestMapping("profession")
    public AppData<List<Profession>> profession(){
        List<Profession> professions = professionService.getProfessiontList();
src/main/java/com/moral/mapper/ProfessionMapper.java
@@ -3,7 +3,5 @@
import com.moral.common.mapper.BaseMapper;
import com.moral.entity.Profession;
import java.util.List;
public interface ProfessionMapper extends BaseMapper<Profession> {
}