@ -1,12 +1,18 @@
package com.ccsens.carbasics.api ;
import cn.hutool.core.collection.CollectionUtil ;
import cn.hutool.core.lang.Snowflake ;
import cn.hutool.core.text.StrFormatter ;
import cn.hutool.core.util.ObjectUtil ;
import cn.hutool.core.util.StrUtil ;
import com.ccsens.carbasics.util.Constant ;
import com.ccsens.carbasics.util.DefaultCodeError ;
import com.ccsens.common.bean.po.* ;
import com.ccsens.common.persist.dao.* ;
import com.ccsens.util.ExcelUtil ;
import com.ccsens.util.JsonResponse ;
import com.ccsens.util.StringUtil ;
import com.ccsens.util.exception.BaseException ;
import io.swagger.annotations.Api ;
import io.swagger.annotations.ApiImplicitParams ;
import io.swagger.annotations.ApiOperation ;
@ -26,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.* ;
import java.text.SimpleDateFormat ;
import java.util.Date ;
import java.util.List ;
@Api ( tags = "DEBUG" , description = "DebugController | " )
@RestController
@ -35,15 +42,315 @@ public class DebugController {
@Resource
private Snowflake snowflake ;
@Resource
private ProTaskDetailDao taskDetailDao ;
@Resource
private ProTaskSubDao taskSubDao ;
@Resource
private LabelBusinessDao labelBusinessDao ;
@Resource
private ProParentTaskDao parentTaskDao ;
@Resource
private ProRoleTaskDao roleTaskDao ;
@Resource
private ProTaskPluginDao taskPluginDao ;
@Resource
private ProRoleDao roleDao ;
@ApiOperation ( value = "/测试" , notes = "" )
@ApiImplicitParams ( {
} )
@RequestMapping ( value = "" , method = { RequestMethod . GET , RequestMethod . POST } , produces = { "application/json;charset=UTF-8" } )
public JsonResponse debug ( ) throws Exception {
addData ( ) ;
return JsonResponse . newInstance ( ) . ok ( "测试" ) ;
}
public void addData ( ) throws Exception {
//1.查询项目id
Long [ ] projectIds = {
1436146379201454080L ,
1443490334792491008L ,
1443490427687936000L ,
1443491311088050176L ,
1443495980086599680L ,
1443498394260873216L ,
1443505442503532544L ,
1443506475258617856L ,
1443514245856894976L ,
1443515282839838720L ,
1443526048691265536L ,
1443555407800049664L ,
1443762025401688064L ,
1443762852904312832L ,
1443770871679557632L ,
1443771081860325376L ,
1443773098532020224L ,
1443776293505343488L ,
1443786143505326080L ,
1443787650472615936L ,
1443792356511064064L ,
1443872825575481344L ,
1443900214611288064L ,
1443968425880985600L ,
1444097879731085312L ,
1444105732944568320L ,
1444106519619837952L ,
1444117655165607936L ,
1444123259498143744L ,
1444125735844585472L ,
1444130262169690112L ,
1444216312619606016L ,
1444251162596614144L ,
1444255325439139840L ,
1444456318831435776L ,
1444468524339961856L ,
1444479819227340800L ,
1444490520578760704L ,
1444493759277703168L ,
1444525126204006400L ,
1444601912271052800L ,
1444608719580307456L ,
1444617366968475648L ,
1444646869262409728L ,
1444672152933769216L ,
1444812939797471232L ,
1444818184023842816L ,
1444830753501487104L ,
1444836840892014592L ,
1444839792243384320L ,
1444840911493406720L ,
1444841946031071232L ,
1444847596459008000L ,
1444853304416018432L ,
1444854834489729024L ,
1444855743361851392L ,
1444857721286565888L ,
1444859594877968384L ,
1444869816770109440L ,
1444874752710942720L ,
1444891062987661312L ,
1444893505444126720L ,
1444893888463773696L ,
1444897703384588288L ,
1444925355055128576L ,
1444934994417164288L ,
1444952334844305408L ,
1444954392309800960L ,
1444955509773049856L ,
1444958660156727296L ,
1445014835690741760L ,
1445020591529926656L ,
1445033820532514816L ,
1445035627350597632L ,
1445036608868065280L ,
1445199870070890496L ,
1445204540638109696L ,
1445204666567892992L ,
1445223200404545536L ,
1445246163950510080L ,
1445323707513053184L ,
1445329123131269120L ,
1445343261513490432L ,
1445359652006273024L ,
1445548017854980096L ,
1445564544155131904L ,
1445570315672625152L ,
1445577300539351040L ,
1445582444324724736L ,
1445583311698403328L ,
1445584774453534720L ,
1445587950783176704L ,
1445603891197779968L ,
1445620520208048128L ,
1445660344973533184L ,
1445662269055967232L ,
1445686934344310784L ,
1445760349960937472L ,
1445915270244999168L ,
1445926577815953408L ,
1445938026336493568L ,
1445940249707683840L ,
1446017860345536512L ,
1446063431521411072L ,
1446069431259373568L ,
1446156984780070912L ,
1446271836118851584L ,
1446272213572657152L ,
1446296795289493504L ,
1446297944780447744L ,
1446300429276422144L ,
1446338554228908032L ,
1446366163725721600L ,
1446373460602527744L ,
1446383023661785088L ,
1446404566387269632L ,
1446412803253739520L ,
1446414511950274560L ,
1446416887549534208L ,
1446432348366446592L ,
1446637141705891840L ,
1446661572465532928L ,
1446662778365681664L ,
1446669441776754688L ,
1446735444854448128L ,
1446737797422784512L ,
1446749189785788416L ,
1446752435816374272L ,
1446759986557624320L ,
1446760050894053376L ,
1446768474797121536L ,
1446795257781166080L ,
1446838502867345408L ,
1447028872280547328L ,
1447043833761374208L ,
1447054527235891200L ,
1447072010726547456L ,
1447074496057188352L ,
1447075876088061952L ,
1447103967380381696L ,
1447138920163975168L ,
1447139101773144064L ,
1447161322809860096L ,
1447174761674448896L ,
1447191088136986624L ,
1447199293445513216L ,
1447369469881229312L ,
1447374927413125120L ,
1447396505974743040L ,
1447426851571245056L ,
1447446276273872896L ,
1447471380600987648L ,
1447475281098186752L ,
1447496787861708800L ,
1447723635375874048L ,
1447727386107060224L ,
1447736513168416768L ,
1447738441965248512L ,
1447759617282285568L ,
1447760088201961472L ,
1447766863198298112L ,
1447785319343857664L ,
1447797266298707968L ,
1447817633968955392L ,
1447819664108560384L ,
1447826659251331072L ,
1447836498983657472L ,
1447845666410995712L ,
1447846329551429632L ,
1447905294465376256L ,
1447938052839448576L ,
1448194066247589888L ,
1448473133999988736L ,
1448485063452008448L ,
1448499820682813440L ,
1448502008796684288L ,
1448552378973560832L ,
1448567391910109184L ,
1448980567378108416L ,
1449371992557101056L ,
} ;
for ( Long projectId : projectIds ) {
System . out . println ( projectId ) ;
//2.添加一级任务 taskDetail t_pro_task_sub t_label_business 14 t_pro_parent_task
Long firstTaskId ;
ProTaskDetail taskDetailOne = new ProTaskDetail ( ) ;
taskDetailOne . setId ( snowflake . nextId ( ) ) ;
taskDetailOne . setName ( "身份认证" ) ;
taskDetailDao . insertSelective ( taskDetailOne ) ;
firstTaskId = taskDetailOne . getId ( ) ;
//添加任务分解
ProTaskSub taskSubOne = new ProTaskSub ( ) ;
taskSubOne . setId ( snowflake . nextId ( ) ) ;
taskSubOne . setTaskDetailId ( taskDetailOne . getId ( ) ) ;
// taskSub.setPlanStartTime(project.getBeginTime());
// taskSub.setPlanEndTime(project.getEndTime());
// taskSub.setPlanDuration(project.getEndTime() - project.getBeginTime());
taskSubDao . insertSelective ( taskSubOne ) ;
//任务关联信息(关联项目)
ProParentTask parentTaskOne = new ProParentTask ( ) ;
parentTaskOne . setId ( snowflake . nextId ( ) ) ;
parentTaskOne . setTaskDetailId ( taskDetailOne . getId ( ) ) ;
parentTaskOne . setParentTaskDetailId ( projectId ) ;
parentTaskDao . insertSelective ( parentTaskOne ) ;
//查找一级任务标签
LabelBusiness labelBusinessOne = new LabelBusiness ( ) ;
labelBusinessOne . setId ( snowflake . nextId ( ) ) ;
labelBusinessOne . setBusinessType ( ( byte ) 0 ) ;
labelBusinessOne . setBusinessId ( taskDetailOne . getId ( ) ) ;
labelBusinessOne . setLabelId ( ( long ) 14 ) ;
labelBusinessDao . insertSelective ( labelBusinessOne ) ;
//3.添加二级任务 taskDetail t_pro_task_sub t_label_business 19 15 5 t_pro_parent_task t_pro_role_task t_pro_task_plugin
//添加二级任务信息(任务详情)
ProTaskDetail taskDetail = new ProTaskDetail ( ) ;
taskDetail . setId ( snowflake . nextId ( ) ) ;
taskDetail . setName ( "身份认证" ) ;
taskDetailDao . insertSelective ( taskDetail ) ;
//任务关联信息(关联一级任务)
ProParentTask parentTask = new ProParentTask ( ) ;
parentTask . setId ( snowflake . nextId ( ) ) ;
parentTask . setTaskDetailId ( taskDetail . getId ( ) ) ;
parentTask . setParentTaskDetailId ( firstTaskId ) ;
parentTaskDao . insertSelective ( parentTask ) ;
//查找重要性标签
LabelBusiness labelBusiness1 = new LabelBusiness ( ) ;
labelBusiness1 . setId ( snowflake . nextId ( ) ) ;
labelBusiness1 . setBusinessType ( ( byte ) 0 ) ;
labelBusiness1 . setBusinessId ( taskDetail . getId ( ) ) ;
labelBusiness1 . setLabelId ( ( long ) 19 ) ;
labelBusinessDao . insertSelective ( labelBusiness1 ) ;
LabelBusiness labelBusiness2 = new LabelBusiness ( ) ;
labelBusiness2 . setId ( snowflake . nextId ( ) ) ;
labelBusiness2 . setBusinessType ( ( byte ) 0 ) ;
labelBusiness2 . setBusinessId ( taskDetail . getId ( ) ) ;
labelBusiness2 . setLabelId ( ( long ) 15 ) ;
labelBusinessDao . insertSelective ( labelBusiness2 ) ;
LabelBusiness labelBusiness = new LabelBusiness ( ) ;
labelBusiness . setId ( snowflake . nextId ( ) ) ;
labelBusiness . setBusinessType ( ( byte ) 0 ) ;
labelBusiness . setBusinessId ( taskDetail . getId ( ) ) ;
labelBusiness . setLabelId ( ( long ) 5 ) ;
labelBusinessDao . insertSelective ( labelBusiness ) ;
//任务和角色关联
ProRoleExample proRoleExample = new ProRoleExample ( ) ;
proRoleExample . createCriteria ( ) . andProjectIdEqualTo ( projectId ) . andNameEqualTo ( "科主任" ) ;
List < ProRole > roleList = roleDao . selectByExample ( proRoleExample ) ;
if ( CollectionUtil . isEmpty ( roleList ) ) {
System . out . println ( "项目:" + projectId + "角色异常" ) ;
continue ;
}
ProRoleTask roleTask = new ProRoleTask ( ) ;
roleTask . setId ( snowflake . nextId ( ) ) ;
roleTask . setRoleId ( roleList . get ( 0 ) . getId ( ) ) ;
roleTask . setTaskId ( taskDetail . getId ( ) ) ;
roleTaskDao . insertSelective ( roleTask ) ;
//添加任务分解
ProTaskSub taskSubTwo = new ProTaskSub ( ) ;
taskSubTwo . setId ( snowflake . nextId ( ) ) ;
taskSubTwo . setTaskDetailId ( taskDetailOne . getId ( ) ) ;
// taskSub.setPlanStartTime(project.getBeginTime());
// taskSub.setPlanEndTime(project.getEndTime());
// taskSub.setPlanDuration(project.getEndTime() - project.getBeginTime());
taskSubDao . insertSelective ( taskSubTwo ) ;
ProTaskPlugin proTaskPlugin = new ProTaskPlugin ( ) ;
proTaskPlugin . setId ( snowflake . nextId ( ) ) ;
proTaskPlugin . setParam ( "{\"url\":\"https://www.tall.wiki/carbasics/apply-verify\"}" ) ;
proTaskPlugin . setPlginCol ( 1 ) ;
proTaskPlugin . setPlginRow ( 1 ) ;
proTaskPlugin . setTaskDetailId ( taskDetail . getId ( ) ) ;
proTaskPlugin . setPluginId ( 1442034255218876416L ) ;
proTaskPlugin . setColspan ( 1 ) ;
proTaskPlugin . setRowspan ( 1 ) ;
taskPluginDao . insertSelective ( proTaskPlugin ) ;
}
}
public void sql ( ) throws Exception {
String sql = "insert into t_qcp_car_record(id,car_id, type, car_value, time) values({}, 2, 1, {}, {});" ;