Commit 065a2688 authored by 廖旭伟's avatar 廖旭伟

功能优化

parent 45915d75
package com.mortals.xhx.base.system.user.model.vo;
import lombok.Data;
@Data
public class UserPassword {
String oldPwd;
String newPwd;
}
......@@ -10,16 +10,14 @@ import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.framework.annotation.Operlog;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.vo.UserPassword;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.UserStatus;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -94,10 +92,10 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@RequestMapping(value = "change/password", method = RequestMethod.POST)
@Operlog(msg = "密码修改成功!")
public String changePassword(@RequestParam String oldPwd, @RequestParam String newPwd) {
public String changePassword(@RequestBody UserPassword userPassword) {
JSONObject ret = new JSONObject();
try {
service.updateUserPwd(super.getCurUser().getLoginName(), oldPwd, newPwd);
service.updateUserPwd(super.getCurUser().getLoginName(), userPassword.getOldPwd(), userPassword.getNewPwd());
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "密码修改成功!");
} catch (Exception e) {
......
......@@ -101,28 +101,7 @@ public class CustomerWebSocketClient extends WebSocketClient {
update.setUpdateTime(new Date());
matterApplyDatumService.update(update);
}
if(apply){
MatterApplyEntity applyEntity = matterApplyService.get(datumEntity.getApplyId());
List<MatterApplyDatumEntity> list = matterApplyDatumService.find(new MatterApplyDatumQuery().applyId(applyEntity.getId()));
for(MatterApplyDatumEntity item:list){
if(item.getReviewStatus()==2){
apply = false;
}
}
MatterApplyEntity update = new MatterApplyEntity();
update.setId(applyEntity.getId());
if(apply) {
update.setApplyState(4);
}else {
update.setApplyState(2);
if(StringUtils.isNotEmpty(mandatoryFields)) {
update.setAdvisement(applyEntity.getAdvisement() + mandatoryFields + ";");
}
}
update.setUpdateTime(new Date());
matterApplyService.getDao().update(update);
}else {
if(!apply){
MatterApplyEntity applyEntity = matterApplyService.get(datumEntity.getApplyId());
MatterApplyEntity update = new MatterApplyEntity();
update.setId(applyEntity.getId());
......
......@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.net.URI;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -75,17 +76,17 @@ public class SingleApplyreviewService implements IApplicationStartedService {
List<MatterDatumEntity> datumEntityList = matterDatumService.find(new MatterDatumQuery().matterId(datumList.get(0).getMatterId()));
Map<Long,MatterDatumEntity> datumEntityMap = datumEntityList.stream().collect(Collectors.toMap(datumEntity->datumEntity.getId(), Function.identity()));
for(MatterApplyDatumEntity item:datumList){
MatterDatumEntity matterDatumEntity = datumEntityMap.get(item.getDatumId());
if(StringUtils.isNotEmpty(matterDatumEntity.getSystemPrompt())&&StringUtils.isNotEmpty(matterDatumEntity.getPrompt())) {
CustomerWebSocketClient webSocketClient = new CustomerWebSocketClient(uri);
webSocketClient.connect();
webSocketClient.setMatterApplyDatumService(matterApplyDatumService);
webSocketClient.setMatterApplyService(matterApplyService);
if(!webSocketClient.isOpen()){
if (!webSocketClient.isOpen()) {
Thread.sleep(2000);
}
webSocketClient.setApplyDatumId(item.getId());
//TODO
MatterDatumEntity matterDatumEntity = datumEntityMap.get(item.getDatumId());
Map<String, String> processUserImage = new HashMap<>();
processUserImage.put("action", "pre_review");
processUserImage.put("system_prompt", matterDatumEntity.getSystemPrompt());
......@@ -95,7 +96,7 @@ public class SingleApplyreviewService implements IApplicationStartedService {
String user_image_url = ImageToBase64Converter.convertToBase64(rootPath + item.getFileUrl());
processUserImage.put("user_image_url", user_image_url);
processUserImage.put("serial_number", item.getId().toString());
if(webSocketClient.isOpen()) {
if (webSocketClient.isOpen()) {
webSocketClient.setCurrentTime(System.currentTimeMillis());
webSocketClient.send(JSONObject.toJSONString(processUserImage));
//log.info("发送消息: " + JSONObject.toJSONString(processUserImage));
......@@ -105,7 +106,30 @@ public class SingleApplyreviewService implements IApplicationStartedService {
} catch (InterruptedException e2) {
}
webSocketClient.close();
}else {
item.setReviewStatus(1);
item.setUpdateTime(new Date());
matterApplyDatumService.update(item);
}
}
boolean apply = false;
MatterApplyEntity applyEntity = matterApplyService.get(applyId);
List<MatterApplyDatumEntity> list = matterApplyDatumService.find(new MatterApplyDatumQuery().applyId(applyEntity.getId()));
for(MatterApplyDatumEntity item:list){
if(item.getReviewStatus()==2){
apply = false;
}
}
MatterApplyEntity update = new MatterApplyEntity();
update.setId(applyEntity.getId());
if(apply) {
update.setApplyState(4);
}else {
update.setApplyState(2);
}
update.setUpdateTime(new Date());
matterApplyService.getDao().update(update);
}
}catch (Exception e){
......
......@@ -62,6 +62,7 @@ public class MatterDatumConvertTaskImpl implements ITaskExcuteService {
SiteMatterQuery siteMatterQuery = new SiteMatterQuery();
siteMatterQuery.setIsConvert(0);
PageInfo pageInfo = new PageInfo();
pageInfo.setPrePageResult(100);
Result<SiteMatterEntity> resultList = siteMatterService.find(siteMatterQuery,pageInfo,null);
List<SiteMatterEntity> siteMatterEntities = resultList.getList();
if(CollectionUtils.isNotEmpty(siteMatterEntities)){
......@@ -109,7 +110,7 @@ public class MatterDatumConvertTaskImpl implements ITaskExcuteService {
update.setUpdateTime(new Date());
matterDatumFileService.update(update);
}catch (Exception e){
log.error("DatumId:"+datumFileEntity.getDatumId()+",文件下载失败...",e);
log.error("DatumId:"+datumFileEntity.getDatumId()+",datumFileId:"+datumFileEntity.getId()+",文件下载失败...",e);
errorConvertIdList.add(datumEntity.getMatterId());
}
}
......
......@@ -24,5 +24,5 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery);
List<DeptVo> getBusinessByDept(DeptQuery deptQuery);
Result<DeptEntity> getListExt(DeptEntity params, PageInfo pageInfo);
}
package com.mortals.xhx.module.dept.dao.ibatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.dept.model.DeptQuery;
......@@ -41,4 +42,9 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements
List list = this.getSqlSession().selectList(this.getSqlId(GET_BUSINESS_BY_DEPT), paramDto);
return list;
}
@Override
public Result<DeptEntity> getListExt(DeptEntity params, PageInfo pageInfo) {
return this.getList(this.getQueryParam(params), pageInfo,"getListExt");
}
}
......@@ -2,6 +2,8 @@ package com.mortals.xhx.module.dept.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessEntity;
......@@ -50,5 +52,5 @@ public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
Rest<Map<String,List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context);
Result<DeptEntity> getListExt(DeptEntity params, PageInfo pageInfo);
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
......@@ -210,6 +211,11 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
return Rest.ok(collect);
}
@Override
public Result<DeptEntity> getListExt(DeptEntity params, PageInfo pageInfo) {
return dao.getListExt(params,pageInfo);
}
/**
* @param entity
......
......@@ -6,6 +6,8 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
......@@ -52,21 +54,21 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
super.setModuleDesc("部门");
}
@Override
protected void doListBefore(DeptEntity query, Map<String, Object> model, Context context) throws AppException {
query.setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("a.sort", OrderCol.ASCENDING));
add(new OrderCol("a.createTime", OrderCol.ASCENDING));
}
});
if(!ObjectUtils.isEmpty(query.getFilter())&& YesNoEnum.YES.getValue()==query.getFilter()){
//过滤部门事项数据为0的部门
query.setTotalStart(0);
}
super.doListBefore(query, model, context);
}
// @Override
// protected void doListBefore(DeptEntity query, Map<String, Object> model, Context context) throws AppException {
// query.setOrderColList(new ArrayList<OrderCol>() {
// {
// add(new OrderCol("a.sort", OrderCol.ASCENDING));
// add(new OrderCol("a.createTime", OrderCol.ASCENDING));
// }
// });
//
// if(!ObjectUtils.isEmpty(query.getFilter())&& YesNoEnum.YES.getValue()==query.getFilter()){
// //过滤部门事项数据为0的部门
// query.setTotalStart(0);
// }
// super.doListBefore(query, model, context);
// }
@Override
protected void init(Map<String, Object> model, Context context) {
......@@ -171,4 +173,39 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
entity.setSource(1);
super.saveBefore(entity, model, context);
}
@PostMapping({"list"})
@Override
public Rest<Object> list(@RequestBody DeptEntity query) {
Rest<Object> ret = new Rest();
Map<String, Object> model = new HashMap();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code;
try {
this.doListBefore(query, model, context);
PageInfo pageInfo = this.buildPageInfo(query);
this.buildPermisionSql(query);
Result<DeptEntity> result = this.getService().getListExt(query, pageInfo);
this.doListAfter(query, result.getList(), context);
model.put("data", result.getList());
model.put("pageInfo", result.getPageInfo());
this.parsePageInfo(model, result.getPageInfo());
code = this.doListAfter(query, (Map)model, context);
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var9) {
code = -1;
this.doException(this.request, busiDesc, model, var9);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setDict(model.get("dict"));
ret.setMsg(model.get("message_info") == null ? "" : model.remove("message_info").toString());
return ret;
}
}
\ No newline at end of file
......@@ -59,5 +59,30 @@
</trim>
</select>
<!-- 获取列表 -->
<select id="getListExt" parameterType="paramDto" resultMap="DeptEntity-Map">
select <include refid="_columns"/>
from (SELECT DISTINCT d.* FROM mortals_sys_dept d,mortals_sys_single_matter s WHERE d.id=s.deptId) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
<include refid="_orderCols_"/>
</select>
<!-- 获取 -->
<select id="getListExtCount" parameterType="paramDto" resultType="int">
select count(1)
from (SELECT DISTINCT d.* FROM mortals_sys_dept d,mortals_sys_single_matter s WHERE d.id=s.deptId) as a
<trim suffixOverrides="where" suffix="">
where
<trim prefixOverrides="and" prefix="">
<include refid="_condition_"/>
</trim>
</trim>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment